unsloth/studio/backend/core
Daniel Han 4e23ebc902 Load hosted pre-quantized checkpoints on the video quant path
The video loader always materialised the dense DiT(s) inside from_pretrained
and quantised them in place, so an int8/fp8 A14B load paid a ~57 GB dense
download and a dense-bf16 VRAM transient every time. Mirror the image loader's
hosted-prequant shortcut:

- diffusion_prequant grows an expert dimension: prequant_repo_filename /
  prequant_filename / resolve_prequant_source take an expert attribute name, so
  one repo carries a dual-DiT pair per scheme (<Model>-<SCHEME>.pt plus
  <Model>-<SCHEME>-2.pt, legacy transformer_2_<scheme>.pt fallback), and
  load_prequantized_transformer meta-inits from the expert's config subfolder.
  A local path override never carries a pair, so an expert request under an
  override resolves None and the whole load falls back to dense.
- VideoFamily gains prequant_repos (+ variant table for parity with the image
  side); wired: Wan2.2-TI2V-5B and both A14B expert pairs at int8 + fp8, and
  HunyuanVideo-1.5 480p/720p at int8 only per the measured deny list. LTX stays
  unwired (no measured quant recipe).
- The pipeline build tries the shortcut first when the resolved plan is
  resident and every expert's checkpoint resolves; loaded experts ride into
  from_pretrained as component overrides and in-place quantise is skipped.
  All-or-none per pair: a partial load frees and goes dense (mixed-precision
  experts would corrupt the boundary handoff).
- An explicit wired scheme also lets the scoped pre-download skip the DiT
  weight shards (configs kept for the meta-init); if the shortcut then falls
  through, the build resolves from the hub id, gated on the same predicate so
  ordinary pre-downloaded snapshots are untouched.
- build_prequant_checkpoint.py accepts --subfolder and resolves video families.

New tests: expert filename/resolution conventions, family wiring incl. the
LTX/720p split, shortcut engagement, partial-pair dense fallback, unwired
family bypass, and the pre-download skip predicate.
2026-07-18 05:58:40 +00:00
..
data_recipe Studio: harden background consumer loops and streaming paths against silent UI freezes (#6653) 2026-06-26 03:31:33 -07:00
export Studio: multi-select export formats, portable FP8/INT8, GGUF LoRA, and source parity (#6767) 2026-07-03 08:25:10 -07:00
inference Load hosted pre-quantized checkpoints on the video quant path 2026-07-18 05:58:40 +00:00
rag Run the malware gate on the RAG embedding model before it loads (#6887) 2026-07-07 04:30:21 -07:00
training Add FLUX.2 Klein and FLUX.2-dev DiT LoRA training 2026-07-17 09:34:14 +00:00
__init__.py Reduce and tighten code comments and docstrings repo-wide (#6095) 2026-06-08 23:09:51 -07:00
_torchao_stub.py Reduce and tighten code comments and docstrings repo-wide (#6095) 2026-06-08 23:09:51 -07:00
import_guards.py Studio: self-heal unsloth namespace shadows; clearer failed-load messages (#6532) 2026-06-21 22:43:31 -07:00
tool_healing.py Studio: parse Mistral [TOOL_CALLS] and rehearsal tool-call shapes (#5704) 2026-07-06 18:52:13 -07:00