Commit graph

648 commits

Author SHA1 Message Date
Daniel Han
14f4e7ef7c Keep standalone chat templates in the scoped video download
tokenizer/chat_template.jinja ships as its own file in the LTX-2 and
HunyuanVideo-1.5 repos and apply_chat_template reads it at generation
time, so a scoped snapshot without it loads fine and then crashes the
first generation.
2026-07-05 05:32:24 +00:00
Daniel Han
a274308330 Check the cancel event between predownload files and probe local dirs for LTX-2.3
A warm-cache predownload sweep never consults the cancel event (each cached
file returns instantly), so an unload during it was ignored until a cold
file hit the network. The 2.3 detection also only probed bare-file local
repos; resolve directory repos through the same child resolver the loader
uses so their base pull is scoped too.
2026-07-05 05:25:03 +00:00
Daniel Han
9debe8a43b Merge branch 'diffusion-more-families' into video-inference 2026-07-05 04:56:28 +00:00
Daniel Han
d89ed5c6ff Merge branch 'diffusion-auto-badges' into diffusion-more-families 2026-07-05 04:56:27 +00:00
Daniel Han
01a0930566 Merge branch 'diffusion-auto-install' into diffusion-auto-badges 2026-07-05 04:56:26 +00:00
Daniel Han
c6ea78b087 Merge branch 'diffusion-fp16-accum' into diffusion-auto-install 2026-07-05 04:56:24 +00:00
Daniel Han
c5524b0d7f Merge branch 'diffusion-auto-policy' into diffusion-fp16-accum 2026-07-05 04:56:23 +00:00
Daniel Han
f39e997523 Merge branch 'diffusion-train-perf2' into diffusion-auto-policy 2026-07-05 04:56:22 +00:00
Daniel Han
10d01cbc92 Merge branch 'diffusion-train-tab-2' into diffusion-krea2
# Conflicts:
#	studio/backend/core/inference/diffusion.py
2026-07-05 04:56:19 +00:00
Daniel Han
e3ad2263fb Merge branch 'image-generation' of https://github.com/unslothai/unsloth into image-generation 2026-07-05 04:53:43 +00:00
Daniel Han
c53a6cb65e Address review findings: dataset preflight, sd.cpp unload barrier, caption tombstone, ControlNet cache race
- Run the trainer's caption discovery in the start route BEFORE freeing GPU
  residents, so a missing or uncaptionable dataset 400s without evicting the
  loaded chat/Images model.
- sd.cpp unload now waits out a cancelled one-shot generation on the generate
  lock before reporting the device free, matching the diffusers backend.
- Clearing a caption that came from metadata.jsonl writes an empty sidecar
  tombstone instead of unlinking (both readers treat an existing sidecar as
  authoritative), so the cleared label cannot resurface.
- The ControlNet wrapper pipe is only cached while its load is still current,
  closing the unload race the model cache already handled.
2026-07-05 04:53:37 +00:00
Daniel Han
1a414081ca Merge branch 'diffusion-more-families' into video-inference 2026-07-05 04:43:49 +00:00
Daniel Han
04405160f7 Merge branch 'diffusion-auto-badges' into diffusion-more-families 2026-07-05 04:43:48 +00:00
Daniel Han
d65de48071 Merge branch 'diffusion-auto-install' into diffusion-auto-badges 2026-07-05 04:43:47 +00:00
Daniel Han
dd8398ff71 Merge branch 'diffusion-fp16-accum' into diffusion-auto-install 2026-07-05 04:43:45 +00:00
Daniel Han
230de8ea5c Merge branch 'diffusion-auto-policy' into diffusion-fp16-accum 2026-07-05 04:43:44 +00:00
Daniel Han
c9ce57f969 Merge branch 'diffusion-train-perf2' into diffusion-auto-policy 2026-07-05 04:43:43 +00:00
Daniel Han
176a544e1c Merge branch 'diffusion-train-tab-2' into diffusion-krea2
# Conflicts:
#	studio/backend/core/inference/diffusion.py
2026-07-05 04:43:41 +00:00
pre-commit-ci[bot]
919661ddf0 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2026-07-05 04:42:18 +00:00
Daniel Han
62cae5fe71 Load image pipelines from the prefetched snapshot instead of re-sweeping the hub
The prefetch already scopes the file list (no packaged root singles, no
dtype-variant twins, no ONNX/Flax exports), but from_pretrained was then
called with the hub id, and its own snapshot sweep re-downloaded the
skipped files anyway: 24 GB per FLUX.1 repo and 65 GB on FLUX.2-dev, as
found in the blob cache. Return the snapshot dir from the prefetch (keyed
on the pipeline manifest) and hand it to every pipeline-assembly
from_pretrained site; any prefetch failure keeps the hub id and the old
behavior.
2026-07-05 04:41:43 +00:00
pre-commit-ci[bot]
69f48d2ffc [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2026-07-05 04:39:09 +00:00
Daniel Han
e2fd90783e Shrink the LTX-2.3 base pull to the components the assembly reads
A 2.3 checkpoint (GGUF or single file) carries the DiT and, with its extras
files, the connectors, both VAEs and the vocoder; only the 2.0 base repo's
scheduler, text encoder and tokenizer are read. Detect 2.3 from the
checkpoint header after the pull, re-estimate, and scope the base
pre-download accordingly (about 6 GB less per fresh install).
2026-07-05 04:38:28 +00:00
pre-commit-ci[bot]
f7fdb4e9e6 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2026-07-05 03:18:31 +00:00
Daniel Han
d442e00407 Scope the video base repo download to the files the pipeline loads
A bare from_pretrained snapshot of Lightricks/LTX-2 pulls the whole 314 GB
repo: 170 GB of packaged root checkpoints and a second 50 GB text-encoder
shard set, when the pipeline reads about 93 GB. Build the needed file list
once (shared with the progress estimate so the two cannot disagree),
download it per file with cancellation, and hand from_pretrained the local
snapshot dir. Clamp the progress counter to the estimate so stale cache
blobs can no longer report over 100 percent.
2026-07-05 03:17:55 +00:00
Daniel Han
add623d186 Merge branch 'diffusion-more-families' into video-inference 2026-07-05 02:19:37 +00:00
Daniel Han
5cccb44ca2 Merge branch 'diffusion-auto-badges' into diffusion-more-families
# Conflicts:
#	studio/backend/core/inference/diffusion_families.py
2026-07-05 02:17:52 +00:00
Daniel Han
4cb52c0399 Merge branch 'diffusion-auto-install' into diffusion-auto-badges 2026-07-05 02:17:27 +00:00
Daniel Han
32e68b4fd0 Merge branch 'diffusion-fp16-accum' into diffusion-auto-install
# Conflicts:
#	studio/backend/core/inference/diffusion.py
2026-07-05 02:17:17 +00:00
Daniel Han
0f9f184676 Merge branch 'diffusion-auto-policy' into diffusion-fp16-accum 2026-07-05 02:16:20 +00:00
Daniel Han
53af22cf1e Merge branch 'diffusion-auto-policy' of https://github.com/unslothai/unsloth into diffusion-auto-policy 2026-07-05 02:14:36 +00:00
Daniel Han
68735819cd Keep transformer_quant tri-state through pre-eviction validation 2026-07-05 02:14:31 +00:00
pre-commit-ci[bot]
78abe26387 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2026-07-05 02:13:58 +00:00
Daniel Han
e049560a4a Merge branch 'diffusion-train-perf2' into diffusion-auto-policy
# Conflicts:
#	studio/backend/core/inference/diffusion.py
2026-07-05 02:12:30 +00:00
pre-commit-ci[bot]
20a3650108 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2026-07-05 02:12:27 +00:00
Daniel Han
dc36983562 Merge branch 'diffusion-train-tab-2' into diffusion-krea2 2026-07-05 02:11:25 +00:00
pre-commit-ci[bot]
f6f198fd5f [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2026-07-05 02:07:49 +00:00
Daniel Han
098809d2fe Reject sd-cli batch runs and clear stale output targets before a run 2026-07-05 01:49:19 +00:00
Daniel Han
76eee534ea Gate explicit attention kernels on NVIDIA CUDA and roll back partial FBCache hooks 2026-07-05 01:48:12 +00:00
Daniel Han
f1d9c88606 Validate load modes before eviction and wait out a cancelled denoise on unload 2026-07-05 01:47:02 +00:00
Daniel Han
6a8b0b47e7 Fix review findings on image generation: failed-load VRAM, API defaults, preflights
- Free reserved VRAM in the diffusion load worker's failure path: a load-time OOM
  never commits _state and the next load's _unload_locked early-returns, so nothing
  else reclaimed the half-built pipeline's memory
- Use a monotonic clock for the denoise ETA rate
- Sync _GENERATION_DEFAULTS with the UI table: kontext, flux.2-dev, sdxl-turbo and
  SDXL base rows so /v1/images/generations stops falling back to 9 steps / CFG 0
- 400 (not sanitized 500) when /v1/images/generations hits an edit-only model
- Fail fast on pre-Ampere CUDA in the DiT trainer instead of dying in model load
- Run the trainer trust gate in the diffusion training route before freeing GPU
  residents so an untrusted base cannot tear down loaded chat/Images models
- Protect native sd.cpp companion VAE/text-encoder repos from cache deletion while
  a load is downloading them
- Exempt the task-scoped Images picker from the chat-only GGUF/MLX format gate so
  local diffusers pipelines stay selectable on no-GPU hosts
2026-07-05 01:00:47 +00:00
pre-commit-ci[bot]
fbcf1ade58 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2026-07-05 00:36:34 +00:00
Daniel Han
4d97574c4f Merge branch 'diffusion-more-families' into video-inference 2026-07-05 00:31:51 +00:00
Daniel Han
45fce770cc Merge branch 'diffusion-auto-badges' into diffusion-more-families 2026-07-05 00:31:50 +00:00
Daniel Han
b374b612a1 Merge branch 'diffusion-auto-install' into diffusion-auto-badges 2026-07-05 00:31:48 +00:00
Daniel Han
39ba65d163 Merge branch 'diffusion-fp16-accum' into diffusion-auto-install 2026-07-05 00:31:47 +00:00
Daniel Han
baf6a3c832 Fix video load planning, lifecycle, and trust gaps from review
Review round on the video backend:
- the resident memory check now budgets transformer plus companions like the
  image backend, instead of letting auto pick a resident placement that OOMs
  while the LTX text encoder and VAEs load
- a new load waits for the signalled in flight generation to exit before
  tearing down the old pipeline, so two models never share VRAM during a swap
- the load worker rechecks its token right before placement, narrowing the
  window where a cancelled load could put weights on a GPU the arbiter
  already handed to another backend
- the step cache installs before the speed profile and compile now keys
  fullgraph off an active cache, matching the image order; compiling
  fullgraph first crashed the first cached generation
- teardown uninstalls the process wide compiled GGUF dequantizer so a later
  speed off load gets the bit identical path
- explicit base_repo goes through the same trust gate as non GGUF repo ids,
  and local checkpoint paths are verified during validation, before the
  route evicts a resident model
- status reports only the speed optimisations that actually engaged
- the gallery file route streams via FileResponse with range support instead
  of buffering whole clips
- the build step reuses the checkpoint path resolved during planning
2026-07-05 00:24:16 +00:00
Daniel Han
85395e3b94 Harden ideogram fp8 dequant and scope the HunyuanImage exclusion
Review follow ups on the more-families branch: the per channel scale now
broadcasts rank aware instead of assuming 2D (all shipped tensors are 2D,
verified across all three fp8 components, but a future non 2D quantized
tensor would have mis broadcast silently), the fused qkv split asserts the
expected 3x hidden row count so a GQA style export fails loudly, fp8
detection scans every shard header rather than the first, and the excluded
model match uses the segment aware token helper with a hunyuanimage-3
token so a future HunyuanImage 2.x is not blocked with a 3.0 reason.
2026-07-05 00:16:14 +00:00
Daniel Han
ba3d1f607b Install attention backend outside the load locks and surface pip errors
The wheel-only pip install for an optional attention kernel ran inside
load_pipeline under _lock and _generate_lock, so a slow or hanging install
blocked unload and cancellation for up to the 600s timeout. Resolve and install
the kernel before taking the locks (only an explicit backend ever pulls a
package, and its resolution ignores the speed tier); the in-lock apply call is
then a fast no-op. Also decode and log pip's stderr on a failed install so the
fallback to native is diagnosable instead of showing only the exit code.
2026-07-05 00:10:54 +00:00
Daniel Han
fec66a5392 Pass normalized speed mode to fp16 accumulation gate
The raw speed_mode string was forwarded to _enable_fp16_accumulation, so a
case-variant like MAX failed the speed_mode != SPEED_MAX check and wrongly
disabled fp16 accumulation on float16 pipelines. Forward the normalized mode
and cover the case-insensitive path in the test.
2026-07-05 00:06:38 +00:00
Daniel Han
3c91c60687 Reset FBCache state on the video DiTs before each generation
The video backend never cleared FBCache residuals between clips, so with the
step cache engaged a second generation at a different resolution would hit
stale state from the first. Mirrors the image backend fix from #6872: call
the transformer level _reset_stateful_cache (reset_stateful_hooks only exists
on the HookRegistry in diffusers 0.39), covering transformer_2 for the Wan
dual expert, only when a cache is engaged.
2026-07-04 23:39:38 +00:00