SailorEval / evaluation /dataset.py
QingchengChang's picture
Update
ccba7e5 verified
Raw History Blame Contribute Delete
653 Bytes
from .io import DATA, load_json, read_jsonl
def select_rows(task_id,subset='full',limit=None):
if subset!='full':
raise ValueError('This release supports the full test set only.')
manifest=load_json(DATA/'manifest.json')
task=next((t for t in manifest['tasks'] if t['id']==task_id),None)
if task is None: raise ValueError('Unknown task: '+task_id)
rows=read_jsonl(DATA/task['path'])
if not rows: raise ValueError(f'No test records found for {task_id} at {task["path"]}')
if limit is not None:
if limit<=0: raise ValueError('--limit must be positive')
rows=rows[:limit]
return manifest,task,rows