File size: 816 Bytes
2dcd69b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from pathlib import Path

from datasets import load_dataset


def main():
    tasks = ["safety_or_not"]

    # check that all the expected files exist
    prediction_files = list(Path(".").glob("*.csv"))
    mismatched_files = set(tasks).symmetric_difference(set([f.stem for f in prediction_files]))
    if mismatched_files:
        raise ValueError(f"Incorrect number of files! Expected {len(tasks)} files, but got {len(prediction_files)}.")

    # check we can load the dataset for each task
    load_errors = []
    for task in tasks:
        try:
            dset = load_dataset("../raft_submission", task)
        except Exception as e:
            load_errors.append(e)

    if load_errors:
        raise ValueError(f"Could not load predictions! Errors: {load_errors}")


if __name__ == "__main__":
    main()