Commit graph

6,778 commits

Author SHA1 Message Date
Daniel Han
4f00222c2e Reserve the fp8 bf16 footprint even when the cache estimate is absent
For a narrow (fp8) Ideogram-4 base the planner reserves the family's known bf16
component total, but the reservation was gated on model_dense_mib being non-None.
On a first-time load an empty blob cache (or a best-effort download probe that
swallowed a transient HF error) leaves model_dense_mib None, so the guard skipped
the reservation exactly when it was needed: the planner then read 'size unknown ->
stay resident' and the ~54 GB pipeline OOMed a card that offload would have fit.
family_bf16_components_gb is a network-free constant, so reserve it whenever the
cache signal is absent (use it directly when None, else take the max).
2026-07-06 11:48:23 +00:00
pre-commit-ci[bot]
6e14e03735 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2026-07-06 10:21:44 +00:00
Daniel Han
bb2b14db97 ideogram-4: build the FP8 text encoder at target dtype, size it as bf16-resident, optimize both DiTs
- The FP8 Qwen3-VL text encoder was constructed at the process fp32 default before the
  dequantized bf16 weights are copied in. That ~8B-param fp32 scaffold peaks ~2x on host RAM
  (loading FIRST, before the DiTs), so a 64 GB host can OOM. Build it at the target dtype under
  set_default_dtype, mirroring the DiT loader; rotary inv_freq is still computed in explicit fp32.

- The auto-policy memory table listed the text encoder at 8.8 GB, its FP8 on-disk size, while the
  DiTs were doubled to their bf16-resident sizes. The loader dequantizes the encoder to bf16 too
  (~16.3 GB), so the entry understated the resident footprint by ~7.5 GB and could let the planner
  pick a resident placement that OOMs. Size it as bf16-resident.

- Speed (regional compile, QKV fuse) and the attention backend only touched pipe.transformer, so
  ideogram-4's second denoiser (unconditional_transformer, run every step for dual-branch CFG)
  stayed eager/native while status reported the optimization as engaged. Iterate every denoiser DiT
  (mirroring the offload path) so both experts are optimized. Guarded on attr presence, so single-DiT
  families are unchanged.
2026-07-06 10:21:10 +00:00
Daniel Han
70af9fa75a ideogram4: build fp8 DiT at target dtype to halve host-RAM transient
The fp8 loader builds Ideogram4Transformer2DModel via from_config, which
materializes the full ~9B-parameter module at the process default dtype (fp32)
before the dequantized bf16 weights are copied in and cast at the end. That
fp32 scaffold is ~2x the bf16 model (~37 GB vs ~18 GB) on host RAM, and the
second (unconditional) DiT builds while the first DiT and the text encoder are
already resident, so it can OOM smaller hosts. Wrap from_config in
set_default_dtype(dtype) so the module is built at the target dtype directly.
rotary_emb.inv_freq (the only __init__ state absent from the checkpoint) is
computed in explicit fp32, so a bf16 default leaves it correct.
2026-07-06 08:38:03 +00:00
Daniel Han
f307131819 Studio: reject transformer-only loads for Ideogram 4 and size local fp8 mirrors
Ideogram 4 assembles two DiTs per-component (a conditional transformer plus a
separate unconditional_transformer), so there is no transformer-only single-file
or GGUF artifact that could supply both. Add a pipeline_only family flag and
reject the gguf/single_file kinds in validate_load_request, before a load evicts
the current model, instead of assembling a pipeline missing its second DiT.

Extend the fp8 bf16-resident size override to a LOCAL directory mirror of the
ideogram-4-fp8 base: such a path never string-matches base_repo, so detect the
fp8 layout from the transformer shard headers (a *.weight_scale marker) and
reserve the bf16 footprint, matching the remote-base behaviour. A local nf4
mirror has no fp8 scales and correctly stays planned against its compressed bytes.
2026-07-05 12:08:45 +00:00
Daniel Han
e741935626 Merge remote-tracking branch 'origin/diffusion-auto-badges' into diffusion-more-families 2026-07-05 11:52:45 +00:00
Daniel Han
cc23062077 Merge remote-tracking branch 'origin/diffusion-auto-install' into diffusion-auto-badges 2026-07-05 11:52:43 +00:00
Daniel Han
4373ebc13b Merge remote-tracking branch 'origin/diffusion-fp16-accum' into diffusion-auto-install 2026-07-05 11:52:34 +00:00
Daniel Han
6154ecb618 Merge remote-tracking branch 'origin/diffusion-auto-policy' into diffusion-fp16-accum 2026-07-05 11:52:33 +00:00
Daniel Han
23ade68c51 Merge remote-tracking branch 'origin/diffusion-train-perf2' into diffusion-auto-policy 2026-07-05 11:52:32 +00:00
Daniel Han
d6ce610324 Merge remote-tracking branch 'origin/diffusion-krea2' into diffusion-train-perf2 2026-07-05 11:52:30 +00:00
Daniel Han
099357cf40 Merge remote-tracking branch 'origin/diffusion-train-tab-2' into diffusion-krea2 2026-07-05 11:52:29 +00:00
Daniel Han
303d38cf98 Merge remote-tracking branch 'origin/diffusion-train-precision' into diffusion-train-tab-2 2026-07-05 11:52:28 +00:00
Daniel Han
78a6ad3fff Merge remote-tracking branch 'origin/diffusion-train-perf' into diffusion-train-precision 2026-07-05 11:52:27 +00:00
Daniel Han
59bf54e975 Merge remote-tracking branch 'origin/image-generation' into diffusion-train-perf 2026-07-05 11:52:25 +00:00
Daniel Han
e2e10c4ee9 Merge branch 'diffusion-auto-install' of https://github.com/unslothai/unsloth into diffusion-auto-install 2026-07-05 11:48:48 +00:00
Daniel Han
9d3a1d3ff7 Invalidate import caches after a wheel install so the new kernel is importable
A successful on-demand wheel install writes into site-packages after the
import system already cached that directory's listing, so the very next
find_spec / import in the same process can miss the freshly installed
package when the install lands within the directory mtime's resolution.
That silently falls set_attention_backend back to native on first use.
Call importlib.invalidate_caches() after a successful install so the
kernel is picked up immediately, and cover both the success and failure
paths in the attention installer tests.
2026-07-05 11:48:34 +00:00
pre-commit-ci[bot]
31f04c026e [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2026-07-05 11:46:48 +00:00
pre-commit-ci[bot]
995ce8ac5f [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2026-07-05 11:46:16 +00:00
pre-commit-ci[bot]
d398978349 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2026-07-05 11:45:40 +00:00
pre-commit-ci[bot]
1d4cf1d6aa [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2026-07-05 11:45:05 +00:00
pre-commit-ci[bot]
a45b4b2ec3 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2026-07-05 11:44:30 +00:00
pre-commit-ci[bot]
83bc33d04a [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2026-07-05 11:43:58 +00:00
pre-commit-ci[bot]
293b770c78 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2026-07-05 11:43:23 +00:00
pre-commit-ci[bot]
9caab52bfd [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2026-07-05 11:42:50 +00:00
pre-commit-ci[bot]
1a72a06b1d [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2026-07-05 11:42:17 +00:00
pre-commit-ci[bot]
d6703962d3 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2026-07-05 11:41:43 +00:00
pre-commit-ci[bot]
e800675128 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2026-07-05 11:40:35 +00:00
Daniel Han
2e3bd9b393 Merge branch 'diffusion-auto-badges' into diffusion-more-families 2026-07-05 11:39:35 +00:00
Daniel Han
af76745353 Merge branch 'diffusion-auto-install' into diffusion-auto-badges 2026-07-05 11:39:34 +00:00
Daniel Han
3c4dd8d118 Merge branch 'diffusion-fp16-accum' into diffusion-auto-install 2026-07-05 11:39:32 +00:00
Daniel Han
ac90e6cdab Merge branch 'diffusion-auto-policy' into diffusion-fp16-accum 2026-07-05 11:39:31 +00:00
Daniel Han
a20049bfc0 Merge branch 'diffusion-train-perf2' into diffusion-auto-policy 2026-07-05 11:39:30 +00:00
Daniel Han
66387c1533 Merge branch 'diffusion-krea2' into diffusion-train-perf2 2026-07-05 11:39:16 +00:00
Daniel Han
f543af6d27 Merge branch 'diffusion-train-tab-2' into diffusion-krea2 2026-07-05 11:39:15 +00:00
Daniel Han
5979d68a03 Merge branch 'diffusion-train-precision' into diffusion-train-tab-2 2026-07-05 11:39:14 +00:00
Daniel Han
2d466df322 Merge branch 'diffusion-train-perf' into diffusion-train-precision 2026-07-05 11:39:12 +00:00
Daniel Han
b88d0d49b8 Merge branch 'image-generation' into diffusion-train-perf 2026-07-05 11:39:11 +00:00
Daniel Han
fc1e099124 Harden ControlNet loads, thumbnail cache keys, API training guard, and picker roving keys
Review follow-ups on the image-generation PR:

- ControlNet: resolve_controlnet accepts a bare owner/name repo without the
  non-GGUF base trust gate, and _controlnet_pipe hands it straight to
  from_pretrained. A malicious pickle .bin would deserialize on load, so run
  the same Hugging Face malware preflight (evaluate_file_security) the chat and
  export loaders use before any remote ControlNet load; local dirs are exempt.
- Dataset thumbnails: key the cache on the full filename instead of the stem so
  sample.png and sample.jpg no longer collide on one .thumbs file (which could
  serve or delete the wrong image); the delete cleanup globs the same key.
- Diffusion training start: mirror start_training's API-key guard so an API
  client cannot start training (which frees VRAM by unloading chat) while an
  inference request is streaming; it now returns 409 before any GPU is freed.
- Model picker: include the curated safetensors row keys in the recommended
  roving key list so arrow-key navigation reaches those rows instead of hitting
  the duplicate option-missing id.

Tests: ControlNet malware gate (remote blocked before from_pretrained, local
skipped), thumbnail same-stem cache separation, API-key diffusion-start 409
before GPU free. Full diffusion suites green.
2026-07-05 11:36:58 +00:00
Daniel Han
7f8c8ef78b Merge branch 'diffusion-auto-badges' into diffusion-more-families 2026-07-05 08:55:46 +00:00
Daniel Han
6f7a2d0b57 Merge branch 'diffusion-auto-install' into diffusion-auto-badges 2026-07-05 08:55:45 +00:00
Daniel Han
23e794ea77 Merge branch 'diffusion-fp16-accum' into diffusion-auto-install 2026-07-05 08:55:43 +00:00
Daniel Han
b74660fdb6 Merge branch 'diffusion-auto-policy' into diffusion-fp16-accum 2026-07-05 08:55:42 +00:00
Daniel Han
7883a16f30 Merge branch 'diffusion-train-perf2' into diffusion-auto-policy 2026-07-05 08:55:41 +00:00
Daniel Han
d329e5db37 Merge branch 'diffusion-krea2' into diffusion-train-perf2 2026-07-05 08:55:40 +00:00
Daniel Han
369a792b04 Merge branch 'diffusion-train-tab-2' into diffusion-krea2 2026-07-05 08:55:39 +00:00
Daniel Han
1f8315c698 Merge branch 'diffusion-train-precision' into diffusion-train-tab-2 2026-07-05 08:55:38 +00:00
Daniel Han
dd6be63d1a Merge branch 'diffusion-train-perf' into diffusion-train-precision 2026-07-05 08:55:37 +00:00
pre-commit-ci[bot]
c23c0d6047 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2026-07-05 08:02:46 +00:00
pre-commit-ci[bot]
95b0356d6f [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2026-07-05 08:01:42 +00:00