Repository navigation
Studio: image-to-video for Wan2.2-TI2V-5B and LTX-2 / LTX-2.3 - #13378
Conversation
…peline A video family can now name an image-to-video pipeline class (i2v_pipeline_class). A request carrying a first frame runs that class's __call__ over the pipeline Studio already loaded, so the weights, GGUF / prequant layers, offload hooks, compiled blocks and CUDA graphs are the ones text-to-video uses and nothing is loaded or copied. Text-only requests never enter the new path. Wan2.2-TI2V-5B declares WanImageToVideoPipeline and LTX-2 / LTX-2.3 declare LTX2ImageToVideoPipeline. Without width/height a first frame takes the resolution preset nearest its aspect and is centre-cropped onto it, as ComfyUI's i2v templates resize it; LTX-2.3 re-compresses the frame at CRF 18 like its ComfyUI template. The detector no longer builds the wrong pipeline: LTX-Video 0.9.x picks and HunyuanVideo-1.5 i2v repacks are refused at load validation with a message naming what to load instead. Status reports supports_first_frame / supports_last_frame per keyframe and canvas_from_presets; a last frame stays MiniMax-H3 only.
The Video page reads supports_first_frame / supports_last_frame (falling back to supports_keyframes on older backends): Wan2.2 TI2V 5B and LTX-2 get a single Start frame dropzone, MiniMax-H3 keeps start and end. Match source previews the preset nearest the picture for families that report canvas_from_presets, and the 1:4 to 4:1 warning stays MiniMax-H3's.
… swap to A first frame on Wan2.2-TI2V-5B now runs WanImageToVideoPipeline over the loaded pipe, so the fake runtime needs that class for the render to reach the step-skip arming the test checks.
… gate on diffusers - A first-frame render that lands while a background compile is still recording runs eager but unrecorded, so the compiled trace is always learned from text-to-video inputs (LTX-2's image-to-video passes a per-token timestep). - supports_first_frame is only true when this diffusers exports the family's image-to-video class, and a first frame is refused up front otherwise instead of after the render is reserved. - A component assigned mid-render keeps its registration in the restored pipeline config. - The LTX-2.3 CRF row also matches ltx23 names.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
The backend test shard does not install |
# Conflicts: # studio/backend/core/inference/video.py
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 89b1c5f8b8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if bg_eager and not i2v_active: | ||
| bg.note_eager_generation() | ||
| bg.kick() |
There was a problem hiding this comment.
Let image-only workloads finish background compilation
When background compilation is armed and users generate only image-to-video clips, every request enters with bg_eager, but this condition prevents both note_eager_generation() and kick(). Because the I2V path also suppresses sample recording, the compiler remains in recording forever, so all subsequent I2V renders are forced through the eager gate and never receive the configured compile optimization. The I2V path should either provide a compatible compile sample or explicitly resolve/disable the pending compiler rather than leaving it permanently pending.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 457f06f. When the background compile is armed, a successful image-to-video render now calls kick() at the end. If there are no recorded samples to compile from, the compile is abandoned, so later renders compile inline instead of staying eager. If an earlier cancelled text-to-video render did record samples, the background compile starts from those. Text-to-video renders behave as they did before. BackgroundCompile.abandon() only acts while the compile is still recording. Tests: test_an_image_only_session_does_not_leave_the_background_compile_pending, test_a_text_render_still_kicks_the_background_compile.
| "This is an LTX-Video 0.9.x checkpoint, a different architecture from LTX-2 that Studio does not " | ||
| "run. Load LTX-2 or LTX-2.3 instead (for example unsloth/LTX-2.3-GGUF)." | ||
| ) | ||
| _HV15_I2V_RE = r"(?<![a-z0-9])i2v(?![a-z0-9])" |
There was a problem hiding this comment.
Match Hunyuan I2V markers on the checkpoint, not its path
For local Hunyuan T2V checkpoints stored beneath a directory such as /models/i2v/HunyuanVideo-1.5-Diffusers-480p_t2v, this unrestricted token regex matches the parent directory. video_checkpoint_refusal() searches the joined repo path, display ID, and filename, so it rejects the valid T2V checkpoint as an unsupported I2V model even though the checkpoint name explicitly says t2v. Restrict the refusal to the checkpoint identifier or exempt an explicit T2V identifier.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 457f06f. The i2v marker now has to appear in the last path segment of an identifier, so an owner or parent folder named i2v no longer refuses a _t2v checkpoint. A trailing slash is still allowed. An i2v repo name or GGUF filename is still refused. Tests cover owner, POSIX parent and Windows parent folders, plus the cases that must still be refused.
| pipe = i2v_swap.enter_context( | ||
| first_frame_pipeline( | ||
| pipe, | ||
| fam.i2v_pipeline_class, | ||
| config_overrides = dict(getattr(fam, "i2v_pipeline_config", ()) or ()), |
There was a problem hiding this comment.
Rewire model-offload hooks for the I2V execution order
When state.offload_policy is model, the existing hooks were installed while this object was a T2V pipeline, whose sequence places the transformer before the VAE. The I2V call instead uses the VAE to encode the conditioning image before denoising, but changing __class__ here does not rebuild the already-linked hooks; when the transformer subsequently onloads, its original predecessor hook does not offload that prematurely loaded VAE. On memory-constrained configurations this leaves the VAE resident alongside the DiT even though the memory plan promises one top-level module at a time, which can turn an otherwise fitting low-VRAM render into an OOM.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Real, though the class swap is not the cause. In diffusers 0.41.0, WanImageToVideoPipeline and LTX2ImageToVideoPipeline both put vae after transformer in model_cpu_offload_seq, same as the T2V classes (Wan I2V also lists image_encoder, which TI2V-5B does not have). That means the stock I2V pipelines build the same chain. The first-frame vae.encode loads the VAE, but the transformer's hook only offloads the text encoder, so the VAE stays on the GPU through denoising. While the swap is active and model offload hooks exist, vae.encode is now wrapped to run the VAE's CpuOffload.init_hook once the encode returns. The wrapper is removed when the swap exits on success, cancel or failure. Text-to-video never goes through it. Test: test_model_offload_sends_the_vae_back_before_the_first_frame_denoise installs real accelerate offload hooks on the tiny Wan pipeline and checks that the VAE is no longer resident when each transformer forward starts.
| fam, | ||
| state.variant_id, | ||
| state.gguf_filename, | ||
| state.display_repo_id, | ||
| state.repo_id, |
There was a problem hiding this comment.
Include the resolved base repo when selecting LTX I2V defaults
For an LTX-2.3 fine-tune loaded from a neutral local filename/path with base_repo=Lightricks/LTX-2.3, variant_id can legitimately be None when the content hash is not one of the known releases. Although state.base_repo then remains the authoritative 2.3 identifier and is already used by the distilled/default-parameter checks below, it is omitted from this lookup, so the image request silently keeps Diffusers' CRF 33 instead of the declared LTX-2.3 CRF 18. Pass state.base_repo as another identifier so custom 2.3 checkpoints receive the intended conditioning preprocessing.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 457f06f. state.base_repo is now one of the identifiers used to pick the I2V call kwargs, matching the distilled and default-parameter lookups. A neutrally named fine-tune with base_repo=Lightricks/LTX-2.3 gets image_crf=18. With Lightricks/LTX-2 it keeps the pipeline default. Test: test_ltx23_crf_follows_the_declared_base_repo_of_a_neutrally_named_checkpoint.
| validate_video_keyframe_conditioning( | ||
| fam, h3_task, has_keyframes = bool(request.first_frame or request.last_frame) | ||
| fam, | ||
| h3_task, | ||
| has_keyframes = bool(request.first_frame or request.last_frame), | ||
| has_last_frame = bool(request.last_frame), |
There was a problem hiding this comment.
Check runtime I2V availability before auto-switching
When media auto-switch is enabled and the installed Diffusers build lacks the target family's I2V class, this preflight accepts a first-frame request solely because the family table declares support. The switch then evicts the resident model and spends the full target load before begin_generate() finally rejects the frame via _i2v_pipeline_available(), defeating this hook's stated purpose of refusing unservable requests before eviction. Check the target family's runtime pipeline availability here as well; the OpenAI /v1/videos pre-switch check has the same family-only gap.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in both places in 457f06f. The begin_generate check is now a shared assert_first_frame_pipeline_available(fam). Both the /video/generate and /v1/videos pre-switch hooks call it when the request carries a first frame, so a missing I2V class is refused before anything is evicted or loaded. Test: test_a_first_frame_without_the_i2v_class_is_refused_before_the_model_switch covers both routes.
… Hunyuan I2V markers to the checkpoint name, use base_repo for LTX-2.3 image CRF, settle the background compile after image-only renders, and check I2V availability before auto-switching
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 34a586d97e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| def video_checkpoint_refusal(fam: VideoFamily, *identifiers: Optional[str]) -> Optional[str]: | ||
| """Identifiers are joined into one line so an LTX-2.3 filename excuses an ``ltx-video`` folder.""" | ||
| joined = " | ".join(_identifier_blob(identifiers)) |
There was a problem hiding this comment.
Refuse old LTX checkpoints even inside LTX-2 paths
When an LTX-Video 0.9 checkpoint such as ltx-video-2b-v0.9-Q4_K_M.gguf is selected from a repo or local directory named LTX-2.3, joining all identifiers lets the regex's ltx-2 negative lookahead exempt the entire pick. Validation then accepts the incompatible 0.9 architecture as LTX-2 and proceeds to eviction/loading. Judge the selected checkpoint filename independently, while allowing an explicit LTX-2 filename to override only an old-model parent directory.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 636d377. video_checkpoint_refusal now also judges the last path segment of the most specific identifier (the GGUF filename, or the repo / folder when there is no file) on its own, so ltx-video-2b-v0.9-Q4_K_M.gguf in unsloth/LTX-2.3-GGUF or a /models/LTX-2/ltxv-2b-0.9.6-distilled folder is refused. The joined check is kept, so an LTX-2.3 file inside an ltx-video folder still loads. Tests added in tests/test_video_i2v.py; they fail on the previous head.
| out = encode(*args, **kwargs) | ||
| hook = getattr(vae, "_hf_hook", None) | ||
| if isinstance(hook, CpuOffload): | ||
| hook.init_hook(vae) |
There was a problem hiding this comment.
Offload the VAE when image encoding raises
With model CPU offload enabled, if vae.encode() raises—for example from an OOM while encoding the conditioning frame—execution never reaches hook.init_hook(vae). The surrounding context manager only restores the patched method, and the generation failure path does not reclaim the onloaded module, so the VAE remains GPU-resident and subsequent low-VRAM renders can continue failing. Run the offload operation from a finally around the encode call.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 636d377. The encode wrapper now calls init_hook(vae) from a finally, so the VAE goes back to the CPU when vae.encode() raises, and the exception still propagates. Added a test that makes the encode raise and checks the offload ran; it fails on the previous head.
| if (width is None or height is None) and first is not None and i2v_pipeline: | ||
| width, height = first_frame_canvas(fam, *first.size) |
There was a problem hiding this comment.
Preserve a supplied dimension for first-frame renders
When an API caller supplies exactly one dimension with an I2V frame, this branch discards it and chooses a preset solely from the image aspect. For example, LTX accepts width=768, height=null as the default 768×512 pair during request validation, but a portrait first frame is then rendered at 512×768, silently ignoring the explicit width and contradicting the validated shape. Source-aspect preset selection should apply only when both dimensions are omitted; a half-specified request should resolve its missing side consistently with shape validation.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not reachable through the API. VideoGenerateRequest refuses a keyframe request with only one of width / height ("width and height must be sent together, or both omitted", covered by test_video_routes.py and test_video_shape_validation.py), and /v1/videos only takes size as a full WxH pair or auto. So a request with a first frame always arrives with both sides or neither, and the preset-from-aspect branch is only reached with both omitted. No change made.
…folder, and offload the VAE when the first-frame encode raises
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Adds nvidia/Cosmos3-Nano and nvidia/Cosmos3-Edge to the Video page through diffusers' Cosmos3OmniPipeline (diffusers >= 0.40.0): text-to-video, and image-to-video from a first frame, following the layout of the Wan2.1 families (unslothai#13376) and the image-to-video path of unslothai#13378. Cosmos3 differs from the other video families in three ways the generic path did not handle, and each gets the smallest change that fits: - Its transformer is also its text model, so the pipeline has a tokenizer and no text encoder. A family whose bf16 component table prices the text encoder at 0.0 is now read as having none: sizing requires only transformer and vae, a cached snapshot without a text_encoder/ folder counts as complete, and an explicit text_encoder_quant is refused with the reason (relates to unslothai#14000). - Each card samples with scheduler and call settings that its shipped configs do not hold. New VideoFamily fields scheduler_overrides and call_kwargs carry them; a scheduler that rejects an override keeps its config. - The pipeline takes the first frame through its own image= argument and crops it itself (i2v_fits_first_frame = False; same pipeline class for both modes). Fidelity, measured against the plain diffusers pipeline at the cards' settings, seed 0, with Studio's own encoder on both sides: every frame identical for Nano (189 of 189, four clips) and Edge (121 of 121, four clips). Three settings were needed to get there and are set on both rows: - cudnn.benchmark off: two server processes otherwise rendered one Edge seed 55 dB (t2v) and 30 dB (i2v) apart. - The VAE encoder stays on the stock kernels: Edge image-to-video at the default speed was 29.5 dB from the card's output through the fused encoder, 51.8 dB with the stock one. - Cosmos3 decodes untiled when it fits, on every speed tier, with tiled decode as the out-of-memory fallback: the stock 16x tiles leave a 4-latent edge tile at 480 / 832 px and a faint seam. The seam is recorded as a strict expected failure in the tile-geometry test so a fix forces the entry out. Also in this commit: the local layout check reads a diffusers-library *Tokenizer component as a model, so Nano's sound_tokenizer/ no longer makes a complete local folder look broken; the download planner recognises the text_tokenizer/-without-text_encoder/ listing as Cosmos3's; the Reasoner, Policy, Sim, Transfer and FP8 builds are refused by name with the repo to load instead; Cosmos3-Super gets no family; the Hub catalog reads Cosmos3 pipelines as "Video gen"; a renamed local Cosmos3 folder is refused by the trainer instead of falling to the SDXL path; and the guardrail opt-out is passed through when the cosmos_guardrail package is absent. Components are fetched from the nvidia repos: no unsloth-hosted copies exist, both repos are public and ungated (OpenMDW-1.1), and the allowlist gains the same two lines Wan2.1 has (relates to unslothai#14003). Quantized Cosmos3 checkpoints are a follow-up (unslothai#12851): diffusers has no single-file converter for Cosmos3OmniTransformer, so a quant needs a hosted source and a key-map loader. Tests: family registry and freeze fixtures, component sizing, flow-shift and scheduler overrides, the i2v class invariant, refusals, local-folder detection, routes, mirrors, and opt-in GPU checks that render both models and compare against the diffusers output.
Adds `nvidia/Cosmos3-Nano` and `nvidia/Cosmos3-Edge` as Studio video families, following #13376 and #13378: text-to-video and image-to-video through diffusers' `Cosmos3OmniPipeline` (diffusers >= 0.41.0: 0.40.0 resolves a group-offloaded transformer's device as the CPU). **What's different about Cosmos3** - Its transformer is also the text model, so the pipeline has a tokenizer and no text encoder. A family whose bf16 component table prices the text encoder at 0.0 is now read as having none: sizing needs only transformer and VAE, a snapshot without `text_encoder/` counts as complete, and an explicit `text_encoder_quant` is refused with the reason (relates to #14000). - Each card samples with scheduler and call settings its shipped configs don't hold. New `VideoFamily` fields `scheduler_overrides` and `call_kwargs` carry them. - The pipeline takes the first frame through its own `image=` and crops it itself. - Components come from the nvidia repos: no unsloth-hosted copies exist, both are public and ungated (OpenMDW-1.1), allowlist gains the same two lines Wan2.1 has (relates to #14003). **Fidelity**: Studio output is frame-for-frame identical to the plain diffusers pipeline for both models (Nano 189/189 frames, Edge 121/121, four clips each, seed 0). Three settings were needed: `cudnn.benchmark` off, the VAE encoder on stock kernels, and untiled decode when it fits, including at speed off and under model / group / streaming offload (the stock 16x tiles leave a 4-latent edge tile at 480/832 px). When untiled does not fit, and on CPU / MPS, the tiled decode uses per-canvas strides that keep every edge tile at 8 or more latents (stock strides wherever they already do). **Also in this PR** (separate commits, can be split out; the root-index prefetch fix moved to #15184) - The latest-transformers offer in the UI covers the `cosmos3` / `cosmos3_edge` model types (the `unsloth run` prompt for it is left to a separate PR). - Frontend: picker rows, Hub "Video gen" label, page defaults; bundle budget raised by the bytes the rows add. **Tests**: backend and frontend suites show no new failures against main (same failing ids on both trees, all environment-related); typecheck clean. Real-weight renders were checked against plain diffusers outside the test suite (Edge on a B200: bit-identical, t2v and i2v; Edge on a T4: valid fp32 output). **Not in this PR**: training support, and quantized Cosmos3 checkpoints (#12851); diffusers has no single-file converter for `Cosmos3OmniTransformer`, so a quant needs a hosted source and a key-map loader. `cosmos_guardrail` is not required: Nano's `model_index.json` enables the safety checker by default, so the load either passes the opt-out or refuses with a message naming the package. Edge ships with it off. **Download and offload**: a Nano download skips `sound_tokenizer/` (1.99 GB, passed as None), a local Nano folder without `sound_tokenizer/` or `vision_encoder/` validates, and under `low_vram` the VAE goes back to the CPU after the conditioning encode for both t2v and i2v (real Edge: VAE on `cuda:0` at every transformer step before, `cpu` after). ## Screenshots Video page model picker on the merge base (left) and this branch (right): the branch lists Cosmos3 Edge after the HunyuanVideo rows.  The Hub pair below is harness state, not this PR: the two sides read the live Hub listing at different times, so the trending rows differ (the masked shot is otherwise identical). macOS and Windows legs: 41 of 41 steps identical. <!-- studio-regress:start --> ### Studio UI regression check Base `c9e5d4ab0` vs head `4aa1f7b91`. Functional: **NO_REGRESSION**, UI coverage 89%, 1 visual change(s), 0 text-only change(s). Only steps whose screenshots differ are shown. **crawl/r_hub**: masks cover 37% of the shot | reproduced on confirm (VISUAL_DIFF) Facts: `missing`: {'before': ['button:DeepSeek-V#.#-Flash-#-GGUF', 'button:Model hub', 'button:NVIDIA-Nemotron-#.#-Super-VL-#B-A#B-GGUF', 'button:Qwen#.#-#B-A#B-GGUF', 'button:Search', 'button:Show workflows', 'button:gemma-#-#B-A#B-it-GGUF'], 'after': ['button:Filters', 'button:MiniMax-H#-GGUF', 'button:NVIDIA-Nemotron-#.#-Super-VL-#B-A#B-GGUF', 'button:Show workflows']}  <!-- studio-regress:end --> --------- Co-authored-by: Daniel Han <[email protected]>
Image-to-video for Wan2.2 TI2V 5B and LTX-2 / LTX-2.3 in Studio
Fixes #13321 (image to video for Wan 2.2 5B and others).
Every video family entry in Studio names exactly one text-to-video pipeline (
WanPipeline,LTX2Pipeline,HunyuanVideo15Pipeline), so a starting image had nowhere to go: only MiniMax-H3 took a first frame. Image-to-video is the most downloaded video category on the Hub, and both Wan2.2-TI2V-5B (the same checkpoint is text and image to video) and LTX-2 / LTX-2.3 already load in Studio.What changes
Family table.
VideoFamilygains an optionali2v_pipeline_class(plusi2v_pipeline_configandi2v_call_kwargsfor per-family construction values and call kwargs). Any family can declare one; adding Wan2.2-I2V-A14B or another family later is a table entry.WanPipelineWanImageToVideoPipelineLTX2PipelineLTX2ImageToVideoPipelinefl2vaNo second load. A request with a first frame runs the i2v class's
__call__against the pipeline object Studio already built. The i2v class is constructed once over the loaded components only to read the instance state its__init__sets (its config, itsvideo_processor, the emptyimage_encoder/image_processorslots); for the duration of that one render the loaded pipeline takes that class and state, and both are put back afterwards, on success, cancel or failure. Weights, GGUF / prequant int8 / fp8 layers, offload hooks, compiled blocks, the prompt cache and CUDA-graph bookkeeping are the ones text-to-video uses. Text-only requests never enter this path.DiffusionPipeline.from_pipewas the obvious tool but ends withnew_pipeline.to(dtype=...), which defaults to float32: it would upcast every shared module (a full extra copy of the DiT, and Wan's fp32 VAE / bf16 DiT split undone). A test pins that behaviour so the reason stays visible.Defaults follow the official reference workflow templates (
video_wan2_2_5B_ti2v,video_ltx2_i2v,video_ltx2_3_i2v):Wan22ImageToVideoLatentand the LTX resize node do. An explicit size still wins.Wan22ImageToVideoLatentdoes and what LTX'sLTXVImgToVideoInplaceuses at strength 1.0 in the 2.0 template and the 2.3 refine stage.LTXVPreprocessin the 2.3 template), the diffusers default 33 for LTX-2.0 (same as its template).Detector fixes.
hunyuanvideo-community/HunyuanVideo-1.5-Diffusers-480p_i2v(and 720p_i2v, the distilled i2v repacks, i2v GGUFs) were claimed by the t2v families and would have been built asHunyuanVideo15Pipelineover i2v weights. They are now refused at load validation with a message naming the t2v repos to use. Serving them needsHunyuanVideo15ImageToVideoPipelinewith its own transformer and SigLIP image encoder, which is a new family rather than a first-frame toggle.Lightricks/LTX-Video(0.9.x, a different architecture) andltxv-2b/ltxv-13bGGUFs were routed into the ltx-2 family through itsltx-video/ltxvaliases. They are refused with a message pointing at LTX-2 / LTX-2.3. Anything naming LTX-2 itself (ltx-2,ltx-2.3,LTX-Video-2, an LTX-2.3 file inside a folder calledltx-video) is untouched.API.
/api/video/generateand/v1/videosinput_referenceacceptfirst_framefor every family that declares one;last_framestays MiniMax-H3 only and is refused elsewhere with "animates from a first frame only"./api/video/statusaddssupports_first_frame,supports_last_frameanddefaults.canvas_from_presets;supports_keyframeskeeps its MiniMax-H3 meaning for older frontends.Frontend. The Video page reads the per-frame fields (falling back to
supports_keyframeson an older backend). Wan2.2 TI2V 5B and LTX-2 show one Start frame dropzone, MiniMax-H3 keeps start and end. Match source previews the preset the backend will pick, and the 1:4 to 4:1 warning stays MiniMax-H3's.stable-diffusion.cpp. Studio only routes MiniMax-H3 GGUFs to sd.cpp (
is_h3_native); Wan2.2 and LTX GGUFs always run on Diffusers, so there is no sd.cpp path to pass the first frame through for these families and nothing changes there.Evidence
One B200, Studio's own
VideoBackend(load, thengenerate), GGUF loads, seed 1234, 25 frames, default speed settings. BEFORE is the merge base (fcee6485fe), run twice in separate processes for an A/A; AFTER is this branch, one process rendering text-to-video, image-to-video, image-to-video with no size, then text-to-video again. The first frame is a 16:9 crop of the Wan2.2 repo's example image. The PSNR / LPIPS (AlexNet) reference is that image centre-cropped onto the render canvas, compared against decoded frames of the saved MP4.Text-to-video is byte-identical (same MP4 sha256 and same decoded frames):
9e63d3a29e63d3a29e63d3a29e63d3a2low_vram(model offload + CUDA graphs)26d6a63726d6a63726d6a637bd8b1e3bbd8b1e3bbd8b1e3bbd8b1e3bThe last column also shows the class swap leaves nothing behind: text-to-video rendered after image-to-video on the same loaded pipeline is the same file, including under offload hooks and CUDA graphs.
Frame 0 follows the input image:
low_vramLTX-2.3's frame 0 is a little lower because the frame is re-encoded at CRF 18 before conditioning, as the reference workflow does. Its last frame cuts to the prompt's scene (a car on a coastal road, unrelated to the picture on purpose so conditioning cannot be mistaken for the prompt); Wan holds the picture for the whole one-second clip.
With width and height omitted, the 832x468 picture picked 1280x704 on Wan and 1216x704 on LTX (the presets nearest 16:9), and Wan's clip was identical to the explicit 1280x704 render.
Cost is the same as text-to-video once warm. Resident Wan, same process: image-to-video 23.9 s (VAE encode 0.59 s, DiT 20.8 s) against 23.2 s for text-to-video (DiT 20.9 s). LTX-2.3: 6.5 s against 7.9 s. The image-to-video renders were bit-identical across the two branch runs. Two one-time costs showed up: the very first image-to-video render on this machine took 175 s against 22 s for text-to-video in the same process (cold kernel caches for a path text-to-video never runs; the same sequence took 23.9 s in every later process), and under
low_vramswitching between text and image-to-video re-captures the denoiser's CUDA graph once (it is keyed on the call's input tree, and the image-to-video call passes an extraencoder_hidden_states_image=None).Tests
Backend, the 71 video / keyframe / detector test files plus the new
tests/test_video_i2v.py, CPU, same Studio venv:The 4 failures are the same test ids on both sides and unrelated (
test_build_prequant_checkpointcanonical id, threetest_diffusion_h3_trainerrotation tests).test_diffusion_cold_start.py(background compile): 39 / 39 on both.New coverage:
tests/test_video_i2v.py: the family table (which families take a first and a last frame, i2v class never equals the t2v class), request validation (first frame accepted only where declared, last frame refused by first-frame-only families, text-only requests never judged), nearest-aspect canvas, the LTX-2.3 CRF row, both detector refusals and the ids they must not refuse, load validation refusing before any load, and the class swap over a real tiny diffusersWanPipeline(expand_timesteps=True): same object, no parameter moved or cast, overlay removed, text-to-video after an image-to-video render bit-identical, restore on failure, a component assigned mid-swap staying registered, plus a test pinning whyfrom_pipeis not used.tests/test_video_backend.py: Wan and LTX first-frame renders throughVideoBackend.generateon the fake runtime (the i2v__call__runs on the loaded object, canvas and crop, CRF 18 for 2.3 only, text-to-video untouched afterwards, swap undone when the render raises, a last frame refused, a diffusers without the i2v class reporting no first frame and refusing the request before reserving the backend).Frontend (
node --test tests/**/*.test.ts): 11324 / 11324 on the merge base, 11333 / 11333 here. New:video-keyframe-canvas.test.ts(nearest-preset preview pinned to the backend's pairs, per-frame support with the legacy fallback) andvideo-start-frame-upload.test.ts(each dropzone gated on its own frame, payload gating, staged frames dropped per frame, the 1:4 to 4:1 warning H3-only).tsc -bandtsc -p tsconfig.test.jsonare clean; Biome reports no new diagnostics on the touched files.Not tested
HunyuanVideo15ImageToVideoPipelinewith the i2v transformer and a SigLIP image encoder (a new family entry with its own memory plan), not a first-frame toggle on the t2v family.Lightricks/LTX-2, 19B) was not rendered on a GPU; it shares the LTX-2.3 path and the pipeline default CRF. Only Q4_K_M GGUFs were rendered (resident, and Wan underlow_vrammodel offload with CUDA graphs): the prequant int8 / fp8 DiT, NVFP4, bf16 pipeline loads, group / sequential offload and torch.compile (regional or background) were not exercised with a first frame on a GPU. They act on the same pipeline object and modules the swap reuses, but that is reasoning, not a render. The background-compile interaction is covered by a unit test only.LTX2ImageToVideoPipeline. ltx-pipelines' own default CRF is 33 for every Gemma3 generation, while the 2.3 reference template uses 18; this follows the template.