Repository navigation
minimax_h3: area + long-side limit, so portrait (704x1248, 768x1344) fits - #161
Conversation
… 768x1344) fits The pipeline's buffers all scale with a frame's area, so the limit is now max_pixels (x max_seconds) plus the long side (max_side, the model's 1344) instead of a separate width and height. A frame past max_pixels is taken for a clip short enough to fit the same buffers. max_width / max_height configs get their product. Jarvis: 901120 pixels, the same memory as 1280x704: 704x1248 for 8 s, 768x1344 for up to 6 s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…preflight, defaults - Dit.init takes the audio latent frames and sizes a_in from them; a small budget's max_s could be below the carried audio (512x512, 5 s: 23,356 bytes for 26,496). - fits caps a frame at the larger of max_pixels and the canvas's 768x1344 area, which bounds the video VAE's per-decode scratch (Jarvis: at most 486 MiB vs 445 MiB). - A first frame whose canvas leaves the prompt no text tokens is refused before loading. - defaultSize: default_size, then a legacy max_width/max_height size, then widest, each only if the tool takes it; widest stays within the API's 256 minimum side. - Tests: buffer and DiT capacities over every admitted shape, first-frame admission, and the default regressions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Addressed Randy's review in a17c235:
|
|
Randy reviewed head a17c235. The
|
…ep the default size within the API - The booking is the weights plus the buffers the limits allocate (P.scratchBytes: the DiT's, the text encoder's, the audio VAE's and the sampler's, from the same size tables their init allocates from), and a request adds its own scratch (P.requestBytes: the video VAE's decode; with a first frame the video and vision encoders, its latent and condition). resident_mb is a floor. The default limits still book the measured 40,000 MB peak. - engine.Entry.validate, called by serve at start against budget_bytes (else MemTotal less reserve_bytes): H3 refuses options outside the API's (max_pixels to 2048x2048, max_seconds 1 to 20, sides 256 to 2048) and limits whose largest clip does not fit. 2048x2048 for 20 s needs 198 GiB and stops the daemon; Jarvis (901120 px, 8 s) needs at most 57,149 MiB. - Options are read with saturating casts within those ranges, so no request can reach an overflowing narrowing (max_pixels 2^32 crashed a 768x448 check). - max_side is capped at the API's 2048 everywhere it is used, so the default size is one the API takes (max_side 4096 with default_size 2080x256 gave a 400). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Randy round 2 at 0f9b20f. The original over-budget and narrowing cases now fail cleanly at startup, and the default size follows the 2048 ceiling. The shared size tables match the device allocations, and 84,004 admitted shapes across 5 configs pass the capacity checks. GPU parity is 4 of 4 bit-exact. Still needed:
|
…ter sampling - The decode phase now counts the latents on the host in fp32 and fp16 (83.25 MiB at 2048x2048 for 5 s), and a request books the largest of its phases (decode; with a first frame, its encode or its sampling with the condition) on top of the frames, waveform and first-frame pixels on the host. - A first frame's latent is freed once the condition is built, and the condition (21 MiB at 768x1344) once the steps are done; the next first frame frees any condition before it allocates. check h3-e2e reports condition_resident and fails unless it is 0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Randy round 3 at 22f7dd9. What passes:
One blocker: Blocking: |
The steps that read the condition run inside conditioned(), which releases it when they return or fail (an allocation or CUDA error after firstFrame used to skip the release and leave 22,063,104 B resident at 768x1344). The release still comes before the decode. A host test drives conditioned() with a fake DiT whose steps fail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Randy round 4: safe to merge. The condition buffers are now released on every error path after |
…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>
…2) guide (#162) * video: Wan 2.2 TI2V-5B as a cmd worker, generic video limits, and a desktop 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> * video: one set of effective limits for cmd workers; H3 keeps its audio; 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> * wan: record the BF16 reference and acceptance for FP8 transformer storage 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> * UPSTREAM.md: the Wan offload and VAE patches stay local, and why 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> * wan fetch.sh: a retry publishes only the current manifest's files 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> * Video requests: an explicit 0 for seconds or fps is refused 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> * cmd video tools: limits that leave nothing to serve stop the daemon 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> * wan fetch.sh: reuse a file only at its pinned digest; publish through 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> * cmd video tools: an explicit max_seconds 0 stops the daemon It used to start and advertise a 1 s limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * UPSTREAM.md: the Diffusers opt-in for 13 and 14 is prepared, awaiting 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> * cmd video limits: default_width and default_height from main; H3 tests 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> * UPSTREAM.md: the Wan offload hooks stay local, and why; CHANGELOG says 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> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: JJ Eaton <58495321+oldbettie@users.noreply.github.com>
What
MiniMax H3's size check limited width and height separately (
max_width/max_height), so Jarvis (1280x704) capped portrait at 704x704. Every pipeline buffer (DiT tokens, latents, frames) scales with a frame's area, so the limit is now:max_pixels: a frame's area atmax_seconds. A frame larger than that is accepted for a clip short enough to fit the same buffers, and the refusal names the longest clip it takes.max_side: the long side (default 1344, the model's 768x1344 canvas).Backward compatible: a config with only
max_width/max_heightgets their product asmax_pixels, and either axis may take the long side.Jarvis:
max_pixels: 901120(same buffers andresident_mbas 1280x704). That allows 1280x704 or 704x1248 for 8 s, and 768x1344 for up to 6 s.Bit-exactness is unaffected: no numerical change. For a given area the buffer sizes are identical (
ceilingis a 32-px strip of the same area).Tests
minimax_h3_tooltests now cover:Ran CI's script-syntax/JSON checks,
zig buildandzig build teston a Davit Ubuntu 24.04 box: all pass.Review fixes (Randy, head a17c235)
P.scratchBytes): the DiT's, the text encoder's, the audio VAE's and the sampler's. These come from the same size tables theirinitallocates from. A request adds its own scratch (P.requestBytes): the video VAE's decode and, with a first frame, the video and vision encoders, its latent and its condition.resident_mbis now a floor. The default limits still book the measured 40,000 MB peak. Jarvis (901120 px, 8 s) books 53,567 MiB loaded and at most 57,149 MiB for its largest clip.engine.Entry.validatehook runs fromserveagainstbudget_bytes, or MemTotal lessreserve_bytes. H3 refuses options outside the API's range (max_pixelsup to 2048x2048,max_seconds1 to 20, sides 256 to 2048), and limits whose largest clip does not fit.max_side=2048,max_pixels=4194304,max_seconds=20needs about 198 GiB, so the daemon stops with that reason.max_pixels=4294967296no longer crashes a 768x448 check.max_sideis capped at the API's 2048 everywhere it is used. Withmax_side=4096anddefault_size="2080x256", a request without a size now gets 960x544, which the API accepts.Checks (0f9b20f)
zig buildandzig build testpass (598 tests, 3 skipped).zig fmt --checkon the changed files andgit diff --checkare clean.Portrait parity on the target GPU
DGX Spark GB10 (sm_121), NGC PyTorch 26.07, ReleaseSafe build of 0f9b20f. Prompt: the twin's default. Seed 7, 8 steps, h3-turbo-nvfp4. For each shape,
python -m stk_twin.h3.generate --size WxH --frames Nwas compared withlocalrouter check h3-e2e, which replays the capture from Zig's own outputs.Every row is bit-exact: the uint8 frames' sha256 equals the twin's (e.g. 704x1248x192
3d320dae..., 768x1344x1585e30550b...), and so do the fp32 waveform's. The last shape ran under node02's GPU lock.Review fixes, round 3 (Randy, head 0f9b20f)
generateImage's fp32 and fp16 latents on the host (83.25 MiB at 2048x2048 for 5 s).P.requestBytesreturns the largest phase: decode; with a first frame, also its encode (device pixels, video and vision encoders, latent) and its sampling (latent and condition).workingBytesadds that to the frames, the waveform, a first frame's host pixels and ffmpeg's buffers.check h3-e2ereportscondition_residentand fails unless it is 0.minimax_h3_tool.zigfailed on 0f9b20f. The release is checked on the GPU (below).Checks (22f7dd9)
zig build testpasses (33/33 steps, 378/379 tests, 1 skipped).zig fmt --checkon the changed files andgit diff --checkare clean.First-frame condition release on the target GPU
DGX Spark GB10 (sm_121), NGC PyTorch 26.07, ReleaseSafe, under node02's GPU lock (18 min). Image to video at 704x1248, 56 frames, seed 7, 8 steps, with a generated 704x1248 PNG as the first frame. One twin capture (
stk_twin.h3.generate --image) was checked withcheck h3-e2eagainst two builds of 22f7dd9: as pushed, and with the pipeline'sreleaseConditioncall removed.condition_residentFrames sha256
afd72c74...matches the twin's in both. Freeing the condition changes no bits.Review fixes, round 4 (Randy, head 22f7dd9)
conditioned, which releases it when they return or fail. An allocation or CUDA error afterfirstFrameused to skip the release and leave 22,063,104 B resident at 768x1344. The release still comes before the decode, andfirstFramealready frees its own buffers when it fails.conditionedwith a fake DiT whose steps fail, and checks the condition is released, the first frame's latent is freed once, and a failedfirstFrameleaves the latent to its caller. It failed with the release placed only after successful steps (the old code).Checks (23a315d)
zig build testpasses (33/33 steps, 379/380 tests, 1 skipped).zig fmt --checkandgit diff --checkare clean. No GPU run: the replay order and the kernels are unchanged.Not done
Jarvis is not redeployed: the box is busy, so that waits on an OK.
🤖 Generated with Claude Code