Datasets:
Download prepare_inputs.py from IndexTeam/Sandglass-Bench: direct link, hf CLI and curl.
- Browser
- Download file 821 Bytes
-
https://huggingface.co/datasets/IndexTeam/Sandglass-Bench/resolve/main/prepare_inputs.py
- Command line
-
hf download hf://datasets/IndexTeam/Sandglass-Bench/prepare_inputs.py
-
curl -L -o prepare_inputs.py https://huggingface.co/datasets/IndexTeam/Sandglass-Bench/resolve/main/prepare_inputs.py
821 Bytes
| #!/usr/bin/env python3 | |
| """Export original model messages and case IDs, excluding labels and metadata.""" | |
| import argparse | |
| import json | |
| from pathlib import Path | |
| def main(): | |
| ap = argparse.ArgumentParser(description=__doc__) | |
| ap.add_argument('--data-file',type=Path,default=Path(__file__).parent/'sandglass_bench.jsonl') | |
| ap.add_argument('--output',type=Path,required=True) | |
| args = ap.parse_args() | |
| args.output.parent.mkdir(parents=True,exist_ok=True) | |
| with args.data_file.open(encoding='utf-8') as source,args.output.open('w',encoding='utf-8') as output: | |
| for line in source: | |
| if line.strip(): | |
| row=json.loads(line) | |
| output.write(json.dumps(dict(case_id=row['case_id'],messages=row['prompt']),ensure_ascii=False)+'\n') | |
| if __name__ == '__main__': | |
| main() | |