Add Control v2 incremental experiment results (evidence, visuals, 42 fixed samples)
a64600b verified Download method_v2/evidence/code/packaging/package_bundle.py from CharlesZhang-USTC/snf_experiments: direct link, hf CLI and curl.
- Browser
- Download file 1.59 kB
-
https://huggingface.co/CharlesZhang-USTC/snf_experiments/resolve/main/method_v2/evidence/code/packaging/package_bundle.py
- Command line
-
hf download hf://CharlesZhang-USTC/snf_experiments/method_v2/evidence/code/packaging/package_bundle.py
-
curl -L -o package_bundle.py https://huggingface.co/CharlesZhang-USTC/snf_experiments/resolve/main/method_v2/evidence/code/packaging/package_bundle.py
1.59 kB
| """Create a portable build-context ZIP with explicit include/exclude rules.""" | |
| import hashlib | |
| import json | |
| import zipfile | |
| from pathlib import Path | |
| root=Path(__file__).resolve().parents[1];dest=root/'artifacts';dest.mkdir(exist_ok=True) | |
| archive=dest/'snf-five-models-cu128-build.zip' | |
| paths=[root/'Dockerfile',root/'.dockerignore',root/'PROJECT_OVERVIEW.md',root/'PAPER_OUTLINE.md'] | |
| paths.extend((root/'docs').glob('*.md')) | |
| paths.extend((root/'docs/figures').glob('*.png')) | |
| for folder in ('packaging','vendor','snf','experiments','suite'): | |
| for path in (root/folder).rglob('*'): | |
| if not path.is_file() or any(p in path.parts for p in ('__pycache__','.git','checkpoints','wandb','upstream_inspect')) or path.suffix.lower() in ('.pyc','.mp4','.gif'):continue | |
| paths.append(path) | |
| manifest={} | |
| with zipfile.ZipFile(archive,'w',compression=zipfile.ZIP_DEFLATED,compresslevel=6) as z: | |
| for path in sorted(paths): | |
| relative='snf-five-models/'+path.relative_to(root).as_posix();z.write(path,relative) | |
| manifest[relative]=hashlib.sha256(path.read_bytes()).hexdigest() | |
| digest=hashlib.sha256(archive.read_bytes()).hexdigest() | |
| (dest/'snf-five-models-cu128-build.zip.sha256').write_text(digest+' '+archive.name+'\n') | |
| (dest/'bundle-manifest.json').write_text(json.dumps(dict(archive=archive.name,sha256=digest,files=manifest),indent=2)) | |
| with zipfile.ZipFile(archive) as z: | |
| if z.testzip() is not None:raise RuntimeError('ZIP integrity failure') | |
| print(json.dumps(dict(archive=str(archive),files=len(paths),size_mib=archive.stat().st_size/2**20,sha256=digest),indent=2)) | |