Skip to content

Commit 74e5695

Browse files
fix(mm): json schema for unknownmodelconfig
1 parent 15e5c9a commit 74e5695

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

invokeai/backend/model_manager/config.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ class ModelConfigBase(ABC, BaseModel):
139139

140140
@staticmethod
141141
def json_schema_extra(schema: dict[str, Any]) -> None:
142-
schema["required"].extend(["key", "base", "type", "format"])
142+
schema["required"].extend(["key", "type", "format"])
143143

144144
model_config = ConfigDict(validate_assignment=True, json_schema_extra=json_schema_extra)
145145

@@ -175,7 +175,7 @@ def __init_subclass__(cls, **kwargs):
175175
if issubclass(cls, LegacyProbeMixin):
176176
ModelConfigBase.USING_LEGACY_PROBE.add(cls)
177177
# Cannot use `elif isinstance(cls, UnknownModelConfig)` because UnknownModelConfig is not defined yet
178-
elif cls.__name__ != "UnknownModelConfig":
178+
else:
179179
ModelConfigBase.USING_CLASSIFY_API.add(cls)
180180

181181
@staticmethod
@@ -290,6 +290,12 @@ def matches(cls, mod: ModelOnDisk) -> bool:
290290
def parse(cls, mod: ModelOnDisk) -> dict[str, Any]:
291291
return {}
292292

293+
@staticmethod
294+
def json_schema_extra(schema: dict[str, Any]) -> None:
295+
schema["required"] = list(set(schema["required"].extend(["key", "base", "type", "format"])))
296+
297+
model_config = ConfigDict(validate_assignment=True, json_schema_extra=json_schema_extra)
298+
293299

294300
class CheckpointConfigBase(ABC, BaseModel):
295301
"""Base class for checkpoint-style models."""

0 commit comments

Comments
 (0)