Download code/della/remaining.py from drkylj/prophet-v3: direct link, hf CLI and curl.
- Browser
- Download file 1.18 kB
-
https://huggingface.co/datasets/drkylj/prophet-v3/resolve/main/code/della/remaining.py
- Command line
-
hf download hf://datasets/drkylj/prophet-v3/code/della/remaining.py
-
curl -L -o remaining.py https://huggingface.co/datasets/drkylj/prophet-v3/resolve/main/code/della/remaining.py
1.18 kB
| """Split the v3 tasks that have no clean trial yet into K shards (one per token). | |
| Clean trial = result.json with no exception_info and a verifier_result, in any job dir matching the given globs. | |
| python -I v3/della/remaining.py <K> <out_dir> <job_glob> [<job_glob> ...] | |
| SRC_GLOB (env): which task dirs to draw from (default: all of tasks/prophet-v3-sif/shard*/*/). | |
| """ | |
| import glob, json, os, shutil, sys | |
| R = '/scratch/gpfs/TRIDAO/ly3223/oraclebench/' | |
| K, out, globs = int(sys.argv[1]), sys.argv[2], sys.argv[3:] | |
| done = set() | |
| for g in globs: | |
| for f in glob.glob(R + 'jobs/' + g + '/*__*/result.json'): | |
| r = json.load(open(f)) | |
| if r.get('exception_info') is None and r.get('verifier_result'): | |
| done.add(os.path.basename(r['config']['task']['path'].rstrip('/'))) | |
| src = sorted(glob.glob(os.environ.get('SRC_GLOB', R + 'tasks/prophet-v3-sif/shard*/*/'))) | |
| todo = [p for p in src if os.path.basename(p.rstrip('/')) not in done] | |
| shutil.rmtree(out, ignore_errors=True) | |
| for i, p in enumerate(todo): | |
| shutil.copytree(p, os.path.join(out, f'shard{i % K + 1}', os.path.basename(p.rstrip('/')))) | |
| print(f'all {len(src)} clean {len(done)} todo {len(todo)} shards {K}') | |