Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

fix(minimax-h3): recognize modular_model_index.json in folder scan

Lincoln Stein3096f4570f2d
diff --git a/invokeai/backend/model_manager/search.py b/invokeai/backend/model_manager/search.py
index a056979880..2e2462a1e1 100644
--- a/invokeai/backend/model_manager/search.py
+++ b/invokeai/backend/model_manager/search.py
@@ -115,6 +115,7 @@ class ModelSearch:
for x in [
"config.json",
"model_index.json",
+ "modular_model_index.json",
"learned_embeds.bin",
"pytorch_lora_weights.bin",
"image_encoder.txt",
diff --git a/tests/test_model_search.py b/tests/test_model_search.py
index a6470c6620..5b5d0d34da 100644
--- a/tests/test_model_search.py
+++ b/tests/test_model_search.py
@@ -140,3 +140,23 @@ def test_model_search_handles_diffusers_model_dirs(model_search: tuple[ModelSear
assert on_model_found_called_with == expected
assert search.stats.models_found == 2
assert search.stats.models_filtered == 2
+
+
+def test_model_search_handles_modular_diffusers_model_dirs(model_search: tuple[ModelSearch, Path]):
+ """A Modular Diffusers folder (e.g. MiniMax H3) has modular_model_index.json at its root and
+ config.json files inside its submodel folders. The walker must stop at the root instead of
+ descending and offering each submodel folder as a separate model."""
+ search, tmp_path = model_search
+
+ modular_dir = tmp_path / "modular_dir"
+ modular_dir.mkdir()
+ with open(modular_dir / "modular_model_index.json", "w") as f:
+ f.write("")
+ submodel_dir = modular_dir / "transformer"
+ submodel_dir.mkdir()
+ with open(submodel_dir / "config.json", "w") as f:
+ f.write("")
+
+ found = search.search(tmp_path)
+
+ assert found == {modular_dir}