AMR-KELEG commited on
Commit
d956a72
·
1 Parent(s): 6cd8ae6

Fix another bug in the results handling

Browse files
Files changed (3) hide show
  1. app.py +5 -2
  2. eval_utils.py +2 -0
  3. utils.py +1 -1
app.py CHANGED
@@ -41,7 +41,7 @@ with tab1:
41
  )["train"]
42
 
43
  except Exception as e:
44
- st.error(f"An error occurred while loading the predictions: {e}")
45
  model_predictions_rows = []
46
 
47
  if model_predictions_rows:
@@ -97,9 +97,12 @@ with tab1:
97
  f"https://huggingface.co/{row['model_name']}"
98
  for row in model_predictions_rows if row["status"] == "completed"
99
  ]
 
 
 
100
 
101
  results_df = results_df[
102
- ["Rank", "Model Name", "Accuracy", "Recall", "Precision", "F1 score", "URL"]
103
  ]
104
  st.data_editor(
105
  results_df,
 
41
  )["train"]
42
 
43
  except Exception as e:
44
+ st.info(f"Error in loading the results:\n{e}")
45
  model_predictions_rows = []
46
 
47
  if model_predictions_rows:
 
97
  f"https://huggingface.co/{row['model_name']}"
98
  for row in model_predictions_rows if row["status"] == "completed"
99
  ]
100
+ results_df["Commit ID"] = [
101
+ row["commit_id"] for row in model_predictions_rows if row["status"] == "completed"
102
+ ]
103
 
104
  results_df = results_df[
105
+ ["Rank", "Model Name", "Accuracy", "Recall", "Precision", "F1 score", "URL", "Commit ID"]
106
  ]
107
  st.data_editor(
108
  results_df,
eval_utils.py CHANGED
@@ -16,6 +16,8 @@ def predict_top_p(model, tokenizer, text, P=0.9):
16
  predictions = [0 for _ in range(18)]
17
  total_prob = 0
18
 
 
 
19
  for i in range(18):
20
  total_prob += probabilities[topk_predictions[i]]
21
  predictions[topk_predictions[i]] = 1
 
16
  predictions = [0 for _ in range(18)]
17
  total_prob = 0
18
 
19
+ # TODO: Assert that the list length is just 18
20
+
21
  for i in range(18):
22
  total_prob += probabilities[topk_predictions[i]]
23
  predictions[topk_predictions[i]] = 1
utils.py CHANGED
@@ -21,7 +21,7 @@ def update_model_queue(repo_id, model_name, commit_id, inference_function, statu
21
 
22
  predictions_object = {
23
  "model_name": model_name,
24
- "predictions": [],
25
  "commit_id": commit_id,
26
  "inference_function": inference_function,
27
  "last_updated_timestamp": timestamp,
 
21
 
22
  predictions_object = {
23
  "model_name": model_name,
24
+ "predictions": [[""]],
25
  "commit_id": commit_id,
26
  "inference_function": inference_function,
27
  "last_updated_timestamp": timestamp,