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: budget HunyuanImage-2.1's automatic int8 text encoder at its hosted file (#14833)

Daniel Hanee55c3c9a80a
diff --git a/studio/backend/core/inference/diffusion_te_prequant.py b/studio/backend/core/inference/diffusion_te_prequant.py
index d48d5050227..80792a0be25 100644
--- a/studio/backend/core/inference/diffusion_te_prequant.py
+++ b/studio/backend/core/inference/diffusion_te_prequant.py
@@ -291,7 +291,9 @@ TE_INT8_CONVROT_BUDGET_SCALE = 0.56
# FLUX.3's Qwen3-VL-4B file is 5,247,076,320 bytes against 8,875,719,344 dense (0.591), rounded up the same way.
# Wan's UMT5 keeps its 256k-row embedding dense: its int8 file is 6,735,404,944 bytes against 11,361,851,208 dense,
# 0.593, rounded up the same way.
+# HunyuanImage-2.1 loads Qwen-Image's 8,974,915,168-byte file against a 15.5 GB table price (0.579), rounded up.
_TE_INT8_CONVROT_BUDGET_SCALES = {
+ "hunyuanimage-2.1": 0.60,
"lumina-2": 0.62,
"krea-2": 0.60,
"flux.3-klein": 0.60,
diff --git a/studio/backend/tests/test_diffusion_te_auto_int8_budget.py b/studio/backend/tests/test_diffusion_te_auto_int8_budget.py
index 9c7610a576e..7060aa27214 100644
--- a/studio/backend/tests/test_diffusion_te_auto_int8_budget.py
+++ b/studio/backend/tests/test_diffusion_te_auto_int8_budget.py
@@ -119,3 +119,35 @@ def test_the_uncached_precast_price_of_an_auto_int8_pick_is_the_int8_file(cuda_e
fam, fam.base_repo, cuda_env, "int8"
)
assert explicit == int(encoders * 1000**3 * tpq.TE_PREQUANT_BUDGET_SCALE) // (1024 * 1024)
+
+
+# Hosted int8 ConvRot file bytes of every automatic int8 pick, from the Hub listing of the family's FP8 repo.
+_AUTO_INT8_FILE_BYTES = {
+ "qwen-image": 8_974_915_168,
+ "qwen-image-edit": 8_974_915_168,
+ "hunyuanimage-2.1": 8_974_915_168,
+ "krea-2": 5_247_054_376,
+ "flux.2-dev": 24_464_184_096,
+ "flux.3-klein": 5_247_076_320,
+ "flux.3-klein-base": 5_247_076_320,
+ "qwen-image-2.1": 9_349_769_248,
+}
+
+
+def test_every_auto_int8_family_is_listed():
+ auto = {f.name for f in _FAMILIES if getattr(f, "te_quant_auto", None) == "int8"}
+ assert auto <= set(_AUTO_INT8_FILE_BYTES)
+
+
[email protected]("name", sorted(_AUTO_INT8_FILE_BYTES))
+def test_the_auto_int8_budget_covers_the_file_and_dense_siblings(name, cuda_env):
+ # table bf16 term * scale must cover the int8 file plus dense siblings, or an oversized load slips through.
+ from core.inference.diffusion_auto_policy import family_bf16_components_gb
+
+ fam = _fam(name)
+ scale = tpq.te_prequant_budget_scale(
+ fam, te_quant_mode = _auto_mode(fam), target = cuda_env, base = fam.base_repo
+ )
+ table_gb = family_bf16_components_gb(fam, fam.base_repo)[1]
+ sibling_gb = tpq._TE_DENSE_SIBLING_GB.get(name, 0.0)
+ assert table_gb * 1e9 * scale >= _AUTO_INT8_FILE_BYTES[name] + sibling_gb * 1e9