Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
t0-0
commited on
Commit
•
7fd8d10
1
Parent(s):
6da486c
Change num_few_shots enum to handle int type
Browse files- app.py +6 -6
- src/display/utils.py +4 -9
app.py
CHANGED
@@ -96,7 +96,7 @@ def filter_models(
|
|
96 |
size_query: list[str],
|
97 |
precision_query: list[str],
|
98 |
add_special_tokens_query: list[str],
|
99 |
-
num_few_shots_query: list[
|
100 |
version_query: list[str],
|
101 |
vllm_query: list[str],
|
102 |
) -> pd.DataFrame:
|
@@ -122,7 +122,7 @@ def filter_models(
|
|
122 |
df = df[df["Add Special Tokens"].isin(add_special_tokens_query)]
|
123 |
|
124 |
# Filter by number of few-shot examples
|
125 |
-
df = df[df["Few-shot"].
|
126 |
|
127 |
# Filter by evaluator version
|
128 |
df = df[df["llm-jp-eval version"].isin(version_query)]
|
@@ -175,7 +175,7 @@ def update_table(
|
|
175 |
precision_query: list[str],
|
176 |
size_query: list[str],
|
177 |
add_special_tokens_query: list[str],
|
178 |
-
num_few_shots_query: list[
|
179 |
version_query: list[str],
|
180 |
vllm_query: list[str],
|
181 |
query: str,
|
@@ -211,7 +211,7 @@ if len(leaderboard_df) > 0:
|
|
211 |
list(NUMERIC_INTERVALS.keys()),
|
212 |
[i.value.name for i in Precision],
|
213 |
[i.value.name for i in AddSpecialTokens],
|
214 |
-
[i.value
|
215 |
[i.value.name for i in LLMJpEvalVersion],
|
216 |
[i.value.name for i in VllmVersion],
|
217 |
)
|
@@ -418,8 +418,8 @@ with gr.Blocks() as demo_leaderboard:
|
|
418 |
)
|
419 |
filter_columns_num_few_shots = gr.CheckboxGroup(
|
420 |
label="Num Few Shots",
|
421 |
-
choices=[i.value
|
422 |
-
value=[i.value
|
423 |
elem_id="filter-columns-num-few-shots",
|
424 |
)
|
425 |
filter_columns_version = gr.CheckboxGroup(
|
|
|
96 |
size_query: list[str],
|
97 |
precision_query: list[str],
|
98 |
add_special_tokens_query: list[str],
|
99 |
+
num_few_shots_query: list[int],
|
100 |
version_query: list[str],
|
101 |
vllm_query: list[str],
|
102 |
) -> pd.DataFrame:
|
|
|
122 |
df = df[df["Add Special Tokens"].isin(add_special_tokens_query)]
|
123 |
|
124 |
# Filter by number of few-shot examples
|
125 |
+
df = df[df["Few-shot"].isin(num_few_shots_query)]
|
126 |
|
127 |
# Filter by evaluator version
|
128 |
df = df[df["llm-jp-eval version"].isin(version_query)]
|
|
|
175 |
precision_query: list[str],
|
176 |
size_query: list[str],
|
177 |
add_special_tokens_query: list[str],
|
178 |
+
num_few_shots_query: list[int],
|
179 |
version_query: list[str],
|
180 |
vllm_query: list[str],
|
181 |
query: str,
|
|
|
211 |
list(NUMERIC_INTERVALS.keys()),
|
212 |
[i.value.name for i in Precision],
|
213 |
[i.value.name for i in AddSpecialTokens],
|
214 |
+
[i.value for i in NumFewShots],
|
215 |
[i.value.name for i in LLMJpEvalVersion],
|
216 |
[i.value.name for i in VllmVersion],
|
217 |
)
|
|
|
418 |
)
|
419 |
filter_columns_num_few_shots = gr.CheckboxGroup(
|
420 |
label="Num Few Shots",
|
421 |
+
choices=[i.value for i in NumFewShots],
|
422 |
+
value=[i.value for i in NumFewShots],
|
423 |
elem_id="filter-columns-num-few-shots",
|
424 |
)
|
425 |
filter_columns_version = gr.CheckboxGroup(
|
src/display/utils.py
CHANGED
@@ -147,18 +147,13 @@ class AddSpecialTokens(Enum):
|
|
147 |
|
148 |
|
149 |
class NumFewShots(Enum):
|
150 |
-
shots_0 =
|
151 |
-
shots_4 =
|
152 |
|
153 |
@staticmethod
|
154 |
-
def
|
155 |
try:
|
156 |
-
|
157 |
-
if int_shots == 0:
|
158 |
-
return NumFewShots.shots_0
|
159 |
-
if int_shots == 4:
|
160 |
-
return NumFewShots.shots_4
|
161 |
-
raise ValueError
|
162 |
except ValueError:
|
163 |
raise ValueError(f"Unsupported number of shots: {shots}. Must be either 0 or 4")
|
164 |
|
|
|
147 |
|
148 |
|
149 |
class NumFewShots(Enum):
|
150 |
+
shots_0 = 0
|
151 |
+
shots_4 = 4
|
152 |
|
153 |
@staticmethod
|
154 |
+
def from_int(shots: int) -> "NumFewShots":
|
155 |
try:
|
156 |
+
return NumFewShots(shots)
|
|
|
|
|
|
|
|
|
|
|
157 |
except ValueError:
|
158 |
raise ValueError(f"Unsupported number of shots: {shots}. Must be either 0 or 4")
|
159 |
|