Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

feat(z-image): add Z-Image Base (undistilled) model variant support (#8799)

Alexander Eichhornb0f7b555b77c
diff --git a/invokeai/app/invocations/z_image_denoise.py b/invokeai/app/invocations/z_image_denoise.py
index 44fa82dbeb..6ab43d6657 100644
--- a/invokeai/app/invocations/z_image_denoise.py
+++ b/invokeai/app/invocations/z_image_denoise.py
@@ -107,8 +107,8 @@ class ZImageDenoiseInvocation(BaseInvocation):
# Scheduler selection for the denoising process
scheduler: ZIMAGE_SCHEDULER_NAME_VALUES = InputField(
default="euler",
- description="Scheduler (sampler) for the denoising process. Euler is the default and recommended for "
- "Z-Image-Turbo. Heun is 2nd-order (better quality, 2x slower). LCM is optimized for few steps.",
+ description="Scheduler (sampler) for the denoising process. Euler is the default and recommended. "
+ "Heun is 2nd-order (better quality, 2x slower). LCM works with Turbo only (not Base).",
ui_choice_labels=ZIMAGE_SCHEDULER_LABELS,
)
@@ -387,12 +387,11 @@ class ZImageDenoiseInvocation(BaseInvocation):
num_train_timesteps=1000,
shift=1.0,
)
- # Set timesteps - LCM should use num_inference_steps (it has its own sigma schedule),
+ # Set timesteps - LCM uses its own sigma schedule (num_inference_steps),
# while other schedulers can use custom sigmas if supported
is_lcm = self.scheduler == "lcm"
set_timesteps_sig = inspect.signature(scheduler.set_timesteps)
if not is_lcm and "sigmas" in set_timesteps_sig.parameters:
- # Convert sigmas list to tensor for scheduler
scheduler.set_timesteps(sigmas=sigmas, device=device)
else:
# LCM or scheduler doesn't support custom sigmas - use num_inference_steps
@@ -644,10 +643,8 @@ class ZImageDenoiseInvocation(BaseInvocation):
),
)
else:
- # For LCM and other first-order schedulers
+ # For first-order schedulers (Euler, LCM)
user_step += 1
- # Only call step_callback if we haven't exceeded total_steps
- # (LCM scheduler may have more internal steps than user-facing steps)
if user_step <= total_steps:
pbar.update(1)
step_callback(
diff --git a/invokeai/app/invocations/z_image_lora_loader.py b/invokeai/app/invocations/z_image_lora_loader.py
index b72227fd8b..54c353a6ab 100644
--- a/invokeai/app/invocations/z_image_lora_loader.py
+++ b/invokeai/app/invocations/z_image_lora_loader.py
@@ -66,6 +66,18 @@ class ZImageLoRALoaderInvocation(BaseInvocation):
if self.qwen3_encoder and any(lora.lora.key == lora_key for lora in self.qwen3_encoder.loras):
raise ValueError(f'LoRA "{lora_key}" already applied to Qwen3 encoder.')
+ # Warn on variant mismatch between LoRA and transformer.
+ lora_config = context.models.get_config(lora_key)
+ lora_variant = getattr(lora_config, "variant", None)
+ if lora_variant and self.transformer is not None:
+ transformer_config = context.models.get_config(self.transformer.transformer.key)
+ transformer_variant = getattr(transformer_config, "variant", None)
+ if transformer_variant and lora_variant != transformer_variant:
+ context.logger.warning(
+ f"LoRA variant mismatch: LoRA '{lora_config.name}' is for {lora_variant.value} "
+ f"but transformer is {transformer_variant.value}. This may cause unexpected results."
+ )
+
output = ZImageLoRALoaderOutput()
# Attach LoRA layers to the models.
@@ -142,6 +154,18 @@ class ZImageLoRACollectionLoader(BaseInvocation):
"not Z-Image models. Ensure you are using a Z-Image compatible LoRA."
)
+ # Warn on variant mismatch between LoRA and transformer.
+ lora_config = context.models.get_config(lora.lora.key)
+ lora_variant = getattr(lora_config, "variant", None)
+ if lora_variant and self.transformer is not None:
+ transformer_config = context.models.get_config(self.transformer.transformer.key)
+ transformer_variant = getattr(transformer_config, "variant", None)
+ if transformer_variant and lora_variant != transformer_variant:
+ context.logger.warning(
+ f"LoRA variant mismatch: LoRA '{lora_config.name}' is for {lora_variant.value} "
+ f"but transformer is {transformer_variant.value}. This may cause unexpected results."
+ )
+
added_loras.append(lora.lora.key)
if self.transformer is not None and output.transformer is not None:
diff --git a/invokeai/app/services/model_records/model_records_base.py b/invokeai/app/services/model_records/model_records_base.py
index 45f9d75e3c..96e12d3b0a 100644
--- a/invokeai/app/services/model_records/model_records_base.py
+++ b/invokeai/app/services/model_records/model_records_base.py
@@ -27,6 +27,7 @@ from invokeai.backend.model_manager.taxonomy import (
ModelVariantType,
Qwen3VariantType,
SchedulerPredictionType,
+ ZImageVariantType,
)
@@ -92,9 +93,9 @@ class ModelRecordChanges(BaseModelExcludeNull):
# Checkpoint-specific changes
# TODO(MM2): Should we expose these? Feels footgun-y...
- variant: Optional[ModelVariantType | ClipVariantType | FluxVariantType | Flux2VariantType | Qwen3VariantType] = (
- Field(description="The variant of the model.", default=None)
- )
+ variant: Optional[
+ ModelVariantType | ClipVariantType | FluxVariantType | Flux2VariantType | ZImageVariantType | Qwen3VariantType
+ ] = Field(description="The variant of the model.", default=None)
prediction_type: Optional[SchedulerPredictionType] = Field(
description="The prediction type of the model.", default=None
)
diff --git a/invokeai/app/services/shared/sqlite/sqlite_util.py b/invokeai/app/services/shared/sqlite/sqlite_util.py
index f6cb70b9df..6621170a97 100644
--- a/invokeai/app/services/shared/sqlite/sqlite_util.py
+++ b/invokeai/app/services/shared/sqlite/sqlite_util.py
@@ -28,6 +28,7 @@ from invokeai.app.services.shared.sqlite_migrator.migrations.migration_22 import
from invokeai.app.services.shared.sqlite_migrator.migrations.migration_23 import build_migration_23
from invokeai.app.services.shared.sqlite_migrator.migrations.migration_24 import build_migration_24
from invokeai.app.services.shared.sqlite_migrator.migrations.migration_25 import build_migration_25
+from invokeai.app.services.shared.sqlite_migrator.migrations.migration_26 import build_migration_26
from invokeai.app.services.shared.sqlite_migrator.sqlite_migrator_impl import SqliteMigrator
@@ -73,6 +74,7 @@ def init_db(config: InvokeAIAppConfig, logger: Logger, image_files: ImageFileSto
migrator.register_migration(build_migration_23(app_config=config, logger=logger))
migrator.register_migration(build_migration_24(app_config=config, logger=logger))
migrator.register_migration(build_migration_25(app_config=config, logger=logger))
+ migrator.register_migration(build_migration_26(app_config=config, logger=logger))
migrator.run_migrations()
return db
diff --git a/invokeai/app/services/shared/sqlite_migrator/migrations/migration_26.py b/invokeai/app/services/shared/sqlite_migrator/migrations/migration_26.py
new file mode 100644
index 0000000000..d392d28413
--- /dev/null
+++ b/invokeai/app/services/shared/sqlite_migrator/migrations/migration_26.py
@@ -0,0 +1,115 @@
+import json
+import sqlite3
+from logging import Logger
+from pathlib import Path
+from typing import Any
+
+from invokeai.app.services.config import InvokeAIAppConfig
+from invokeai.app.services.shared.sqlite_migrator.sqlite_migrator_common import Migration
+from invokeai.backend.model_manager.taxonomy import BaseModelType, ModelFormat, ModelType, ZImageVariantType
+
+
+class Migration26Callback:
+ def __init__(self, app_config: InvokeAIAppConfig, logger: Logger) -> None:
+ self._app_config = app_config
+ self._logger = logger
+
+ def _detect_variant_from_scheduler(self, model_path: Path) -> ZImageVariantType:
+ """Detect Z-Image variant from scheduler config for Diffusers models.
+
+ Z-Image variants are distinguished by the scheduler shift value:
+ - Turbo (distilled): shift = 3.0
+ - Base (undistilled): shift = 6.0
+ """
+ scheduler_config_path = model_path / "scheduler" / "scheduler_config.json"
+
+ if not scheduler_config_path.exists():
+ return ZImageVariantType.Turbo
+
+ try:
+ with open(scheduler_config_path, "r", encoding="utf-8") as f:
+ scheduler_config = json.load(f)
+
+ shift = scheduler_config.get("shift", 3.0)
+
+ # ZBase (undistilled) uses shift = 6.0, Turbo uses shift = 3.0
+ if shift >= 5.0:
+ return ZImageVariantType.ZBase
+ else:
+ return ZImageVariantType.Turbo
+ except (json.JSONDecodeError, OSError) as e:
+ self._logger.warning(f"Could not read scheduler config: {e}, defaulting to Turbo")
+ return ZImageVariantType.Turbo
+
+ def __call__(self, cursor: sqlite3.Cursor) -> None:
+ cursor.execute("SELECT id, config FROM models;")
+ rows = cursor.fetchall()
+
+ migrated_turbo = 0
+ migrated_base = 0
+
+ for model_id, config_json in rows:
+ try:
+ config_dict: dict[str, Any] = json.loads(config_json)
+
+ # Only migrate Z-Image main models
+ if config_dict.get("base") != BaseModelType.ZImage.value:
+ continue
+
+ if config_dict.get("type") != ModelType.Main.value:
+ continue
+
+ # Skip if variant already set
+ if "variant" in config_dict:
+ continue
+
+ # Determine variant based on format
+ model_format = config_dict.get("format")
+ model_path = config_dict.get("path")
+
+ if model_format == ModelFormat.Diffusers.value and model_path:
+ # For Diffusers models, detect from scheduler config
+ variant = self._detect_variant_from_scheduler(Path(model_path))
+ else:
+ # For Checkpoint/GGUF, default to Turbo (Base only available as Diffusers)
+ variant = ZImageVariantType.Turbo
+
+ config_dict["variant"] = variant.value
+
+ cursor.execute(
+ "UPDATE models SET config = ? WHERE id = ?;",
+ (json.dumps(config_dict), model_id),
+ )
+
+ if variant == ZImageVariantType.ZBase:
+ migrated_base += 1
+ else:
+ migrated_turbo += 1
+
+ except json.JSONDecodeError as e:
+ self._logger.error("Invalid config JSON for model %s: %s", model_id, e)
+ raise
+
+ total = migrated_turbo + migrated_base
+ if total > 0:
+ self._logger.info(
+ f"Migration complete: {total} Z-Image model configs updated "
+ f"({migrated_turbo} Turbo, {migrated_base} Base)"
+ )
+ else:
+ self._logger.info("Migration complete: no Z-Image model configs needed migration")
+
+
+def build_migration_26(app_config: InvokeAIAppConfig, logger: Logger) -> Migration:
+ """Builds the migration object for migrating from version 25 to version 26.
+
+ This migration adds the variant field to existing Z-Image main models.
+ Models installed before the variant field was added will default to Turbo
+ (the only variant available before Z-Image Base support was added).
+ """
+
+ return Migration(
+ from_version=25,
+ to_version=26,
+ callback=Migration26Callback(app_config=app_config, logger=logger),
+ )
diff --git a/invokeai/backend/flux/schedulers.py b/invokeai/backend/flux/schedulers.py
index 0593d72747..e5a8a7137c 100644
--- a/invokeai/backend/flux/schedulers.py
+++ b/invokeai/backend/flux/schedulers.py
@@ -40,9 +40,9 @@ if _HAS_LCM:
FLUX_SCHEDULER_MAP["lcm"] = FlowMatchLCMScheduler
-# Z-Image scheduler types (same schedulers as Flux, both use Flow Matching)
-# Note: Z-Image-Turbo is optimized for ~8 steps with Euler, but other schedulers
-# can be used for experimentation.
+# Z-Image scheduler types (Flow Matching schedulers)
+# Note: Z-Image-Turbo is optimized for ~8 steps with Euler, LCM can also work.
+# Z-Image Base (undistilled) should only use Euler or Heun (LCM not supported for undistilled models).
ZIMAGE_SCHEDULER_NAME_VALUES = Literal["euler", "heun", "lcm"]
# Human-readable labels for the UI
@@ -52,7 +52,7 @@ ZIMAGE_SCHEDULER_LABELS: dict[str, str] = {
"lcm": "LCM",
}
-# Mapping from scheduler names to scheduler classes (same as Flux)
+# Mapping from scheduler names to scheduler classes
ZIMAGE_SCHEDULER_MAP: dict[str, Type[SchedulerMixin]] = {
"euler": FlowMatchEulerDiscreteScheduler,
"heun": FlowMatchHeunDiscreteScheduler,
diff --git a/invokeai/backend/model_manager/configs/base.py b/invokeai/backend/model_manager/configs/base.py
index b3ade8be8c..8c12e7594b 100644
--- a/invokeai/backend/model_manager/configs/base.py
+++ b/invokeai/backend/model_manager/configs/base.py
@@ -128,7 +128,7 @@ class Config_Base(ABC, BaseModel):
# defaults. variant does not require a default, but if it has one, we need to add it to the tag. We can
# check for the presence of a default by seeing if it's not PydanticUndefined, a sentinel value used by
# pydantic to indicate that no default was provided.
- if field.default is not PydanticUndefined:
+ if field.default is not PydanticUndefined and field.default is not None:
# We expect each of these fields has an Enum for its default; we want the value of the enum.
tag_strings.append(field.default.value)
return Tag(".".join(tag_strings))
diff --git a/invokeai/backend/model_manager/configs/lora.py b/invokeai/backend/model_manager/configs/lora.py
index ce273fe5ba..6d7040b9c1 100644
--- a/invokeai/backend/model_manager/configs/lora.py
+++ b/invokeai/backend/model_manager/configs/lora.py
@@ -27,6 +27,7 @@ from invokeai.backend.model_manager.taxonomy import (
FluxLoRAFormat,
ModelFormat,
ModelType,
+ ZImageVariantType,
)
from invokeai.backend.model_manager.util.model_util import lora_token_vector_length
from invokeai.backend.patches.lora_conversions.flux_control_lora_utils import is_state_dict_likely_flux_control
@@ -226,6 +227,7 @@ class LoRA_LyCORIS_ZImage_Config(LoRA_LyCORIS_Config_Base, Config_Base):
"""Model config for Z-Image LoRA models in LyCORIS format."""
base: Literal[BaseModelType.ZImage] = Field(default=BaseModelType.ZImage)
+ variant: ZImageVariantType | None = Field(default=None)
@classmethod
def _validate_looks_like_lora(cls, mod: ModelOnDisk) -> None:
@@ -398,3 +400,4 @@ class LoRA_Diffusers_ZImage_Config(LoRA_Diffusers_Config_Base, Config_Base):
"""Model config for Z-Image LoRA models in Diffusers format."""
base: Literal[BaseModelType.ZImage] = Field(default=BaseModelType.ZImage)
+ variant: ZImageVariantType | None = Field(default=None)
diff --git a/invokeai/backend/model_manager/configs/main.py b/invokeai/backend/model_manager/configs/main.py
index 7f435b4482..6f737ceb92 100644
--- a/invokeai/backend/model_manager/configs/main.py
+++ b/invokeai/backend/model_manager/configs/main.py
@@ -30,6 +30,7 @@ from invokeai.backend.model_manager.taxonomy import (
ModelVariantType,
SchedulerPredictionType,
SubModelType,
+ ZImageVariantType,
)
from invokeai.backend.quantization.gguf.ggml_tensor import GGMLTensor
from invokeai.backend.stable_diffusion.schedulers.schedulers import SCHEDULER_NAME_VALUES
@@ -57,7 +58,7 @@ class MainModelDefaultSettings(BaseModel):
def from_base(
cls,
base: BaseModelType,
- variant: Flux2VariantType | FluxVariantType | ModelVariantType | None = None,
+ variant: Flux2VariantType | FluxVariantType | ModelVariantType | ZImageVariantType | None = None,
) -> Self | None:
match base:
case BaseModelType.StableDiffusion1:
@@ -67,7 +68,14 @@ class MainModelDefaultSettings(BaseModel):
case BaseModelType.StableDiffusionXL:
return cls(width=1024, height=1024)
case BaseModelType.ZImage:
- return cls(steps=9, cfg_scale=1.0, width=1024, height=1024)
+ # Different defaults based on variant
+ if variant == ZImageVariantType.ZBase:
+ # Undistilled base model needs more steps and supports CFG
+ # Recommended: steps=28-50, cfg_scale=3.0-5.0
+ return cls(steps=50, cfg_scale=4.0, width=1024, height=1024)
+ else:
+ # Turbo (distilled) uses fewer steps, no CFG
+ return cls(steps=9, cfg_scale=1.0, width=1024, height=1024)
case BaseModelType.Flux2:
# Different defaults based on variant
if variant == Flux2VariantType.Klein9BBase:
@@ -1077,9 +1085,10 @@ class Main_Diffusers_CogView4_Config(Diffusers_Config_Base, Main_Config_Base, Co
class Main_Diffusers_ZImage_Config(Diffusers_Config_Base, Main_Config_Base, Config_Base):
- """Model config for Z-Image diffusers models (Z-Image-Turbo, Z-Image-Base, Z-Image-Edit)."""
+ """Model config for Z-Image diffusers models (Z-Image-Turbo, Z-Image-Base)."""
base: Literal[BaseModelType.ZImage] = Field(BaseModelType.ZImage)
+ variant: ZImageVariantType = Field()
@classmethod
def from_model_on_disk(cls, mod: ModelOnDisk, override_fields: dict[str, Any]) -> Self:
@@ -1095,19 +1104,41 @@ class Main_Diffusers_ZImage_Config(Diffusers_Config_Base, Main_Config_Base, Conf
},
)
+ variant = override_fields.get("variant") or cls._get_variant_or_raise(mod)
+
repo_variant = override_fields.get("repo_variant") or cls._get_repo_variant_or_raise(mod)
return cls(
**override_fields,
+ variant=variant,
repo_variant=repo_variant,
)
+ @classmethod
+ def _get_variant_or_raise(cls, mod: ModelOnDisk) -> ZImageVariantType:
+ """Determine Z-Image variant from the scheduler config.
+
+ Z-Image variants are distinguished by the scheduler shift value:
+ - Turbo (distilled): shift = 3.0
+ - Base (undistilled): shift = 6.0
+ """
+ scheduler_config = get_config_dict_or_raise(mod.path / "scheduler" / "scheduler_config.json")
+
+ shift = scheduler_config.get("shift", 3.0)
+
+ # ZBase (undistilled) uses shift = 6.0, Turbo uses shift = 3.0
+ if shift >= 5.0:
+ return ZImageVariantType.ZBase
+ else:
+ return ZImageVariantType.Turbo
+
class Main_Checkpoint_ZImage_Config(Checkpoint_Config_Base, Main_Config_Base, Config_Base):
"""Model config for Z-Image single-file checkpoint models (safetensors, etc)."""
base: Literal[BaseModelType.ZImage] = Field(default=BaseModelType.ZImage)
format: Literal[ModelFormat.Checkpoint] = Field(default=ModelFormat.Checkpoint)
+ variant: ZImageVariantType = Field()
@classmethod
def from_model_on_disk(cls, mod: ModelOnDisk, override_fields: dict[str, Any]) -> Self:
@@ -1119,7 +1150,9 @@ class Main_Checkpoint_ZImage_Config(Checkpoint_Config_Base, Main_Config_Base, Co
cls._validate_does_not_look_like_gguf_quantized(mod)
- return cls(**override_fields)
+ variant = override_fields.get("variant", ZImageVariantType.Turbo)
+
+ return cls(**override_fields, variant=variant)
@classmethod
def _validate_looks_like_z_image_model(cls, mod: ModelOnDisk) -> None:
@@ -1139,6 +1172,7 @@ class Main_GGUF_ZImage_Config(Checkpoint_Config_Base, Main_Config_Base, Config_B
base: Literal[BaseModelType.ZImage] = Field(default=BaseModelType.ZImage)
format: Literal[ModelFormat.GGUFQuantized] = Field(default=ModelFormat.GGUFQuantized)
+ variant: ZImageVariantType = Field()
@classmethod
def from_model_on_disk(cls, mod: ModelOnDisk, override_fields: dict[str, Any]) -> Self:
@@ -1150,7 +1184,9 @@ class Main_GGUF_ZImage_Config(Checkpoint_Config_Base, Main_Config_Base, Config_B
cls._validate_looks_like_gguf_quantized(mod)
- return cls(**override_fields)
+ variant = override_fields.get("variant", ZImageVariantType.Turbo)
+
+ return cls(**override_fields, variant=variant)
@classmethod
def _validate_looks_like_z_image_model(cls, mod: ModelOnDisk) -> None:
diff --git a/invokeai/backend/model_manager/taxonomy.py b/invokeai/backend/model_manager/taxonomy.py
index aa0660152a..eec3ac14a4 100644
--- a/invokeai/backend/model_manager/taxonomy.py
+++ b/invokeai/backend/model_manager/taxonomy.py
@@ -133,6 +133,16 @@ class Flux2VariantType(str, Enum):
"""Flux2 Klein 9B Base variant - undistilled foundation model using Qwen3 8B text encoder."""
+class ZImageVariantType(str, Enum):
+ """Z-Image model variants."""
+
+ Turbo = "turbo"
+ """Z-Image Turbo - distilled model optimized for 8 steps, no CFG support."""
+
+ ZBase = "zbase"
+ """Z-Image Base - undistilled foundation model with full CFG and negative prompt support."""
+
+
class Qwen3VariantType(str, Enum):
"""Qwen3 text encoder variants based on model size."""
@@ -201,7 +211,9 @@ class FluxLoRAFormat(str, Enum):
XLabs = "flux.xlabs"
-AnyVariant: TypeAlias = Union[ModelVariantType, ClipVariantType, FluxVariantType, Flux2VariantType, Qwen3VariantType]
+AnyVariant: TypeAlias = Union[
+ ModelVariantType, ClipVariantType, FluxVariantType, Flux2VariantType, ZImageVariantType, Qwen3VariantType
+]
variant_type_adapter = TypeAdapter[
- ModelVariantType | ClipVariantType | FluxVariantType | Flux2VariantType | Qwen3VariantType
-](ModelVariantType | ClipVariantType | FluxVariantType | Flux2VariantType | Qwen3VariantType)
+ ModelVariantType | ClipVariantType | FluxVariantType | Flux2VariantType | ZImageVariantType | Qwen3VariantType
+](ModelVariantType | ClipVariantType | FluxVariantType | Flux2VariantType | ZImageVariantType | Qwen3VariantType)
diff --git a/invokeai/frontend/web/public/locales/en.json b/invokeai/frontend/web/public/locales/en.json
index 8c5b72e57a..024c35f91d 100644
--- a/invokeai/frontend/web/public/locales/en.json
+++ b/invokeai/frontend/web/public/locales/en.json
@@ -1521,6 +1521,8 @@
"baseModelChangedCleared_other": "Updated, cleared or disabled {{count}} incompatible submodels",
"kleinEncoderCleared": "Qwen3 Encoder Cleared",
"kleinEncoderClearedDescription": "Please select a compatible Qwen3 encoder for the new Klein model variant",
+ "schedulerReset": "Scheduler Reset",
+ "schedulerResetZImageBase": "LCM scheduler is not compatible with Z-Image Base models. Reset to Euler.",
"canceled": "Processing Canceled",
"connected": "Connected to Server",
"imageCopied": "Image Copied",
diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/modelSelected.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/modelSelected.ts
index 5eb2fe6207..20057472ca 100644
--- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/modelSelected.ts
+++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/modelSelected.ts
@@ -7,6 +7,7 @@ import {
kleinQwen3EncoderModelSelected,
kleinVaeModelSelected,
modelChanged,
+ setZImageScheduler,
syncedToOptimalDimension,
vaeSelected,
zImageQwen3EncoderModelSelected,
@@ -320,6 +321,24 @@ export const addModelSelectedListener = (startAppListening: AppStartListening) =
}
}
+ // Handle Z-Image scheduler when switching to Z-Image Base (zbase) model
+ // LCM is not supported for undistilled models, so reset to euler
+ if (newBase === 'z-image' && state.params.zImageScheduler === 'lcm') {
+ const modelConfigsResult = selectModelConfigsQuery(state);
+ if (modelConfigsResult.data) {
+ const newModelConfig = modelConfigsAdapterSelectors.selectById(modelConfigsResult.data, newModel.key);
+ if (newModelConfig && 'variant' in newModelConfig && newModelConfig.variant === 'zbase') {
+ dispatch(setZImageScheduler('euler'));
+ toast({
+ id: 'ZIMAGE_SCHEDULER_RESET',
+ title: t('toast.schedulerReset'),
+ description: t('toast.schedulerResetZImageBase'),
+ status: 'info',
+ });
+ }
+ }
+ }
+
dispatch(modelChanged({ model: newModel, previousModel: state.params.model }));
const modelBase = selectBboxModelBase(state);
diff --git a/invokeai/frontend/web/src/features/lora/components/LoRASelect.tsx b/invokeai/frontend/web/src/features/lora/components/LoRASelect.tsx
index 748aa9ca65..bb010b07c4 100644
--- a/invokeai/frontend/web/src/features/lora/components/LoRASelect.tsx
+++ b/invokeai/frontend/web/src/features/lora/components/LoRASelect.tsx
@@ -5,7 +5,7 @@ import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
import { InformationalPopover } from 'common/components/InformationalPopover/InformationalPopover';
import type { GroupStatusMap } from 'common/components/Picker/Picker';
import { loraAdded, selectLoRAsSlice } from 'features/controlLayers/store/lorasSlice';
-import { selectBase } from 'features/controlLayers/store/paramsSlice';
+import { selectBase, selectMainModelConfig } from 'features/controlLayers/store/paramsSlice';
import { ModelPicker } from 'features/parameters/components/ModelPicker';
import { memo, useCallback, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
@@ -23,14 +23,31 @@ const LoRASelect = () => {
const addedLoRAModelKeys = useAppSelector(selectLoRAModelKeys);
const currentBaseModel = useAppSelector(selectBase);
+ const currentMainModelConfig = useAppSelector(selectMainModelConfig);
- // Filter to only show compatible LoRAs
+ // Filter to only show compatible LoRAs (by base model and variant)
const compatibleLoRAs = useMemo(() => {
if (!currentBaseModel) {
return EMPTY_ARRAY;
}
- return modelConfigs.filter((model) => model.base === currentBaseModel);
- }, [modelConfigs, currentBaseModel]);
+ return modelConfigs.filter((model) => {
+ if (model.base !== currentBaseModel) {
+ return false;
+ }
+ // For models with variant support: filter by variant when both main model and LoRA have variant info.
+ // LoRAs with no variant (null) are always shown (compatible with all variants).
+ if (
+ currentMainModelConfig &&
+ 'variant' in currentMainModelConfig &&
+ currentMainModelConfig.variant &&
+ 'variant' in model &&
+ model.variant
+ ) {
+ return model.variant === currentMainModelConfig.variant;
+ }
+ return true;
+ });
+ }, [modelConfigs, currentBaseModel, currentMainModelConfig]);
const getIsDisabled = useCallback(
(model: LoRAModelConfig): boolean => {
diff --git a/invokeai/frontend/web/src/features/metadata/parsing.tsx b/invokeai/frontend/web/src/features/metadata/parsing.tsx
index d04e0fc15c..c17f18ec93 100644
--- a/invokeai/frontend/web/src/features/metadata/parsing.tsx
+++ b/invokeai/frontend/web/src/features/metadata/parsing.tsx
@@ -467,7 +467,7 @@ const Scheduler: SingleMetadataHandler<ParameterScheduler> = {
store.dispatch(setFluxScheduler(value));
}
} else if (base === 'z-image') {
- // Z-Image only supports euler, heun, lcm
+ // Z-Image supports euler, heun, lcm (but LCM only works well with Turbo, not Base)
if (value === 'euler' || value === 'heun' || value === 'lcm') {
store.dispatch(setZImageScheduler(value));
}
diff --git a/invokeai/frontend/web/src/features/modelManagerV2/models.ts b/invokeai/frontend/web/src/features/modelManagerV2/models.ts
index c4dd56f811..7b5a08adfe 100644
--- a/invokeai/frontend/web/src/features/modelManagerV2/models.ts
+++ b/invokeai/frontend/web/src/features/modelManagerV2/models.ts
@@ -214,6 +214,8 @@ export const MODEL_VARIANT_TO_LONG_NAME: Record<AnyModelVariant, string> = {
klein_4b: 'FLUX.2 Klein 4B',
klein_9b: 'FLUX.2 Klein 9B',
klein_9b_base: 'FLUX.2 Klein 9B Base',
+ turbo: 'Z-Image Turbo',
+ zbase: 'Z-Image Base',
large: 'CLIP L',
gigantic: 'CLIP G',
qwen3_4b: 'Qwen3 4B',
diff --git a/invokeai/frontend/web/src/features/nodes/types/common.test-d.ts b/invokeai/frontend/web/src/features/nodes/types/common.test-d.ts
index 25ba48c293..04e0fea2cc 100644
--- a/invokeai/frontend/web/src/features/nodes/types/common.test-d.ts
+++ b/invokeai/frontend/web/src/features/nodes/types/common.test-d.ts
@@ -18,6 +18,7 @@ import type {
zModelVariantType,
zQwen3VariantType,
zSubModelType,
+ zZImageVariantType,
} from 'features/nodes/types/common';
import type { Invocation, S } from 'services/api/types';
import type { Equals, Extends } from 'tsafe';
@@ -50,6 +51,7 @@ describe('Common types', () => {
test('ModelVariantType', () => assert<Equals<z.infer<typeof zModelVariantType>, S['ModelVariantType']>>());
test('FluxVariantType', () => assert<Equals<z.infer<typeof zFluxVariantType>, S['FluxVariantType']>>());
test('Flux2VariantType', () => assert<Equals<z.infer<typeof zFlux2VariantType>, S['Flux2VariantType']>>());
+ test('ZImageVariantType', () => assert<Equals<z.infer<typeof zZImageVariantType>, S['ZImageVariantType']>>());
test('Qwen3VariantType', () => assert<Equals<z.infer<typeof zQwen3VariantType>, S['Qwen3VariantType']>>());
test('ModelFormat', () => assert<Equals<z.infer<typeof zModelFormat>, S['ModelFormat']>>());
diff --git a/invokeai/frontend/web/src/features/nodes/types/common.ts b/invokeai/frontend/web/src/features/nodes/types/common.ts
index 2cfe637bee..36805c022d 100644
--- a/invokeai/frontend/web/src/features/nodes/types/common.ts
+++ b/invokeai/frontend/web/src/features/nodes/types/common.ts
@@ -68,7 +68,8 @@ export type SchedulerField = z.infer<typeof zSchedulerField>;
// Flux-specific scheduler options (Flow Matching schedulers)
export const zFluxSchedulerField = z.enum(['euler', 'heun', 'lcm']);
-// Z-Image scheduler options (Flow Matching schedulers, same as Flux)
+// Z-Image scheduler options (Flow Matching schedulers)
+// Note: LCM is only supported for Z-Image Turbo, not for Z-Image Base (undistilled)
export const zZImageSchedulerField = z.enum(['euler', 'heun', 'lcm']);
// Flux DyPE (Dynamic Position Extrapolation) preset options for high-resolution generation
@@ -140,12 +141,14 @@ export const zClipVariantType = z.enum(['large', 'gigantic']);
export const zModelVariantType = z.enum(['normal', 'inpaint', 'depth']);
export const zFluxVariantType = z.enum(['dev', 'dev_fill', 'schnell']);
export const zFlux2VariantType = z.enum(['klein_4b', 'klein_9b', 'klein_9b_base']);
+export const zZImageVariantType = z.enum(['turbo', 'zbase']);
export const zQwen3VariantType = z.enum(['qwen3_4b', 'qwen3_8b']);
export const zAnyModelVariant = z.union([
zModelVariantType,
zClipVariantType,
zFluxVariantType,
zFlux2VariantType,
+ zZImageVariantType,
zQwen3VariantType,
]);
export type AnyModelVariant = z.infer<typeof zAnyModelVariant>;
diff --git a/invokeai/frontend/web/src/features/parameters/components/Core/ParamZImageScheduler.tsx b/invokeai/frontend/web/src/features/parameters/components/Core/ParamZImageScheduler.tsx
index 4353811a73..7953b14e61 100644
--- a/invokeai/frontend/web/src/features/parameters/components/Core/ParamZImageScheduler.tsx
+++ b/invokeai/frontend/web/src/features/parameters/components/Core/ParamZImageScheduler.tsx
@@ -2,22 +2,39 @@ import type { ComboboxOnChange, ComboboxOption } from '@invoke-ai/ui-library';
import { Combobox, FormControl, FormLabel } from '@invoke-ai/ui-library';
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
import { InformationalPopover } from 'common/components/InformationalPopover/InformationalPopover';
-import { selectZImageScheduler, setZImageScheduler } from 'features/controlLayers/store/paramsSlice';
+import {
+ selectMainModelConfig,
+ selectZImageScheduler,
+ setZImageScheduler,
+} from 'features/controlLayers/store/paramsSlice';
import { isParameterZImageScheduler } from 'features/parameters/types/parameterSchemas';
import { memo, useCallback, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
-// Z-Image scheduler options (Flow Matching schedulers, same as Flux)
-const ZIMAGE_SCHEDULER_OPTIONS: ComboboxOption[] = [
+// All Z-Image scheduler options
+const ZIMAGE_SCHEDULER_OPTIONS_ALL: ComboboxOption[] = [
{ value: 'euler', label: 'Euler' },
{ value: 'heun', label: 'Heun (2nd order)' },
{ value: 'lcm', label: 'LCM' },
];
+// Z-Image Base (zbase) scheduler options - LCM not supported for undistilled models
+const ZIMAGE_SCHEDULER_OPTIONS_BASE: ComboboxOption[] = [
+ { value: 'euler', label: 'Euler' },
+ { value: 'heun', label: 'Heun (2nd order)' },
+];
+
const ParamZImageScheduler = () => {
const dispatch = useAppDispatch();
const { t } = useTranslation();
const zImageScheduler = useAppSelector(selectZImageScheduler);
+ const modelConfig = useAppSelector(selectMainModelConfig);
+
+ // Determine if the selected model is Z-Image Base (zbase variant)
+ // LCM is not supported for undistilled models
+ // Need to check base first to narrow the type, since only z-image models have this variant
+ const isZImageBase = modelConfig?.base === 'z-image' && modelConfig.variant === 'zbase';
+ const options = isZImageBase ? ZIMAGE_SCHEDULER_OPTIONS_BASE : ZIMAGE_SCHEDULER_OPTIONS_ALL;
const onChange = useCallback<ComboboxOnChange>(
(v) => {
@@ -29,14 +46,14 @@ const ParamZImageScheduler = () => {
[dispatch]
);
- const value = useMemo(() => ZIMAGE_SCHEDULER_OPTIONS.find((o) => o.value === zImageScheduler), [zImageScheduler]);
+ const value = useMemo(() => options.find((o) => o.value === zImageScheduler), [options, zImageScheduler]);
return (
<FormControl>
<InformationalPopover feature="paramScheduler">
<FormLabel>{t('parameters.scheduler')}</FormLabel>
</InformationalPopover>
- <Combobox value={value} options={ZIMAGE_SCHEDULER_OPTIONS} onChange={onChange} />
+ <Combobox value={value} options={options} onChange={onChange} />
</FormControl>
);
};
diff --git a/invokeai/frontend/web/src/services/api/schema.ts b/invokeai/frontend/web/src/services/api/schema.ts
index c6e096f474..8bbf79c4d0 100644
--- a/invokeai/frontend/web/src/services/api/schema.ts
+++ b/invokeai/frontend/web/src/services/api/schema.ts
@@ -15793,6 +15793,7 @@ export type components = {
* @constant
*/
base: "z-image";
+ variant: components["schemas"]["ZImageVariantType"] | null;
};
/** LoRA_LyCORIS_FLUX_Config */
LoRA_LyCORIS_FLUX_Config: {
@@ -16171,6 +16172,7 @@ export type components = {
* @constant
*/
base: "z-image";
+ variant: components["schemas"]["ZImageVariantType"] | null;
};
/** LoRA_OMI_FLUX_Config */
LoRA_OMI_FLUX_Config: {
@@ -17200,6 +17202,7 @@ export type components = {
* @constant
*/
format: "checkpoint";
+ variant: components["schemas"]["ZImageVariantType"];
};
/** Main_Diffusers_CogView4_Config */
Main_Diffusers_CogView4_Config: {
@@ -17842,7 +17845,7 @@ export type components = {
};
/**
* Main_Diffusers_ZImage_Config
- * @description Model config for Z-Image diffusers models (Z-Image-Turbo, Z-Image-Base, Z-Image-Edit).
+ * @description Model config for Z-Image diffusers models (Z-Image-Turbo, Z-Image-Base).
*/
Main_Diffusers_ZImage_Config: {
/**
@@ -17919,6 +17922,7 @@ export type components = {
* @constant
*/
base: "z-image";
+ variant: components["schemas"]["ZImageVariantType"];
};
/**
* Main_GGUF_FLUX_Config
@@ -18170,6 +18174,7 @@ export type components = {
* @constant
*/
format: "gguf_quantized";
+ variant: components["schemas"]["ZImageVariantType"];
};
/**
* Combine Masks
@@ -20381,7 +20386,7 @@ export type components = {
* Variant
* @description The variant of the model.
*/
- variant?: components["schemas"]["ModelVariantType"] | components["schemas"]["ClipVariantType"] | components["schemas"]["FluxVariantType"] | components["schemas"]["Flux2VariantType"] | components["schemas"]["Qwen3VariantType"] | null;
+ variant?: components["schemas"]["ModelVariantType"] | components["schemas"]["ClipVariantType"] | components["schemas"]["FluxVariantType"] | components["schemas"]["Flux2VariantType"] | components["schemas"]["ZImageVariantType"] | components["schemas"]["Qwen3VariantType"] | null;
/** @description The prediction type of the model. */
prediction_type?: components["schemas"]["SchedulerPredictionType"] | null;
/**
@@ -24422,7 +24427,7 @@ export type components = {
path_or_prefix: string;
model_type: components["schemas"]["ModelType"];
/** Variant */
- variant?: components["schemas"]["ModelVariantType"] | components["schemas"]["ClipVariantType"] | components["schemas"]["FluxVariantType"] | components["schemas"]["Flux2VariantType"] | components["schemas"]["Qwen3VariantType"] | null;
+ variant?: components["schemas"]["ModelVariantType"] | components["schemas"]["ClipVariantType"] | components["schemas"]["FluxVariantType"] | components["schemas"]["Flux2VariantType"] | components["schemas"]["ZImageVariantType"] | components["schemas"]["Qwen3VariantType"] | null;
};
/**
* Subtract Integers
@@ -27056,7 +27061,7 @@ export type components = {
vae?: components["schemas"]["VAEField"] | null;
/**
* Scheduler
- * @description Scheduler (sampler) for the denoising process. Euler is the default and recommended for Z-Image-Turbo. Heun is 2nd-order (better quality, 2x slower). LCM is optimized for few steps.
+ * @description Scheduler (sampler) for the denoising process. Euler is the default and recommended. Heun is 2nd-order (better quality, 2x slower). LCM works with Turbo only (not Base).
* @default euler
* @enum {string}
*/
@@ -27183,7 +27188,7 @@ export type components = {
vae?: components["schemas"]["VAEField"] | null;
/**
* Scheduler
- * @description Scheduler (sampler) for the denoising process. Euler is the default and recommended for Z-Image-Turbo. Heun is 2nd-order (better quality, 2x slower). LCM is optimized for few steps.
+ * @description Scheduler (sampler) for the denoising process. Euler is the default and recommended. Heun is 2nd-order (better quality, 2x slower). LCM works with Turbo only (not Base).
* @default euler
* @enum {string}
*/
@@ -27610,6 +27615,12 @@ export type components = {
*/
type: "z_image_text_encoder";
};
+ /**
+ * ZImageVariantType
+ * @description Z-Image model variants.
+ * @enum {string}
+ */
+ ZImageVariantType: "turbo" | "zbase";
};
responses: never;
parameters: never;