unsloth/studio
Daniel Han 9f83d387c2 Add Wan2.2 text-to-video families to the video backend
Register two new video families and wire them through the backend, routes,
and frontend picker: wan2.2-ti2v-5b (single DiT) and wan2.2-t2v-a14b (the
dual-expert MoE). Both share diffusers' WanPipeline + WanTransformer3DModel
+ AutoencoderKLWan, which the VideoFamily dataclass already reserved fields
for (transformer2_class, is_moe, cfg2_kwarg).

Verified against the installed diffusers 0.39.0 before writing code:
- WanPipeline, WanTransformer3DModel, and AutoencoderKLWan are all exported
  from top-level diffusers 0.39.0.
- WanPipeline.__call__ (pipeline_wan.py:383) defaults to num_frames=81,
  num_inference_steps=50, guidance_scale=5.0. guidance_scale_2 DOES exist
  in 0.39 (line 392) and its check_inputs raises if it is passed when the
  pipeline's boundary_ratio is None (line 322), so the second guidance is
  threaded ONLY for the MoE family and only when inspect.signature accepts
  it (the same gate frame_rate already uses).
- The Wan VAE temporal factor is 4 (autoencoder_kl_wan.py scale_factor_temporal),
  and the pipeline snaps num_frames to 4k+1 (line 493), so frame_step is 4,
  unlike LTX-2's 8k+1. Sizes patchify at spatial 8 * patch 2 = 16, so
  resolution_multiple is 16.
- boundary_ratio and transformer_2 come from model_index.json: TI2V-5B ships
  boundary_ratio=null and transformer_2=[null,null] (single DiT), while A14B
  ships boundary_ratio=0.875 and transformer_2=WanTransformer3DModel (dual
  DiT). boundary_ratio lives in the pipeline config, so it needs no per-call
  plumbing.
- WanTransformer3DModel declares _repeated_blocks=["WanTransformerBlock"] and
  inherits CacheMixin (transformer_wan.py:508/551), so regional compile and
  First-Block-Cache both work.

bf16-resident component sizes, measured from each diffusers repo's on-disk
safetensors (all stored bf16), feed the auto memory table:
  TI2V-5B: transformer 20.0, UMT5 text encoder 11.4, VAE 2.8 GB.
  A14B:    two experts 57.2 each (114.3 total), text encoder 11.4, VAE 0.5 GB.

Backend changes make the optimisation layers dual-DiT aware: a small
_SecondDiTView proxy presents transformer_2 as pipe.transformer so the
existing single-DiT helpers (apply_speed_optims, apply_attention_backend,
apply_step_cache, quantize_transformer) cover BOTH experts on an is_moe load
without forking any helper; single-DiT loads are unchanged (views is just
(pipe,)). The two Wan base repos are added to the trusted non-GGUF allowlist.
A transformer_quant option is added to the load path, mirroring the image
backend's dense torchao fast path: on a pipeline-kind load the dense DiT(s)
are quantised in place onto the low-precision tensor cores and the engaged
scheme is surfaced in status. generate() threads guidance_2 through the
family's cfg2_kwarg when the loaded pipeline accepts it.

Routes and Pydantic models gain the optional transformer_quant (load /
status) and guidance_2 (generate) fields. The frontend picker gains the two
Wan models with 50-step / CFG 5.0 defaults; fps is supplied per family by
the backend.

Tests extend the fake runtime with WanPipeline and per-DiT transformer fakes
(single-DiT and dual-DiT), and cover family detection for both repos, 4k+1
frame snapping, default application, dual-DiT speed/cache/attention/quant
coverage on both experts, cfg2 threading gated on the pipeline signature,
trusted-repo validation, and the new route fields. Both the standard and the
diffusers/torchao-blocked CI-sim runs are green.
2026-07-04 14:06:47 +00:00
..
backend Add Wan2.2 text-to-video families to the video backend 2026-07-04 14:06:47 +00:00
frontend Add Wan2.2 text-to-video families to the video backend 2026-07-04 14:06:47 +00:00
src-tauri Speed up Studio desktop startup (#6742) 2026-06-29 15:27:39 +02:00
__init__.py Final cleanup 2026-03-12 18:28:04 +00:00
install_llama_prebuilt.py Studio: stop handing CI/user secrets to downloaded llama.cpp binaries (#6696) 2026-06-27 05:21:05 -07:00
install_node_prebuilt.py Pin isolated Node.js installer to committed sha256 digests (#6625) 2026-06-24 05:47:58 -07:00
install_python_stack.py Guard Windows ROCm torchao override skip (#6837) 2026-07-03 19:24:29 +01:00
install_sd_cpp_prebuilt.py Studio: use the Unsloth stable-diffusion.cpp prebuilt mirror for native diffusion (#6787) 2026-07-03 16:02:51 -03:00
LICENSE.AGPL-3.0 Add AGPL-3.0 license to studio folder 2026-03-09 19:36:25 +00:00
node_prebuilt_pins.json Pin isolated Node.js installer to committed sha256 digests (#6625) 2026-06-24 05:47:58 -07:00
package-lock.json ci: advisory lockfile supply-chain audit (no install-script changes) (#5604) 2026-05-19 05:56:56 -07:00
package.json ci: advisory lockfile supply-chain audit (no install-script changes) (#5604) 2026-05-19 05:56:56 -07:00
setup.bat Final cleanup 2026-03-12 18:28:04 +00:00
setup.ps1 [Studio] Add --with-llama-cpp-dir installer flag to reuse a local llama.cpp (#6472) 2026-07-02 22:11:20 +01:00
setup.sh [Studio] Add --with-llama-cpp-dir installer flag to reuse a local llama.cpp (#6472) 2026-07-02 22:11:20 +01:00
Unsloth_Studio_Colab.ipynb Studio Colab: opt-in shareable Cloudflare tunnel link (#6684) 2026-06-26 00:56:23 -07:00