Datasets:
mteb
/

Modalities:
Text
Formats:
json
Libraries:
Datasets
pandas
Massive Text Embedding Benchmark org
edited Aug 7, 2022

Solves https://github.com/embeddings-benchmark/mteb/issues/24
Goes along with https://github.com/embeddings-benchmark/mteb/pull/41

import glob
import json
import os

jsonl_files = glob.glob("../sts22-crosslingual-sts/*/*.jsonl")
print(jsonl_files)
for path in jsonl_files:
    print(path)
    with open(path, "r") as jsonl_file, open(path.replace(".jsonl", "tmp.jsonl"), "w") as jsonl_file_out:
        for line in jsonl_file:
            data = json.loads(line)
            data["score"] = data["score"] * -1 + 5
            jsonl_file_out.write(json.dumps(data) + "\n")
    os.rename(path.replace(".jsonl", "tmp.jsonl"), path)
Muennighoff changed pull request status to open
nouamanetazi changed pull request status to merged

Sign up or log in to comment