-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
70cc614
commit d59774d
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
""" | ||
Remove all votes of a certain model, e.g. if a bug was found. | ||
""" | ||
|
||
import json | ||
import os | ||
|
||
MODELS_TO_REMOVE = ["nomic-embed-text-v1.5"] | ||
TASKS = ["retrieval", "sts", "clustering"] | ||
|
||
for file in os.listdir("results_dataset_to_upload"): | ||
for task in TASKS: | ||
if task in file: | ||
# Load jsonl | ||
with open(f"results_dataset_to_upload/{file}", "r") as f: | ||
lines = f.readlines() | ||
# Remove models | ||
new_lines = [] | ||
for line in lines: | ||
line = json.loads(line) | ||
remove = False | ||
for model in MODELS_TO_REMOVE: | ||
if "model" in line: | ||
if model in line["model"]: | ||
remove = True | ||
break | ||
elif "model_name" in line: | ||
if model in line["model_name"]: | ||
remove = True | ||
break | ||
elif "0_model_name" in line: | ||
if (model in line["0_model_name"]) or (model in line["1_model_name"]): | ||
remove = True | ||
break | ||
else: | ||
print(f"Unknown model key in line: {line}") | ||
if not remove: | ||
new_lines.append(line) | ||
# Save jsonl | ||
with open(f"results_dataset_to_upload/{file}", "w") as f: | ||
for line in new_lines: | ||
f.write(json.dumps(line) + "\n") | ||
|