Skip to content

Commit fa84eec

Browse files
committed
Model inspection: support more base models
1 parent 5ef2fdd commit fa84eec

2 files changed

Lines changed: 28 additions & 4 deletions

File tree

api.py

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import traceback
77
import re
88
import logging
9+
import itertools
910

1011
from comfy import model_detection
1112
import comfy.utils
@@ -38,7 +39,19 @@
3839
"GenmoMochi": "mochi",
3940
"LTXV": "ltxv",
4041
"HunyuanVideo": "hunyuan-video",
41-
"Lumina2": "lumina2",
42+
"CosmosT2V": "cosmos",
43+
"CosmosI2V": "cosmos",
44+
"CosmosT2IPredict2": "cosmos-predict2",
45+
"CosmosI2VPredict2": "cosmos-predict2",
46+
"WAN21_T2V": "wan21",
47+
"WAN21_I2V": "wan21",
48+
"WAN21_FunControl2V": "wan21-fun",
49+
"WAN21_Vace": "wan21-vace",
50+
"WAN21_Camera": "wan21-camera",
51+
"HiDream": "hi-dream",
52+
"Chroma": "chroma",
53+
"ACEStep": "ace-step",
54+
"Omnigen2": "omnigen2"
4255
}
4356

4457
gguf_architectures = {"sd1": "sd15"}
@@ -90,13 +103,22 @@ def inspect_safetensors(filename: str, model_type: str, is_checkpoint: bool):
90103
return {"base_model": "unknown"}
91104

92105
base_model_class = base_model.__class__
93-
base_model_name = model_names.get(base_model_class.__name__, "unknown")
106+
raw_name = base_model_class.__name__
107+
base_model_name = model_names.get(raw_name, "unknown")
94108
result = {"base_model": base_model_name}
95109
result["is_inpaint"] = (
96110
base_model_name in ["sd15", "sdxl"] and input_count > 4
97-
) or base_model_class.__name__ == "FluxInpaint"
111+
) or raw_name == "FluxInpaint"
98112
if base_model_name == "sdxl":
99113
result["type"] = base_model.model_type(cfg).name.lower().replace("_", "-")
114+
elif "T2I" in raw_name:
115+
result["type"] = "t2i"
116+
elif "I2V" in raw_name:
117+
result["type"] = "i2v"
118+
elif "T2V" in raw_name:
119+
result["type"] = "t2v"
120+
elif "Control2V" in raw_name:
121+
result["type"] = "control2v"
100122
return result
101123
return {"base_model": "unknown"}
102124
except Exception as e:
@@ -122,6 +144,8 @@ def inspect_gguf(filename: str, model_type: str):
122144
arch_str = str(arch_field.parts[arch_field.data[-1]], encoding="utf-8")
123145
else: # stable-diffusion.cpp, requires conversion. not handled for now
124146
return {"base_model": "flux", "is_inpaint": False}
147+
if arch_str == "flux" and any(t.name.startswith("distilled_guidance_layer") for t in itertools.islice(reader.tensors, 5)):
148+
arch_str = "chroma"
125149
return {
126150
"base_model": gguf_architectures.get(arch_str, arch_str),
127151
"is_inpaint": False,

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
name = "comfyui-tooling-nodes"
33
description = "Provides nodes and server API extensions geared towards using ComfyUI as a backend for external tools."
4-
version = "2.0.3"
4+
version = "2.0.4"
55
license = { file = "LICENSE" }
66

77
[project.urls]

0 commit comments

Comments
 (0)