Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Studio: a streamed Qwen-Image load from the hosted int8 checkpoint gets the int8 text stream and modulations (#16275)

Daniel Han6a2fa092f499
diff --git a/studio/backend/core/inference/diffusion.py b/studio/backend/core/inference/diffusion.py
index cd289d15160..60db96a3a28 100644
--- a/studio/backend/core/inference/diffusion.py
+++ b/studio/backend/core/inference/diffusion.py
@@ -9130,24 +9130,29 @@ class DiffusionBackend:
denoiser_prequant_pipe_kwargs,
)
- seeded = denoiser_prequant_pipe_kwargs(
- fam,
- fetch_base,
- scheme = pipeline_seed_scheme,
- dtype = dtype,
- device = device,
- # offloading plans seed it on the host: a GPU seed OOMed 8 GB cards
- placement_device = prequant_seed_device(
- plan, device, pipeline_seed_scheme
- ),
- hf_token = hf_token,
- target = target,
- path_override = transformer_prequant_path,
- fast_accum = transformer_quant_fast_accum,
- local_files_only = local_files_only,
- cache_dir = hub_cache_dir(),
- logger = logger,
+ # streamed plans int8 the seed's bf16 text stream / modulations, like an in-place build
+ _seed_scope = int8_text_stream_scope(
+ not plan_keeps_transformer_resident(plan)
)
+ with _seed_scope:
+ seeded = denoiser_prequant_pipe_kwargs(
+ fam,
+ fetch_base,
+ scheme = pipeline_seed_scheme,
+ dtype = dtype,
+ device = device,
+ # offloading plans seed it on the host: a GPU seed OOMed 8 GB cards
+ placement_device = prequant_seed_device(
+ plan, device, pipeline_seed_scheme
+ ),
+ hf_token = hf_token,
+ target = target,
+ path_override = transformer_prequant_path,
+ fast_accum = transformer_quant_fast_accum,
+ local_files_only = local_files_only,
+ cache_dir = hub_cache_dir(),
+ logger = logger,
+ )
pipe_kwargs.update(seeded)
if seeded:
transformer_quant_engaged = pipeline_seed_scheme
diff --git a/studio/backend/tests/test_diffusion_qwenimage_text_int8.py b/studio/backend/tests/test_diffusion_qwenimage_text_int8.py
index b87cccc1a6a..9850a8cdd4c 100644
--- a/studio/backend/tests/test_diffusion_qwenimage_text_int8.py
+++ b/studio/backend/tests/test_diffusion_qwenimage_text_int8.py
@@ -19,6 +19,7 @@ _UNSCOPED = {
"test_streamed_scope_resets_on_error",
"test_streamed_scope_does_not_leak_into_other_threads",
"test_load_wraps_lookup_build_and_write_in_the_placement_scope",
+ "test_hosted_seed_load_runs_in_the_placement_scope",
}
@@ -89,6 +90,19 @@ def test_load_wraps_lookup_build_and_write_in_the_placement_scope():
assert "with int8_text_stream_scope(not keeps_resident):" in src[max(0, i - 400) : i], call
+def test_hosted_seed_load_runs_in_the_placement_scope():
+ import inspect
+
+ from core.inference import diffusion
+
+ src = inspect.getsource(diffusion.DiffusionBackend)
+ i = src.index("seeded = denoiser_prequant_pipe_kwargs(")
+ window = src[max(0, i - 600) : i]
+ assert "_seed_scope = int8_text_stream_scope(" in window
+ assert "not plan_keeps_transformer_resident(plan)" in window
+ assert "with _seed_scope:" in window
+
+
def test_runtime_exclusions_drop_the_text_stream():
tokens = exclude_tokens_for_scheme(TQ_INT8, "qwen-image")
for token in _TEXT_STREAM: