Fix _is_ltx_model: LTXAV was never detected
Two bugs:
1. 'LTXV' in 'LTXAV' == False - substring search silently missed LTXAV.
Fixed with explicit set membership: cls_name in {'LTXV', 'LTXAV'}.
2. model_config is on model.model (BaseModel), not on the ModelPatcher
itself - so the unet_config fallback path also never fired.
Fixed by reading inner.model_config instead of model.model_config.
LTX-2.3 (22b) loads as LTXAV. Both LTXV and LTXAV now correctly detected.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
82f338832e
commit
28230a7220
+17
-15
@@ -340,25 +340,27 @@ def _build_block_replacement(block_idx, temp_scale, capture_buf, inject_tensor,
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
def _is_ltx_model(model):
|
||||
"""Return True if model is from the LTX-V / LTXAV family."""
|
||||
"""Return True if model is from the LTX-V / LTXAV family.
|
||||
|
||||
ModelPatcher stores the BaseModel at .model, which in turn stores
|
||||
model_config (from supported_models) at .model_config. The unet_config
|
||||
inside that has image_model = 'ltxv' or 'ltxav'.
|
||||
"""
|
||||
try:
|
||||
# Check the diffusion model class name
|
||||
inner = getattr(model, "model", None) or getattr(model, "inner_model", None)
|
||||
if inner is not None:
|
||||
cls_name = type(inner).__name__
|
||||
if any(x in cls_name for x in ("LTXV", "LTXAVModel", "LTXVModel", "LTXBaseModel")):
|
||||
return True
|
||||
# Check unet_config image_model key set by ComfyUI model detection
|
||||
cfg = getattr(model, "model_config", None)
|
||||
inner = getattr(model, "model", None)
|
||||
if inner is None:
|
||||
return False
|
||||
# Class name check - must include both LTXV and LTXAV explicitly
|
||||
# ('LTXV' in 'LTXAV' is False, so substring search doesn't catch LTXAV)
|
||||
cls_name = type(inner).__name__
|
||||
if cls_name in {"LTXV", "LTXAV"} or "LTXVModel" in cls_name or "LTXBaseModel" in cls_name:
|
||||
return True
|
||||
# unet_config path via model_config stored by BaseModel.__init__
|
||||
cfg = getattr(inner, "model_config", None)
|
||||
if cfg is not None:
|
||||
unet_cfg = getattr(cfg, "unet_config", {}) or {}
|
||||
image_model = str(unet_cfg.get("image_model", "")).lower()
|
||||
if image_model in {"ltxv", "ltxav"}:
|
||||
if str(unet_cfg.get("image_model", "")).lower() in {"ltxv", "ltxav"}:
|
||||
return True
|
||||
# Fallback: check model_type string if present
|
||||
model_type = str(getattr(model, "model_type", "") or "").lower()
|
||||
if "ltx" in model_type:
|
||||
return True
|
||||
except Exception:
|
||||
pass
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user