unsloth/scripts
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 CI: scope GITHUB_TOKEN permissions, add MLX CI, unblock ~60 skipped tests (#5312) 2026-05-11 03:19:13 -07:00
build_prequant_checkpoint.py Load hosted pre-quantized checkpoints on the video quant path 2026-07-18 05:58:40 +00:00
check_frontend_dep_removal.py Reduce and tighten code comments and docstrings repo-wide (#6095) 2026-06-08 23:09:51 -07:00
check_new_install_scripts.py Reduce and tighten code comments and docstrings repo-wide (#6095) 2026-06-08 23:09:51 -07:00
compare_engines.py Studio diffusion (Phase 7): accuracy-preserving speed pass (2.2x via GGUF compile) (#6690) 2026-07-01 15:31:50 -03:00
compile_probe.py Studio diffusion (Phase 7): accuracy-preserving speed pass (2.2x via GGUF compile) (#6690) 2026-07-01 15:31:50 -03:00
diffusion_bench.py Tighten comments in the image stack tests and scripts 2026-07-12 12:21:14 +00:00
diffusion_quality.py Tighten comments in the image stack tests and scripts 2026-07-12 12:21:14 +00:00
enforce_kwargs_spacing.py Reduce and tighten code comments and docstrings repo-wide (#6095) 2026-06-08 23:09:51 -07:00
fbcache_flux_probe.py Tighten comments in the image stack tests and scripts 2026-07-12 12:21:14 +00:00
fp8_layer_ablation.py Tighten fault-path comments added by the video/diffusion hardening pass 2026-07-13 17:33:01 +00:00
fp8_overflow_check.py Tighten comments in the image stack tests and scripts 2026-07-12 12:21:14 +00:00
hunyuan_attn_diag.py Tighten comments across the video speed stack 2026-07-12 10:59:41 +00:00
hunyuan_int8_profile.py fix(review): portable bench scripts, accurate VAE auto docs, explicit TE deny 2026-07-10 06:13:48 +00:00
hunyuan_trim_e2e.py [pre-commit.ci] auto fixes from pre-commit.com hooks 2026-07-09 06:13:22 +00:00
hunyuan_trim_fp32ref.py [pre-commit.ci] auto fixes from pre-commit.com hooks 2026-07-09 06:13:22 +00:00
hunyuan_trim_validate.py [pre-commit.ci] auto fixes from pre-commit.com hooks 2026-07-09 06:13:22 +00:00
image_speedmem_bench.py Reset the step cache before every bench generation to match production 2026-07-11 07:55:01 +00:00
install_gemma4_mlx.sh Update Install Scripts (#5968) 2026-06-03 05:39:42 -07:00
install_qwen3_6_mlx.sh Update Install Scripts (#5968) 2026-06-03 05:39:42 -07:00
install_rocm_wsl_strixhalo.sh ROCm-on-WSL: support discrete Radeon (RDNA 3/4) in WSL, not just Strix Halo (#6915) 2026-07-07 02:29:37 -07:00
int8_linear_probe.py Studio diffusion (Phase 14): fix int8 dense quant on Flux / Qwen (skip M=1 modulation linears) (#6716) 2026-07-01 15:41:49 -03:00
leverage_probe.py Studio diffusion (Phase 7): accuracy-preserving speed pass (2.2x via GGUF compile) (#6690) 2026-07-01 15:31:50 -03:00
lint_workflow_triggers.py Reduce and tighten code comments and docstrings repo-wide (#6095) 2026-06-08 23:09:51 -07:00
lockfile_supply_chain_audit.py Reduce and tighten code comments and docstrings repo-wide (#6095) 2026-06-08 23:09:51 -07:00
notebook_to_python.py Reduce and tighten code comments and docstrings repo-wide (#6095) 2026-06-08 23:09:51 -07:00
notebook_validator.py Reduce and tighten code comments and docstrings repo-wide (#6095) 2026-06-08 23:09:51 -07:00
nvfp4_probe.py Studio diffusion (Phase 8): opt-in fast transformer (torchao int8/fp8/fp4 on a dense source) (#6694) 2026-07-01 15:36:43 -03:00
nvfp4_t211_probe.py Fix diffusion training validation, dataset upload atomicity, and LoRA error mapping 2026-07-04 03:17:12 -03:00
perf_levers_probe.py Tighten comments in the image stack tests and scripts 2026-07-12 12:21:14 +00:00
perf_verify.py Studio diffusion (Phase 7): accuracy-preserving speed pass (2.2x via GGUF compile) (#6690) 2026-07-01 15:31:50 -03:00
prequant_probe.py Studio diffusion (Phase 9): pre-quantized transformer loading (#6700) 2026-07-01 15:37:53 -03:00
quant_accuracy_sweep.py Tighten comments across the video speed stack 2026-07-12 10:59:41 +00:00
quant_probe.py Studio diffusion (Phase 8): opt-in fast transformer (torchao int8/fp8/fp4 on a dense source) (#6694) 2026-07-01 15:36:43 -03:00
quant_speedmem_bench.py Tighten comments across the video speed stack 2026-07-12 10:59:41 +00:00
run_ruff_format.py Reduce and tighten code comments and docstrings repo-wide (#6095) 2026-06-08 23:09:51 -07:00
scan_npm_packages.py scan_packages: key baseline on matched-code hash so payloads in baselined files are not auto-suppressed (#6552) 2026-07-01 04:03:59 -07:00
scan_npm_packages_baseline.json scan_packages: key baseline on matched-code hash so payloads in baselined files are not auto-suppressed (#6552) 2026-07-01 04:03:59 -07:00
scan_packages.py CI: baseline the fastapi/gguf scan findings for the studio dependency set 2026-07-02 02:04:28 +00:00
scan_packages_baseline.json scripts: baseline the gguf 0.19.0 HF download helper for the studio scan shard 2026-07-11 16:50:19 +00:00
sd_cpp_smoke.py Studio diffusion (Phase 6): img2img / inpaint / edit / LoRA / upscale on the native engine (#6680) 2026-07-01 15:18:38 -03:00
sdpa_mask_backend_probe.py Tighten fault-path comments added by the video/diffusion hardening pass 2026-07-13 17:33:01 +00:00
sparse_accum_probe.py Fix diffusion training validation, dataset upload atomicity, and LoRA error mapping 2026-07-04 03:17:12 -03:00
stamp_studio_release.py Reduce and tighten code comments and docstrings repo-wide (#6095) 2026-06-08 23:09:51 -07:00
sync_allow_scripts_pins.py Studio: auto-sync allowScripts pins after dependency bumps (#6136) 2026-06-10 02:35:37 -07:00
uninstall.ps1 Studio: include marker-owned custom sd.cpp roots in the uninstall stop scan; harden Pester install against the nuget.exe PSGallery bootstrap 2026-07-13 07:26:18 +00:00
uninstall.sh Keep an unowned default-mode sd.cpp checkout on uninstall 2026-07-07 10:22:40 +00:00
verify_comment_only_diff.py Reduce and tighten code comments and docstrings repo-wide (#6095) 2026-06-08 23:09:51 -07:00
verify_import_hoist.py studio: tool calling for DeepSeek (R1/V3/V3.1), GLM 4.x, Kimi K2 on safetensors + MLX (#5624) 2026-07-06 15:40:46 -07:00
verify_prequant_backend.py Tighten comments in the image stack tests and scripts 2026-07-12 12:21:14 +00:00
video_quality.py Tighten comments in the image stack tests and scripts 2026-07-12 12:21:14 +00:00
video_speedmem_bench.py Tighten fault-path comments added by the video/diffusion hardening pass 2026-07-13 17:33:01 +00:00