lewtun HF staff commited on
Commit
675f890
β€’
1 Parent(s): e0edd3d

Format question answering columns

Browse files
Files changed (3) hide show
  1. README.md +2 -2
  2. app.py +11 -4
  3. utils.py +8 -1
README.md CHANGED
@@ -1,6 +1,6 @@
1
  ---
2
  title: AutoEvaluate
3
- emoji: 🏒
4
  colorFrom: red
5
  colorTo: red
6
  sdk: streamlit
@@ -22,6 +22,6 @@ The table below shows which tasks are currently supported for evaluation in the
22
  | `multi_class_classification` | βœ… | [`eval-staging-822`](https://huggingface.co/datasets/autoevaluate/eval-staging-822) |
23
  | `multi_label_classification` | ❌ | |
24
  | `entity_extraction` | βœ… | [`eval-staging-838`](https://huggingface.co/datasets/autoevaluate/eval-staging-838) |
25
- | `extractive_question_answering` | ❌ | |
26
  | `translation` | ❌ | |
27
  | `summarization` | ❌ | |
1
  ---
2
  title: AutoEvaluate
3
+ emoji: πŸ“Š
4
  colorFrom: red
5
  colorTo: red
6
  sdk: streamlit
22
  | `multi_class_classification` | βœ… | [`eval-staging-822`](https://huggingface.co/datasets/autoevaluate/eval-staging-822) |
23
  | `multi_label_classification` | ❌ | |
24
  | `entity_extraction` | βœ… | [`eval-staging-838`](https://huggingface.co/datasets/autoevaluate/eval-staging-838) |
25
+ | `extractive_question_answering` | βœ… | |
26
  | `translation` | ❌ | |
27
  | `summarization` | ❌ | |
app.py CHANGED
@@ -9,7 +9,14 @@ from dotenv import load_dotenv
9
  from huggingface_hub import list_datasets
10
 
11
  from evaluation import filter_evaluated_models
12
- from utils import get_compatible_models, get_key, get_metadata, http_get, http_post
 
 
 
 
 
 
 
13
 
14
  if Path(".env").is_file():
15
  load_dotenv(".env")
@@ -26,7 +33,7 @@ TASK_TO_ID = {
26
  # "multi_label_classification": 3, # Not fully supported in AutoTrain
27
  "entity_extraction": 4,
28
  "extractive_question_answering": 5,
29
- # "translation": 6, $ Not fully supported in AutoTrain evaluation
30
  "summarization": 8,
31
  }
32
 
@@ -202,7 +209,7 @@ with st.expander("Advanced configuration"):
202
  elif selected_task == "extractive_question_answering":
203
  col_mapping = metadata[0]["col_mapping"]
204
  # Hub YAML parser converts periods to hyphens, so we remap them here
205
- col_mapping = {k.replace("-", "."): v.replace("-", ".") for k, v in col_mapping.items()}
206
  with col1:
207
  st.markdown("`context` column")
208
  st.text("")
@@ -332,6 +339,6 @@ with st.form(key="form"):
332
  """
333
  )
334
  else:
335
- st.error("πŸ™ˆ Oh noes, there was an error submitting your evaluation job!")
336
  else:
337
  st.warning("⚠️ No models were selected for evaluation!")
9
  from huggingface_hub import list_datasets
10
 
11
  from evaluation import filter_evaluated_models
12
+ from utils import (
13
+ format_col_mapping,
14
+ get_compatible_models,
15
+ get_key,
16
+ get_metadata,
17
+ http_get,
18
+ http_post,
19
+ )
20
 
21
  if Path(".env").is_file():
22
  load_dotenv(".env")
33
  # "multi_label_classification": 3, # Not fully supported in AutoTrain
34
  "entity_extraction": 4,
35
  "extractive_question_answering": 5,
36
+ # "translation": 6, # Not fully supported in AutoTrain evaluation
37
  "summarization": 8,
38
  }
39
 
209
  elif selected_task == "extractive_question_answering":
210
  col_mapping = metadata[0]["col_mapping"]
211
  # Hub YAML parser converts periods to hyphens, so we remap them here
212
+ col_mapping = format_col_mapping(col_mapping)
213
  with col1:
214
  st.markdown("`context` column")
215
  st.text("")
339
  """
340
  )
341
  else:
342
+ st.error("πŸ™ˆ Oh no, there was an error submitting your evaluation job!")
343
  else:
344
  st.warning("⚠️ No models were selected for evaluation!")
utils.py CHANGED
@@ -70,7 +70,7 @@ def get_compatible_models(task, dataset_name):
70
  library=["transformers", "pytorch"],
71
  )
72
  compatible_models = api.list_models(filter=filt)
73
- return [model.modelId for model in compatible_models]
74
 
75
 
76
  def get_key(col_mapping, val):
@@ -79,3 +79,10 @@ def get_key(col_mapping, val):
79
  return key
80
 
81
  return "key doesn't exist"
 
 
 
 
 
 
 
70
  library=["transformers", "pytorch"],
71
  )
72
  compatible_models = api.list_models(filter=filt)
73
+ return sorted([model.modelId for model in compatible_models])
74
 
75
 
76
  def get_key(col_mapping, val):
79
  return key
80
 
81
  return "key doesn't exist"
82
+
83
+
84
+ def format_col_mapping(col_mapping: dict) -> dict:
85
+ for k, v in col_mapping["answers"].items():
86
+ col_mapping[f"answers.{k}"] = f"answers.{v}"
87
+ del col_mapping["answers"]
88
+ return col_mapping