Download hy_memtest.py from Cccccz/comparison: direct link, hf CLI and curl.
- Browser
- Download file 888 Bytes
-
https://huggingface.co/Cccccz/comparison/resolve/main/hy_memtest.py
- Command line
-
hf download hf://Cccccz/comparison/hy_memtest.py
-
curl -L -o hy_memtest.py https://huggingface.co/Cccccz/comparison/resolve/main/hy_memtest.py
888 Bytes
| import os, sys, time, json | |
| sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) | |
| from hycache import harness as H | |
| H.enter_repo() | |
| import torch | |
| from hycache.measure import make_ctrl | |
| pipe = H.load_pipeline(); case = H.load_cases()[0] | |
| for name, kw in [("none", {}), ("motioncache", {"thresh": 0.05}), ("taylorseer", {"interval": 3.0}), ("flowcache", {"thresh": 0.05})]: | |
| ctrl = make_ctrl(pipe, name, **kw) | |
| torch.cuda.empty_cache(); torch.cuda.reset_peak_memory_stats() | |
| _, _, t = H.generate(pipe, case, H.ACTIONS[0], controller=ctrl, num_frames=125, decode=False) | |
| print(f"{name:12s} {kw} denoise={t['denoise_dit_ms']:.0f}ms context={t['context_kv_dit_ms']:.0f}ms peak={t['peak_mem_gib']:.1f}GiB " | |
| f"reserved={torch.cuda.max_memory_reserved()/1024**3:.1f}GiB compute={ctrl.summary()['compute_equivalent_forwards']:.2f}/32 wall={t['wall_s']:.0f}s", flush=True) | |