unsloth/studio/backend
Daniel Han b90f833469 Studio diffusion (Phase 9): pre-quantized transformer loading
The Phase 8 fast transformer_quant path materialises the dense bf16 transformer on
the GPU and torchao-quantises it in place, so its load peak is ~2x GGUF's (~21 vs
13.4 GB) plus a ~12 GB download. Add a pre-quantized branch: quantise once offline
(scripts/build_prequant_checkpoint.py) and at runtime build the transformer skeleton
on the meta device (accelerate.init_empty_weights) and load_state_dict(assign=True)
the quantized weights, so the dense bf16 never touches the GPU.

Measured (B200, Z-Image fp8): full-pipeline GPU load peak 21.2 -> 14.6 GB (matching
GGUF's 13.4), on-disk 12 -> 6.28 GB, output bit-identical (LPIPS 0.0). It is the same
torchao config + min_features filter the runtime path uses, applied ahead of time.

New core/inference/diffusion_prequant.py (resolve_prequant_source +
load_prequantized_transformer, best-effort, lazy imports). diffusion.py
_load_dense_quant_pipeline tries the pre-quant source first and falls back to the
dense materialise+quantise path, then to GGUF, so the default is unchanged.
DiffusionLoadRequest gains transformer_prequant_path; DiffusionFamily gains an empty
prequant_repos map for hosted checkpoints (hosting deferred). Hermetic CPU tests for
the resolver, the meta-init+assign loader, and the backend branch selection +
fallbacks; GPU verification via scripts/verify_prequant_backend.py.
2026-06-26 11:23:20 +00:00
..
assets Studio: shareable per-checkpoint preview links (#6486) 2026-06-24 06:31:53 -07:00
auth CLI: stop unsloth connect from leaking Studio credentials to unverified servers (#6479) 2026-06-21 21:28:38 -07:00
core Studio diffusion (Phase 9): pre-quantized transformer loading 2026-06-26 11:23:20 +00:00
hub Studio: add an Open button to reveal the models folder in the file manager (#6452) 2026-06-19 05:14:58 -07:00
loggers Studio: trim serving-log noise and surface llama-server engine stats (#6377) 2026-06-17 05:37:57 -07:00
models Studio diffusion (Phase 9): pre-quantized transformer loading 2026-06-26 11:23:20 +00:00
plugins Reduce and tighten code comments and docstrings repo-wide (#6095) 2026-06-08 23:09:51 -07:00
requirements Merge branch 'main' into image-generation 2026-06-24 14:07:59 -03:00
routes Studio diffusion (Phase 9): pre-quantized transformer loading 2026-06-26 11:23:20 +00:00
state Studio: shareable per-checkpoint preview links (#6486) 2026-06-24 06:31:53 -07:00
storage feat: implement thread forking functionality with associated database… (#5810) 2026-06-15 14:57:39 +01:00
tests Studio diffusion (Phase 9): pre-quantized transformer loading 2026-06-26 11:23:20 +00:00
utils Studio: shareable per-checkpoint preview links (#6486) 2026-06-24 06:31:53 -07:00
__init__.py Final cleanup 2026-03-12 18:28:04 +00:00
_platform_compat.py Reduce and tighten code comments and docstrings repo-wide (#6095) 2026-06-08 23:09:51 -07:00
cloudflare_tunnel.py Reap Studio child processes when the parent dies abnormally (#6425) 2026-06-18 05:51:22 -07:00
colab.py Reduce and tighten code comments and docstrings repo-wide (#6095) 2026-06-08 23:09:51 -07:00
main.py Studio: shareable per-checkpoint preview links (#6486) 2026-06-24 06:31:53 -07:00
run.py Studio: shareable per-checkpoint preview links (#6486) 2026-06-24 06:31:53 -07:00
startup_banner.py Tidy verbose Studio launch messages (#6628) 2026-06-24 03:49:19 -07:00