Repository navigation
video: Wan 2.2 TI2V-5B cmd worker, generic video limits, desktop (WSL2) guide - #162
Conversation
|
Randy reviewed head f548928. What passed:
Still needed:
|
|
Randy round 2 at dd9a7e0. The original probes pass now: defaults, reservation, H3 audio, the failed digest and parent exit. The Wan attribution is in,
|
|
Randy round 3 at 366d429. What passes:
Still needed:
|
|
Randy reviewed head 9eeaab2 (round 4). Changes needed. Verified fixed:
Is the local Diffusers patch safe? Yes, for Wan 2.2 TI2V-5B. None of the 8 upstream GPU failures applies to it:
All of the Wan exclusive-offload tests and the 20 existing Wan offload tests pass on GB10. Blocking:
Nit: This branch also conflicts with main now that #161 has merged (c6b4b7d), so it needs a rebase. |
…esktop guide A `cmd` video tool can now declare its limits (`max_pixels`, `max_side`, `size_multiple`, `default_size`, `max_seconds`, `fps`), checked before it loads (`engine.checkVideo`) and listed by `/v1/models` and `list_models`. Any video tool may declare `"audio": false`; a request's `audio` is optional and means the model's own when omitted, so a silent model is not refused by callers that leave it out. tools/video/wan runs Wan 2.2 TI2V-5B (Apache-2.0) through Diffusers on CUDA, text and image to video at 24 fps, sized for a 16 GB consumer card: the transformer is loaded onto the GPU and stored in fp8, and one large module holds the GPU at a time. docs/dev/DESKTOP.md sets up a Windows 11 desktop through WSL2 (systemd, a keepalive task, tailscale serve, pairing). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…o; reserve_for refuses first; Wan worker frees the GPU - engine.videoLimits: a cmd video tool's options within the API's (sides 256 to 2048, the grid made a multiple of the API's 16, max_seconds at most 20, fps at most 30). fill, checkVideo and the listings all use it, so the defaults are always accepted: max_side 320 gets 320x256; max_seconds 3 or fps [16] gives a request without them 3 s or 16 fps; size_multiple 24 means a 48 grid. - request.Video seconds and fps are 0 when omitted (HTTP, MCP, voice, reserve_for); engine.fill gives 5 s (or a shorter max_seconds) and 24 fps (or the first listed). - The generic audio option and its refusal apply to cmd workers only: an engine with its own check (H3, Kandinsky 6) keeps its audio. - reserve_for validates a video job's size and length (request.validate, then engine.check) before planning, unloading or loading anything. - Wan worker: after every job a fresh scheduler (UniPC holds the job's tensors), gc and empty_cache even when the modules are already on the CPU, the exception's traceback dropped before the release; idle GPU memory is logged after each job and at exit. - fetch.sh stages into WEIGHTS.staging and publishes only after every digest matches; a failed check keeps the previous snapshot. test_fetch.py runs in CI. - UPSTREAM.md entries 13 and 14 (the offload hooks, the VAE wrappers); NOTICE: the Wan weights, the copied negative prompt and Diffusers; DESKTOP.md restarts WSL and checks systemd, and calls localrouter from zig-out/bin; pins.json is LF. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rage Measured on the RTX 5070 Ti at 704x1280, 2 s, seed 7: text to video PSNR 22.17 dB / SSIM 0.904 mean against bf16, image to video 28.57 dB / 0.945 with its first frame at 48.03 dB; the criteria (20 dB, 0.70, first frame 30 dB) were set before the run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffusers' chained offload is right for in-order pipelines, and changing what enable_model_cpu_offload evicts would change every pipeline; the cost shows only on small cards where WDDM pages. It goes upstream as an opt-in option if the maintainers want one, or gives way to #14304's offload strategies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The published directory is built from the manifest's paths in the staging directory, so a file left there by an earlier attempt is never published. test_fetch covers a retry with an obsolete staged file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Left out is the model's own; 0 sent is refused before anything is submitted or reserved (POST /v1/videos, MCP generate_video and reserve_for, the voice loop's generate_video), where it used to pick the default. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
checkDefaults refuses at startup, naming the option: max_side below the smallest side on the size_multiple grid, max_pixels below the smallest frame, an empty or invalid fps list, a default_size the tool does not take. MODEL-DROPIN lists audio with the cmd worker's options (H3 and Kandinsky 6 keep their own). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… a directory of its own - A staged or published file is kept only when its size and sha256 are the pinned ones; a same-size repin is fetched, not reused. Each file is hashed once (when kept or downloaded), so verify_assets.py is no longer run. - Each run publishes through its own WEIGHTS.publish.XXXXXX and removes only that: a WEIGHTS.new or WEIGHTS.old that is not fetch.sh's is left alone (the old script deleted the first and restored the second as WEIGHTS). - A file that fails its digest stays in staging to inspect and is fetched anew on the next run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It used to start and advertise a 1 s limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… filing enable_model_cpu_offload(exclusive=True), drafted against Diffusers main as an issue, a patch with a shared MemoryTesterMixin test and a docs note, and the PR text; filing is the maintainer's decision. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s send the filled fps After the rebase onto #161: a cmd video tool's default_width and default_height (the ComfyUI worker's) are its declared default size when default_size is absent, and are checked at startup like it. #161's H3 tests call check without fill, so their requests carry the 24 fps fill would give. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s cmd video tool Exclusive offload, tried on Diffusers main, breaks pipelines that call submodules outside the top-level hooks (Motif's vision_tower; overrides without the option), and Diffusers is moving offload strategies into modular pipelines (#14304). For Wan TI2V-5B it is verified on GB10 (the exclusive test and the 20 existing Wan offload tests). Nothing is filed upstream. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9eeaab2 to
44d59fb
Compare
What
cmdworkers (engine.checkVideo,engine.VideoLimits). Acmdvideo tool declaresmax_pixels,max_side,size_multiple,default_size,max_secondsandfpsin its options. These are refused before the tool loads and listed in/v1/modelsandlist_modelsasvideo. Before this, acmdvideo tool could declare no limits, and every request without a size got 1344x768. Tools with a compiled-in enginecheck(H3) are unchanged.audiois the model's own when omitted.request.Video.audiois now?bool.engine.fillsets it from the tool'saudiooption (default true), andcheckVideorefusesaudio: truefor a tool that declares"audio": false. The MCPgenerate_videoschema drops"default": trueand says this. H3, Kandinsky 6 and testpattern readaudio orelse true, so they are unchanged.tools/video/wan: Wan 2.2 TI2V-5B (Apache-2.0,Wan-AI/Wan2.2-TI2V-5B-Diffusers@b8fff73, pinned and digest-checked) as acmdworker. It does text to video and image to video at 24 fps with no audio, through Diffusers on CUDA. It fits a 16 GB consumer card:from_pipe: it copies the text encoder, about 30 GiB of host memory.docs/dev/DESKTOP.md: a desktop with one consumer GPU on Windows 11 through WSL2. Covers systemd, a no-admin keepalive task (WSL stops idle distros, services and all),tailscale serve, pairing, start/stop, and measured figures.Checks
zig build,zig build test: pass (WSL2 Ubuntu 24.04, Zig 0.17.0). A new engine test covers the declared limits, the default size,audiofill and refusal, and the listing.zig fmt --checkon the touched Zig files: clean.tools/video/wan/test_worker.py(worker venv, fake engine): 9 tests pass. They cover lifecycle, refusals, cancel, failures, the first frame's fit, the MP4 via ffprobe, and the stdio protocol.verify_assets.py pins.json: 20/20 files match (31.9 GiB).tailscale serve, image to video at 704x1280 for 5 s, seed 7. Step about 25 s, VAE decode about 190 s, 10.7 GiB peak GPU allocation, 21.6 GiB resident host memory and 26.5 GiB peak. The full 50-step figures are in DESKTOP.md.Review fixes (Randy, head f548928)
engine.videoLimitskeeps acmdvideo tool's options within the API's: sides 256 to 2048, the grid made a multiple of the API's 16,max_secondsat most 20, fps at most 30.fill,checkVideoand the listings all use it, so a default is always accepted. A 320 px cap gets 320x256;max_seconds: 3orfps: [16]gives a request that omits them 3 s or 16 fps;size_multiple: 24becomes a 48 grid.secondsandfpsare 0 when a request omits them (HTTP, MCP, voice,reserve_for) and are filled from the model.reserve_forvalidates a video job's size and length (the API's checks, then the model's) before it plans, unloads or loads anything.audiooption and its refusal apply tocmdworkers only; H3 and Kandinsky 6 keep their own audio.gcandempty_cache. Idle GPU memory is logged after each job and at exit.fetch.shdownloads intoWEIGHTS.stagingand publishes only after every digest matches; a failed check keeps the previous snapshot.test_fetch.pycovers it and runs in CI.shared_config.py, Apache-2.0) and Diffusers. DESKTOP.md restarts WSL and checks systemd before enabling the service, and the token command useszig-out/bin.pins.jsonis LF only.reserve_forrefusing 2048x2048 for 20 s (integration); the worker's release after a success and after a cancel;fetch.shwith a corrupt file of the right size.Checks (dd9a7e0)
zig buildandzig build testpass (595 tests, 3 skipped).zig fmt --checkon the changed Zig files andgit diff --checkare clean. The 11 Wan worker tests andtest_fetch.pypass.Review fixes, round 3 (Randy, head dd9a7e0)
fetch.shretry. The published directory is built only from the current manifest's paths in staging, so a file left by an earlier attempt is never published.test_fetch.pycovers a retry with an obsolete staged file.secondsandfpsleft out are the model's own; 0 sent is refused before anything is submitted or reserved, inPOST /v1/videos, MCPgenerate_videoandreserve_for, and the voice loop'sgenerate_video(same bug).engine.checkDefaultsstops the daemon, naming the option, when acmdvideo tool's limits leave nothing to serve:max_sidebelow the smallest side on thesize_multiplegrid (max_side: 256,size_multiple: 24),max_pixelsbelow the smallest frame, an empty or invalidfpslist, or adefault_sizeit does not take.audiowith thecmdworker's options; H3 and Kandinsky 6 keep their own.test_fetch.py's retry; the integration test (seconds: "0"was accepted as 5 s); the voice unit test; the startup-limits unit test.Checks (366d429)
zig buildandzig build testpass (33/33 steps).zig fmt --checkon the changed Zig files andgit diff --checkare clean. The 11 Wan worker tests and bothtest_fetch.pytests pass.Review fixes, round 4 (Randy, head 366d429)
fetch.shreuses a file only at its pinned digest. A staged or published file is kept only when its size and sha256 match the pin, so a same-size repin is fetched again. Each file is hashed once, when kept or downloaded, which replaces theverify_assets.pypass. A file that fails its digest stays in staging to inspect and is fetched anew on the next run.fetch.shpublishes through its own directory. Each run uses a freshWEIGHTS.publish.XXXXXXand removes only that. AWEIGHTS.neworWEIGHTS.oldthat isn't fetch.sh's is left alone. The old script deleted the first and, with noWEIGHTS, restored the second asWEIGHTS.max_seconds: 0stops the daemon, naming the option, instead of advertising 1 s.test_fetch.py: a same-size repin, and another tool'sWEIGHTS.newandWEIGHTS.oldsurviving a failed and a successful fetch. Both fail against the round-3 script. The startup-limits unit test gainsmax_seconds: 0, which failed with the check off.Checks (9eeaab2)
zig buildandzig build testpass (33/33 steps, 350/351 tests, 1 skipped).zig fmt --checkon the changed Zig files andgit diff --checkare clean. The 11 Wan worker tests and the 4test_fetch.pytests pass.Round 5 (Randy, head 9eeaab2): rebased onto main after #161
default_width/default_height(the ComfyUI worker's own size) is now acmdvideo tool's declared default whendefault_sizeis absent, checked at startup like it. minimax_h3: area + long-side limit, so portrait (704x1248, 768x1344) fits #161's H3 tests callcheckwithoutfill, so their requests carry the 24 fpsfillgives. CI runs both the ComfyUI and the Wan fetch tests.mainon GB10, failed 8 of the 226 shared memory tests. Two causes: pipelines that call a submodule outside the top-level hooks (Motif'svision_towerran with its weights on the CPU), and pipelines that overrideenable_model_cpu_offloadwithout the option. Diffusers is also moving offload strategies into modular pipelines (#14304). For Wan TI2V-5B the hooks are verified: the exclusive test passed for every Wan pipeline, and Diffusers' 20 existing Wan offload tests pass. Nothing is filed upstream, and the private path is gone.cmdvideo tool may declareaudio: false".Checks (44d59fb)
zig buildandzig build testpass (33/33 steps, 359/360 tests, 1 skipped).zig fmt --checkandgit diff --checkare clean. The 11 Wan worker tests, the 4test_fetch.pytests and the ComfyUI worker tests pass.FP8 against the BF16 reference (RTX 5070 Ti)
RTX 5070 Ti 16 GB, driver 621.14, WSL 3.0.5, torch 2.8.0+cu128, diffusers 0.43.0. The worker at this head was driven over stdio: 704x1280, 2 s, 24 fps, seed 7, 50 steps, guidance 5. The prompt was "A red fox trots through fresh snow at dawn, its breath steaming, the camera tracking alongside." Image to video used frame 0 of the BF16 text-to-video clip as its first frame. Only
transformer_storagechanged between runs. The decoded H.264 frames were compared: PSNR, and SSIM on BT.601 luma with an 11x11 Gaussian.The criteria were set before the run: mean PSNR ≥ 20 dB and mean SSIM ≥ 0.70 for both modes, and image to video's first frame ≥ 30 dB. All pass. They are recorded in
tools/video/wan/README.md.FP8 is not faster. It holds about 1.9 GB less of the card and 5 to 7 GiB less host memory. BF16 peaked at 15.8 of 16.3 GB on the card and at 29.3 of the 30 GiB WSL host.
Idle VRAM (FP8,
offload: model)The card had 2619 MiB in use before the worker started (the desktop).
idle: GPU 0.01 GiB allocated, 0.02 GiB reservedidle: 0.01 GiB allocated, 0.02 GiB reservedexit(code 0, process gone)unloaded: 0.01 GiB allocated, 0.02 GiB reservedWhile the worker lives it holds about 330 MiB: its CUDA context, which goes at exit. Under WSL,
nvidia-smi --query-compute-appsgives no per-process figure.PR #161 (H3 area budget) touches the same
minimax_h3_tool.zigfile in another place, and the same MODEL-DROPIN row.🤖 Generated with Claude Code