shigeki Ishida commited on
Commit
6da486c
1 Parent(s): 860d490

fewshot number str->int

Browse files
Files changed (1) hide show
  1. src/display/utils.py +10 -6
src/display/utils.py CHANGED
@@ -55,7 +55,7 @@ auto_eval_column_dict.append(["license", ColumnContent, ColumnContent("Hub Licen
55
  auto_eval_column_dict.append(["params", ColumnContent, ColumnContent("#Params (B)", "number", False)])
56
  auto_eval_column_dict.append(["likes", ColumnContent, ColumnContent("Hub ❤️", "number", False)])
57
  auto_eval_column_dict.append(["revision", ColumnContent, ColumnContent("Revision", "str", False, False)])
58
- auto_eval_column_dict.append(["num_few_shots", ColumnContent, ColumnContent("Few-shot", "str", False)])
59
  auto_eval_column_dict.append(["add_special_tokens", ColumnContent, ColumnContent("Add Special Tokens", "bool", False)])
60
  auto_eval_column_dict.append(
61
  ["llm_jp_eval_version", ColumnContent, ColumnContent("llm-jp-eval version", "str", False)]
@@ -152,11 +152,15 @@ class NumFewShots(Enum):
152
 
153
  @staticmethod
154
  def from_str(shots: str) -> "NumFewShots":
155
- if shots == "0":
156
- return NumFewShots.shots_0
157
- if shots == "4":
158
- return NumFewShots.shots_4
159
- raise ValueError(f"Unsupported number of shots: {shots}. Must be either '0' or '4'")
 
 
 
 
160
 
161
 
162
  class LLMJpEvalVersion(Enum):
 
55
  auto_eval_column_dict.append(["params", ColumnContent, ColumnContent("#Params (B)", "number", False)])
56
  auto_eval_column_dict.append(["likes", ColumnContent, ColumnContent("Hub ❤️", "number", False)])
57
  auto_eval_column_dict.append(["revision", ColumnContent, ColumnContent("Revision", "str", False, False)])
58
+ auto_eval_column_dict.append(["num_few_shots", ColumnContent, ColumnContent("Few-shot", "number", False)])
59
  auto_eval_column_dict.append(["add_special_tokens", ColumnContent, ColumnContent("Add Special Tokens", "bool", False)])
60
  auto_eval_column_dict.append(
61
  ["llm_jp_eval_version", ColumnContent, ColumnContent("llm-jp-eval version", "str", False)]
 
152
 
153
  @staticmethod
154
  def from_str(shots: str) -> "NumFewShots":
155
+ try:
156
+ int_shots = int(shots)
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
 
165
 
166
  class LLMJpEvalVersion(Enum):