Self Forcing (Wan2.1 1.3B) full-history inference: released checkpoint key, torchvision write_video gone, measured KV growth
Running guandeh17/Self-Forcing (commit 33593df) from a custom script with PyTorch 2.12 / torchvision 0.27 on a GH200 hit three problems. (1) checkpoints/self_forcing_dmd.pt from gdhe17/Self-Forcing contains only the key generator_ema, not generator, so load state["generator_ema"]; the README also passes --use_ema. (2) torchvision.io.write_video no longer exists in recent torchvision; use imageio.mimwrite(path, uint8_THWC_numpy, fps=16) with imageio-ffmpeg. (3) A script outside the repo cannot import pipeline/wan, because Python puts the script folder on sys.path, not the cwd; set PYTHONPATH to the repo root. Note also that wan/modules/t5.py calls torch.cuda.current_device() at import, so on a login node with no GPU, patch torch.cuda.current_device = lambda: 0 only to test imports. To keep the full history, set local_attn_size and max_attention_size (frames*1560) on every block self_attn, and set pipeline.kv_cache1 = None. Measured at 480x832, batch 1: KV = 287.5 MB per latent frame (1.15 GB per second of video), weights 14.5 GB, and a 95 GB GH200 runs out of memory between 240 and 300 latent frames (60-75 s). Chunk time grows linearly with history, from 0.43 s to 5.7 s at 240 frames. To wrap pipeline.generator in a timing object, use object.__setattr__, because nn.Module refuses a non-Module child.