Skip to content

Commit

Permalink
feat(experimental): visualize with streamlit (#290)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsxiaoys authored Jul 11, 2023
1 parent 5a5d6ee commit 2ad0b69
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 397 deletions.
4 changes: 1 addition & 3 deletions experimental/eval/eval.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ while ! curl -X POST http://localhost:8080/v1/health; do
sleep 5
done

papermill main.ipynb ./reports.ipynb -r filepattern "./tabby/dataset/*.jsonl" -r max_records "${MAX_RECORDS:-3}"

jupyter nbconvert reports.ipynb --TagRemovePreprocessor.enabled=True --TagRemovePreprocessor.remove_cell_tags remove --to html
python main.py "./tabby/dataset/*.jsonl" ${MAX_RECORDS:-3} > reports.jsonl

docker-compose down

Expand Down
3 changes: 1 addition & 2 deletions experimental/eval/eval_sky.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ if ! sky exec $ARGS; then
sky launch -c $ARGS
fi

scp tabby-eval:~/sky_workdir/reports.ipynb ./
scp tabby-eval:~/sky_workdir/reports.html ./
scp tabby-eval:~/sky_workdir/reports.jsonl ./
387 changes: 0 additions & 387 deletions experimental/eval/main.ipynb

This file was deleted.

1 change: 0 additions & 1 deletion experimental/eval/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import glob
import json
from dataclasses import dataclass
from transformers import HfArgumentParser


@dataclass
Expand Down
4 changes: 0 additions & 4 deletions experimental/eval/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
papermill
git+https://github.com/TabbyML/tabby.git#egg=tabby-python-client&subdirectory=clients/tabby-python-client
transformers
editdistance
matplotlib
notebook
23 changes: 23 additions & 0 deletions experimental/eval/visualize.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import streamlit as st
import pandas as pd
import altair as alt

st.set_page_config(layout="wide")

df = pd.read_json("reports.jsonl", lines=True)

for _, v in df.iterrows():
col1, col2, col3 = st.columns(3)
with col1:
st.write("prompt")
st.code(v.prompt)
with col2:
st.write("prediction")
st.code(v.prediction)
st.write("label")
st.code(v.label)
with col3:
col1, col2 = st.columns(2)
st.metric("Line score", v.line_score)
st.metric("Block score", v.block_score)
st.divider()

0 comments on commit 2ad0b69

Please sign in to comment.