Download code/common.py from yang29/afd-causal-forcing-baselines-vbench: direct link, hf CLI and curl.
- Browser
- Download file 917 Bytes
-
https://huggingface.co/datasets/yang29/afd-causal-forcing-baselines-vbench/resolve/main/code/common.py
- Command line
-
hf download hf://datasets/yang29/afd-causal-forcing-baselines-vbench/code/common.py
-
curl -L -o common.py https://huggingface.co/datasets/yang29/afd-causal-forcing-baselines-vbench/resolve/main/code/common.py
917 Bytes
| import hashlib | |
| import json | |
| from pathlib import Path | |
| REPO = Path('/nfs/home/svu/e0833524/AFD') | |
| ROOT = Path('/scratch/e0833524/afd_causal_forcing_b200') | |
| CAMPAIGN = ROOT / 'campaigns/20261116-g24-160' | |
| MODEL_REPO = 'yang29/afd-baseline-checkpoints' | |
| RESULT_REPO = 'yang29/afd-causal-forcing-baselines-vbench' | |
| LONG = Path('/scratch/e0833524/afd_long_video_b200') | |
| METHODS = ('astrolabe', 'advdmd') | |
| STEPS = (40, 80, 120, 160) | |
| def read(path): | |
| return json.loads(Path(path).read_text()) | |
| def write(path, value): | |
| path = Path(path) | |
| path.parent.mkdir(parents=True, exist_ok=True) | |
| tmp = path.with_name(path.name + '.tmp') | |
| tmp.write_text(json.dumps(value, indent=2, ensure_ascii=False) + '\n') | |
| tmp.replace(path) | |
| def sha(path): | |
| h = hashlib.sha256() | |
| with Path(path).open('rb') as f: | |
| for chunk in iter(lambda: f.read(8 * 1024**2), b''): | |
| h.update(chunk) | |
| return h.hexdigest() | |