Skip to content

Commit 56b6ee6

Browse files
Detection code to make ltxv models without config work. (Comfy-Org#7986)
1 parent cc33cd3 commit 56b6ee6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

comfy/model_detection.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,10 @@ def detect_unet_config(state_dict, key_prefix, metadata=None):
222222
if '{}adaln_single.emb.timestep_embedder.linear_1.bias'.format(key_prefix) in state_dict_keys: #Lightricks ltxv
223223
dit_config = {}
224224
dit_config["image_model"] = "ltxv"
225+
dit_config["num_layers"] = count_blocks(state_dict_keys, '{}transformer_blocks.'.format(key_prefix) + '{}.')
226+
shape = state_dict['{}transformer_blocks.0.attn2.to_k.weight'.format(key_prefix)].shape
227+
dit_config["attention_head_dim"] = shape[0] // 32
228+
dit_config["cross_attention_dim"] = shape[1]
225229
if metadata is not None and "config" in metadata:
226230
dit_config.update(json.loads(metadata["config"]).get("transformer", {}))
227231
return dit_config

0 commit comments

Comments
 (0)