Download code/plan.py from yang29/afd-causal-forcing-baselines-vbench: direct link, hf CLI and curl.
- Browser
- Download file 3.45 kB
-
https://huggingface.co/datasets/yang29/afd-causal-forcing-baselines-vbench/resolve/main/code/plan.py
- Command line
-
hf download hf://datasets/yang29/afd-causal-forcing-baselines-vbench/code/plan.py
-
curl -L -o plan.py https://huggingface.co/datasets/yang29/afd-causal-forcing-baselines-vbench/resolve/main/code/plan.py
3.45 kB
| """Pin a completed CF checkpoint to the original full VBench protocol.""" | |
| import argparse | |
| import copy | |
| from pathlib import Path | |
| from scripts.causal_baselines_b200.common import REPO, ROOT, read, write, sha | |
| from scripts.causal_baselines_b200.eval_common import ( | |
| DIMENSIONS, VBENCH, records, git_state, implementation_hashes, checkpoint_path) | |
| def prepare(method, run_dir, step, output, smoke=False): | |
| run_dir,output=Path(run_dir),Path(output) | |
| metadata=read('/hpctmp/e0833524/afd_astrolabe_b200/data/prompts/VBench_full_info.json') | |
| if smoke: | |
| from scripts.vbench_b200.prepare import smoke_metadata | |
| metadata=smoke_metadata(metadata) | |
| template=read('/hpctmp/e0833524/afd_astrolabe_b200/runs/sf-gad200-vbench-aligned24-b4-ga3-lr2p5e6/resolved_config.json') | |
| provenance=read(run_dir/'causal_forcing_provenance.json') | |
| cf=provenance['base'] | |
| output.mkdir(parents=True,exist_ok=True) | |
| meta=output/'metadata.json' | |
| write(meta,metadata) | |
| if method=='advdmd': | |
| link=run_dir/'wan_models/Wan2.1-T2V-1.3B' | |
| link.parent.mkdir(exist_ok=True) | |
| if not link.exists(): | |
| link.symlink_to(read(run_dir/'config.json')['wan_model_dir'],target_is_directory=True) | |
| plan=dict(schema=1,method=method,smoke=smoke,training_run_dir=str(run_dir), | |
| checkpoint_run_dir=str(run_dir),checkpoint_step=step,training_target_step=160, | |
| checkpoint_selection='exact',output_dir=str(output),metadata=str(meta), | |
| metadata_sha256=sha(meta),metadata_rows=len(metadata),seeds=[42] if smoke else [42,43,44,45,46], | |
| dimensions=DIMENSIONS,generation_world_size=1,vbench_root=str(VBENCH), | |
| vbench_source=git_state(VBENCH),implementation_sha256=implementation_hashes(), | |
| generator_family='causal_forcing',student_checkpoint=cf['checkpoint'], | |
| student_checkpoint_sha256=cf['sha256'],causal_forcing_source=cf, | |
| upstream_dir=str(REPO/'.cache/astrolabe'),upstream_commit='35a5347ef2f0fdd748297b553425e823ed2da6da', | |
| pipeline_cwd=str(run_dir),frames=81,height=480,width=832,fps=16, | |
| sampler='official chunkwise Causal-Forcing initialization; shared pinned causal inference pipeline; four warped steps, CFG 1', | |
| pipeline_args={**copy.deepcopy(template['sample']),'model_kwargs':template['model_kwargs']}, | |
| lora_rank=template['lora']['rank'],lora_alpha=template['lora']['alpha']) | |
| checkpoint=checkpoint_path(plan) | |
| checksum=sha(checkpoint) | |
| if method=='astrolabe': | |
| ready=read(checkpoint.parent.parent/'ready.json') | |
| assert ready['complete'] and ready['step']==step | |
| plan['expected_videos']=len(records(plan)) | |
| path=output/'plan.json' | |
| write(path,plan) | |
| write(output/'selected_checkpoint.json',dict(method=method,step=step,checkpoint=str(checkpoint), | |
| sha256=checksum,plan_sha256=sha(path),selection='exact',training_target_step=160, | |
| training_target_reached=step>=160)) | |
| return path | |
| def main(): | |
| p=argparse.ArgumentParser(description=__doc__) | |
| p.add_argument('--method',required=True,choices=['astrolabe','advdmd']) | |
| p.add_argument('--run-dir',required=True,type=Path) | |
| p.add_argument('--step',required=True,type=int) | |
| p.add_argument('--output',required=True,type=Path) | |
| p.add_argument('--smoke',action='store_true') | |
| args=p.parse_args() | |
| print(prepare(args.method,args.run_dir,args.step,args.output,args.smoke),flush=True) | |
| if __name__=='__main__': | |
| main() | |