Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

Detection code to make ltxv models without config work. (#7986)

comfyanonymous56b6ee6754f9
diff --git a/comfy/model_detection.py b/comfy/model_detection.py
index ff4c29d7e..28c586389 100644
--- a/comfy/model_detection.py
+++ b/comfy/model_detection.py
@@ -222,6 +222,10 @@ def detect_unet_config(state_dict, key_prefix, metadata=None):
if '{}adaln_single.emb.timestep_embedder.linear_1.bias'.format(key_prefix) in state_dict_keys: #Lightricks ltxv
dit_config = {}
dit_config["image_model"] = "ltxv"
+ dit_config["num_layers"] = count_blocks(state_dict_keys, '{}transformer_blocks.'.format(key_prefix) + '{}.')
+ shape = state_dict['{}transformer_blocks.0.attn2.to_k.weight'.format(key_prefix)].shape
+ dit_config["attention_head_dim"] = shape[0] // 32
+ dit_config["cross_attention_dim"] = shape[1]
if metadata is not None and "config" in metadata:
dit_config.update(json.loads(metadata["config"]).get("transformer", {}))
return dit_config