Download scripts/smoke_load.py from linqihao/mu-bench: direct link, hf CLI and curl.
- Browser
- Download file 1.07 kB
-
https://huggingface.co/datasets/linqihao/mu-bench/resolve/main/scripts/smoke_load.py
- Command line
-
hf download hf://datasets/linqihao/mu-bench/scripts/smoke_load.py
-
curl -L -o smoke_load.py https://huggingface.co/datasets/linqihao/mu-bench/resolve/main/scripts/smoke_load.py
1.07 kB
| """Load all HF configurations locally and compare every row to the raw case.""" | |
| from pathlib import Path | |
| import json | |
| import tempfile | |
| from datasets import load_dataset | |
| ROOT = Path(__file__).resolve().parents[1] | |
| EXPECTED = {'all': 800, 'tool_free': 392, 'tool_augmented': 408, | |
| 'serial': 392, 'serial_identity': 392, 'serial_identity_semantics': 392} | |
| if __name__ == '__main__': | |
| results = {} | |
| with tempfile.TemporaryDirectory(prefix='mubench-hf-load-') as cache: | |
| for name, count in EXPECTED.items(): | |
| ds = load_dataset(str(ROOT), name, split='test', cache_dir=cache) | |
| assert len(ds) == count, (name, len(ds)) | |
| assert 'string' in str(ds.features['tool_names']), ds.features | |
| for row in ds: | |
| case = json.loads((ROOT / row['case_path']).read_text()) | |
| assert case == json.loads(row['case_json']), (name, row['case_id']) | |
| results[name] = dict(rows=len(ds), complete_case_roundtrip=True) | |
| print(json.dumps(dict(passed=True, configurations=results), indent=2)) | |