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(models): let one model file serve as more than one type (#10221)

Alexander Eichhorn760f3130c367
diff --git a/docs/src/content/docs/Users Guide/03.Models/01.introduction.mdx b/docs/src/content/docs/Users Guide/03.Models/01.introduction.mdx
index 73b1c64dca..967850327b 100644
--- a/docs/src/content/docs/Users Guide/03.Models/01.introduction.mdx
+++ b/docs/src/content/docs/Users Guide/03.Models/01.introduction.mdx
@@ -152,7 +152,7 @@ Click a model in the library to open it. Its **⋯** menu, and right-clicking it
| Run on CPU | **Run on CPU** (text encoders, VAEs, CLIP Vision, SigLIP, LLaVA OneVision, Text LLMs); **Decode previews on CPU** (Tiny AutoEncoders) | Saves VRAM; may be slower. |
| Moved file | **Update path** beside the path (models installed in place outside the models folder, or whose files are missing) | Points Invoke at the file's new location. Nothing is moved or copied. |
| Convert to diffusers | **Convert to diffusers** (checkpoint main models of supported families) | Replaces the checkpoint file with a diffusers folder. |
-| Re-identify | **Re-identify model** in the menu | Re-reads the files to detect base, type, format and variant again. |
+| Re-identify | **Re-identify model** in the menu | Re-reads the files to detect base, type, format, variant and roles again. |
| Delete | **Delete model** in the menu, then confirm | Removes the model from Invoke. Its files are deleted only if they are inside Invoke's models folder, where everything the Model Manager downloads or moves goes; a model installed in place elsewhere keeps its files. |
| Act on several models | Tick their rows or **Select all**, then **Re-identify** or **Delete** | Asks once for all of them. Models that fail stay selected, and a notice gives the counts and the first error. |
@@ -160,6 +160,8 @@ Click a model in the library to open it. Its **⋯** menu, and right-clicking it
:::caution[Re-identify resets settings]
Re-identify keeps the name, description, cover image, trigger phrases, install source and the CPU and FP8 storage choices. It resets the custom variant and the other default settings, and clears the **Source URL**: note it first. Re-identifying several models asks for confirmation first; the single-model action runs at once.
+
+Re-identify also recomputes the model's roles (see below). Changing a model's **Type** by hand in the edit form discards its roles; Re-identify restores them.
:::
## Maintenance
@@ -202,6 +204,7 @@ Invoke identifies a model from its files, and falls back to its name only where
- **Standalone 16-channel VAEs.** FLUX.1 and SD3 use the same VAE network with different settings. A diffusers `vae/` folder is identified by its `config.json`, so FLUX.1-dev's folder is filed as FLUX.1 and SD3.5's as SD3. A single file such as `sd3_vae.safetensors` is identified by its name, folder or download source; if none of them names a model family, it is filed as FLUX.1. If a VAE lands under the wrong base, change **Base** with **Edit**. A `vae/` folder installed before this detection existed can be fixed with **Re-identify model**.
- **FLUX.2 Klein 9B vs. Klein 9B Base.** The two are identical in structure, so the file or repo name decides, and they ship different default step counts (4 against 28). Names that say "distilled" are read as Klein 9B even when they also contain "base". If you installed `Winnougan/Klein9b-Distilled-Base-INT8-Convrot` by repo ID before this was fixed, it was filed as Klein 9B Base; remove and reinstall it.
+- **Roles.** Some model files serve as more than one model type: a whole Qwen3.5 9B vision-language model is a Text LLM and also the Qwen3.5 9B encoder of MOSS-Image, and a complete Qwen3 language-model folder is a Text LLM and also a Qwen3 encoder. Invoke files each model under one type, which is its identity in the Model Manager, workflows and the API, and records the other types the same files serve as. The Model Manager lists the model under each of those types, its details show **Also usable as**, and the pickers for those types offer it. Roles come from the files at install or Re-identify; there is nothing to configure.
</details>
diff --git a/docs/src/content/docs/Users Guide/03.Models/03.model-format-support.mdx b/docs/src/content/docs/Users Guide/03.Models/03.model-format-support.mdx
index de426f9e26..c1a9e14b0f 100644
--- a/docs/src/content/docs/Users Guide/03.Models/03.model-format-support.mdx
+++ b/docs/src/content/docs/Users Guide/03.Models/03.model-format-support.mdx
@@ -141,13 +141,13 @@ models. Install the whole MOSS-Image Diffusers folder or a merged single file in
The Qwen3.5 9B encoder also installs in ComfyUI's `int8_convrot` build. It keeps its quantized layers in int8 and
widens the embedding when it loads; the vision tower, LM head and multi-token-prediction head in the file are not read.
-The files in Comfy-Org's MOSS-Image repository (`text_encoders/`) have the same tensors as the FLUX.3 prompt
-upsampler, so nothing in the file tells the two apart; InvokeAI goes by where the file came from. Installing it from
-that repository by URL, or with the **Qwen3.5 9B Encoder (int8)** starter model, gives a Qwen3.5 encoder, and
-Reidentify repairs an older Text LLM record made from that URL. A local copy of the file installs as a
-[Text LLM](#text-llms), so use the starter or the URL. A model already installed as a Qwen3.5 encoder stays one when
-it is reidentified. w4a8, fp8 scaled, nvfp4 and mxfp8 builds are refused at install with a message. No int8 build
-of the 4B exists to test against.
+The files in Comfy-Org's MOSS-Image repository (`text_encoders/`) have the same tensors as the FLUX.3 prompt upsampler:
+a whole Qwen3.5 9B vision-language model. Such a file installs as a [Text LLM](#text-llms) and also serves as the
+Qwen3.5 9B encoder, whether it comes from a URL, a repository id or a local copy. Installed with the **Qwen3.5 9B
+Encoder (int8)** starter model, it is filed as a Qwen3.5 encoder and also serves as a Text LLM. An export without LM
+head or vision tower, such as ComfyUI's `moss-image-qwen35.safetensors`, is only an encoder. Roles are recorded when a
+model is installed or re-identified. w4a8, fp8 scaled, nvfp4 and mxfp8 builds are refused at install with a message. No
+int8 build of the 4B exists to test against.
## Text LLMs
@@ -167,6 +167,20 @@ InvokeAI supplies the config, tokenizer and processor itself. Such a file in w4a
refused at install with a message, and a GGUF of it is not recognized. The same layout at the 4B's width installs as a
Qwen3.5 encoder, and other widths are not identified.
+A Qwen3.5 9B file also serves as the Qwen3.5 9B encoder of MOSS-Image (see above). The FLUX.3 prompt upsampler is a
+fine-tune: MOSS-Image lists it, but was trained on the stock encoder.
+
+A complete Qwen3 causal-language-model folder (a `config.json` declaring `Qwen3ForCausalLM`, tokenizer files and weights
+at the folder root, such as a download of `Qwen/Qwen3-4B`) installs as a Text LLM and also serves as the Qwen3 encoder
+of its size: 0.6B for Anima, 4B for Z-Image and FLUX.2 Klein 4B, 8B for FLUX.2 Klein 9B. Quantized folders (a
+`quantization_config` in `config.json`, or SDNQ) and other sizes get no encoder role. Roles are recorded at install or
+Re-identify, so a folder installed earlier gets the role when re-identified. A folder holding only the text encoder (no
+tokenizer at its root) still installs as a Qwen3 encoder.
+
+The role depends only on architecture and size, so any Qwen3 fine-tune of that size (chat, abliterated, distilled) is
+offered too, and conditioning follows its weights. Anima's own encoder is Qwen3-0.6B Base (`qwen_3_06b_base`); a
+post-trained Qwen3-0.6B folder conditions differently.
+
## VAEs
| VAE | Single file | Diffusers | Used by |
diff --git a/docs/src/content/docs/Users Guide/03.Models/Local Models/anima.mdx b/docs/src/content/docs/Users Guide/03.Models/Local Models/anima.mdx
index 052b6ed90a..bdc9d74bfd 100644
--- a/docs/src/content/docs/Users Guide/03.Models/Local Models/anima.mdx
+++ b/docs/src/content/docs/Users Guide/03.Models/Local Models/anima.mdx
@@ -49,7 +49,7 @@ distributed as single files only, a checkpoint or a GGUF, so the three component
Select the **Qwen3 Encoder** and **VAE** in the **Components** section next to the model; both are
required. Only the 0.6B Qwen3 encoder is offered — the larger Qwen3 encoders used by Z-Image and FLUX.2
-are not compatible. The same VAE file may be installed under the Anima, Qwen Image or Wan base, and all
+are not compatible. A complete Qwen3 0.6B folder installed as a Text LLM can be selected as the encoder too; roles are recorded at install or Re-identify. Anima's own encoder is Qwen3-0.6B **Base** (`qwen_3_06b_base`), and any Qwen3 0.6B folder is offered, so a post-trained (chat, abliterated or distilled) one conditions differently. The same VAE file may be installed under the Anima, Qwen Image or Wan base, and all
three are listed. FLUX VAEs are **not** compatible.
Anima also needs a T5-XXL tokenizer, which ships with InvokeAI; no T5 model has to be installed.
diff --git a/docs/src/content/docs/Users Guide/03.Models/Local Models/flux-2.mdx b/docs/src/content/docs/Users Guide/03.Models/Local Models/flux-2.mdx
index 0b60eee05c..417893f9ae 100644
--- a/docs/src/content/docs/Users Guide/03.Models/Local Models/flux-2.mdx
+++ b/docs/src/content/docs/Users Guide/03.Models/Local Models/flux-2.mdx
@@ -99,7 +99,10 @@ Standalone Qwen3 encoders are available as starter models too: *FLUX.2 Klein Qwe
its *FP4 mixed* build (~3.6 GB download), and *FLUX.2 Klein Qwen3 8B Encoder* (~16 GB) with *FP4 mixed*
(~6.3 GB download) and *int8* (~9.4 GB) builds. A 4B encoder only works with Klein 4B models, an 8B encoder
only with Klein 9B. A scaled-fp8 Qwen3 encoder file stays fp8 in memory on a GPU that can hold it, about 4.4 GB for
-4B and about 8.2 GB for 8B, instead of being widened to bf16 (about 8.0 GB and 15.1 GB).
+4B and about 8.2 GB for 8B, instead of being widened to bf16 (about 8.0 GB and 15.1 GB). A complete Qwen3 folder
+of the right size installed as a Text LLM (such as `Qwen/Qwen3-4B`) can be selected as the Qwen3 encoder as well;
+roles are recorded at install or Re-identify. Any Qwen3 fine-tune of that size is offered, and conditioning follows
+its weights ([details](/users-guide/models/model-format-support/#text-llms)).
When you install an FP8 checkpoint, FP8 Storage is switched on for it automatically, which keeps the file's
fp8 weights instead of expanding them.
diff --git a/docs/src/content/docs/Users Guide/03.Models/Local Models/flux-3.mdx b/docs/src/content/docs/Users Guide/03.Models/Local Models/flux-3.mdx
index ff9c709127..3aa1638b75 100644
--- a/docs/src/content/docs/Users Guide/03.Models/Local Models/flux-3.mdx
+++ b/docs/src/content/docs/Users Guide/03.Models/Local Models/flux-3.mdx
@@ -299,9 +299,9 @@ ComfyUI's w4a8 build and single files in fp8 scaled, nvfp4 or mxfp8 are refused
upsampler is not recognized; [Model Format Support](/users-guide/models/model-format-support/#text-llms) lists what
loads.
-Before this release, InvokeAI did not install the upsampler as a Text LLM: the folder was not identified, and both
-ComfyUI single files, bf16 and int8, were identified as Qwen3.5 encoders. Use **Re-identify model** in the Model
-Manager on such an install.
+The two ComfyUI single files also serve as a Qwen3.5 9B encoder, so MOSS-Image's encoder picker lists them. MOSS-Image
+was trained on the stock encoder, so use Comfy-Org's MOSS-Image encoder file for it. An upsampler file installed as a
+Qwen3.5 Encoder also serves as a Text LLM once it is re-identified (**Re-identify** in the Model Manager).
## Prompt upsampler in generation
diff --git a/docs/src/content/docs/Users Guide/03.Models/Local Models/moss-image.mdx b/docs/src/content/docs/Users Guide/03.Models/Local Models/moss-image.mdx
index 876308be9f..8d228f5d09 100644
--- a/docs/src/content/docs/Users Guide/03.Models/Local Models/moss-image.mdx
+++ b/docs/src/content/docs/Users Guide/03.Models/Local Models/moss-image.mdx
@@ -85,13 +85,17 @@ When a single-file MOSS-Image model is selected, the **Components** section next
- **Qwen3.5 Encoder**: a single-file Qwen3.5 9B encoder, such as the ComfyUI export
`moss-image-qwen35.safetensors`. A file that carries the vision tower as well loads; the vision tower stays
- on disk. The bf16 files in Comfy-Org's MOSS-Image repository install as this encoder when installed from their URL. The shards of a sharded export, such as the files in the pipeline's `text_encoder/` folder, do not
+ on disk. The files in Comfy-Org's MOSS-Image repository (`text_encoders/`, bf16 and `int8_convrot`) serve as this encoder
+ however they were installed: from their URL, from a repository id or from a local copy. A whole Qwen3.5 9B file with its vision tower and LM head is
+ filed as a [Text LLM](/users-guide/models/model-format-support/#text-llms) that also serves as the encoder, so it
+ appears in this picker. A model's roles are recorded when it is installed or re-identified. The shards of a sharded export, such as the files in the pipeline's `text_encoder/` folder, do not
work on their own: the first shard is refused at install with a message saying so, and the others install as
unknown models. The shards in `transformer/` install as unknown models too. Install the whole Diffusers
folder or a merged single file instead. Anima-3.8B uses the Qwen3.5 4B, which installs under the same encoder type. The two are
not interchangeable, so the picker lists only 9B encoders. ComfyUI's int8 build of the encoder works as well:
- install it with the **Qwen3.5 9B Encoder (int8)** starter model or from its Comfy-Org URL. A local copy of the file is
- identified as a Text LLM, because nothing in it distinguishes it from the FLUX.3 prompt upsampler. On an RTX 4090 it
+ install it with the **Qwen3.5 9B Encoder (int8)** starter model, which files it as a Qwen3.5 Encoder that also
+ serves as a Text LLM, or from its Comfy-Org URL. The FLUX.3 prompt upsampler is a fine-tune of Qwen3.5 9B and appears
+ in this picker too, but MOSS-Image was trained on the stock encoder: use Comfy-Org's MOSS-Image encoder file. On an RTX 4090 it
renders the same scene as the bf16 encoder with shifted details, and the file is about half the size. The w4a8
build is refused at install.
- **VAE**: a FLUX.2 VAE. MOSS-Image ships the FLUX.2 VAE with a smaller decoder (the ComfyUI export
diff --git a/docs/src/content/docs/Users Guide/03.Models/Local Models/z-image.mdx b/docs/src/content/docs/Users Guide/03.Models/Local Models/z-image.mdx
index 208be7ef25..71c26b8b9d 100644
--- a/docs/src/content/docs/Users Guide/03.Models/Local Models/z-image.mdx
+++ b/docs/src/content/docs/Users Guide/03.Models/Local Models/z-image.mdx
@@ -81,7 +81,10 @@ model shows three slots:
- **Qwen3 Encoder**: a standalone Qwen3 4B encoder. Only 4B encoders are listed: the Qwen3 8B encoder that
FLUX.2 Klein 9B uses is too wide for Z-Image. A project that still has an 8B encoder selected shows it in the
slot with an error, and Invoke stays unavailable until you pick a 4B encoder or clear the slot. In a
- workflow, **Main Model - Z-Image** refuses any other Qwen3 encoder by name when it runs.
+ workflow, **Main Model - Z-Image** refuses any other Qwen3 encoder by name when it runs. A complete Qwen3 4B
+ folder installed as a Text LLM (such as `Qwen/Qwen3-4B`) can be selected here too; roles are recorded at install or
+ Re-identify. Any Qwen3 4B fine-tune is offered, and conditioning follows its weights
+ ([details](/users-guide/models/model-format-support/#text-llms)).
- **VAE**: Z-Image decodes with the FLUX VAE, so FLUX-base VAEs are listed here.
You need either a component source or both a Qwen3 encoder and a VAE before you can generate.
diff --git a/docs/src/content/docs/Users Guide/04.Image Generation/prompt-tools.md b/docs/src/content/docs/Users Guide/04.Image Generation/prompt-tools.md
index c2373bba55..9045cd20d3 100644
--- a/docs/src/content/docs/Users Guide/04.Image Generation/prompt-tools.md
+++ b/docs/src/content/docs/Users Guide/04.Image Generation/prompt-tools.md
@@ -15,7 +15,7 @@ Takes your short prompt and expands it into a detailed, vivid description suitab
1. Type a brief prompt (e.g. "a cat in a garden")
2. Click **Expand prompt** (the pencil-and-sparkles button) in the prompt toolbar
-3. Select a Text LLM model from the dropdown. The panel remembers your choice for the project.
+3. Select a Text LLM model from the dropdown. The panel remembers your choice for the project. The list includes models that also serve as a Text LLM, such as a Qwen3.5 9B encoder single file with LM head and vision tower.
4. Choose a **System prompt**, the instructions that tell the model how to rewrite your prompt
5. Click **Expand**
6. Your prompt is replaced with the expanded version, which you can edit before generating
diff --git a/docs/src/content/docs/development/Architecture/model-manager.mdx b/docs/src/content/docs/development/Architecture/model-manager.mdx
index 64cbf1f641..4478428a03 100644
--- a/docs/src/content/docs/development/Architecture/model-manager.mdx
+++ b/docs/src/content/docs/development/Architecture/model-manager.mdx
@@ -56,6 +56,7 @@ All model metadata classes inherit from this pydantic class. it provides the fol
| `hash` | str | Hash of the model |
| `description` | str | Human-readable description of the model (optional) |
| `source` | str | Model's source URL or repo id (optional) |
+| `roles` | list | Other model types the same files serve as: `{type, format, variant}` entries; `format` is set only when it differs from the record's |
The `key` is a unique 32-character random ID which was generated at install time. The `hash` field stores a hash of the model's contents at install time obtained by sampling several parts of the model's files using the `imohash` library. Over the course of the model's lifetime it may be transformed in various ways, such as changing its precision or converting it from a .safetensors to a diffusers model.
@@ -104,6 +105,16 @@ The `SchedulerPredictionType` enum can be imported from either `invokeai.app.ser
There are a series of such classes each discriminated by their `ModelFormat`, including `LoRAConfig`, `IPAdapterConfig`, and so forth. These are rarely needed outside the model manager's internal code, but available in `invokeai.backend.model_manager.config` if needed. There is also a Union of all ModelConfig classes, called `AnyModelConfig` that can be imported from the same file.
+### Roles
+
+Some files serve as more than one model type, such as a Qwen3.5 9B vision-language model (Text LLM and MOSS-Image's Qwen3.5 encoder) or a complete Qwen3 language-model folder (Text LLM and Qwen3 encoder). The record keeps one primary `type`, which is its identity, and lists the others in `roles`. Each family's identification derives the roles from the files; nothing is configured.
+
+- **Selection.** `GET /api/v2/models/?model_type=` and `search_by_attr(model_type=...)` filter by the primary type only. The UI lists a model under each of its roles.
+- **Nodes.** A node asks for a model in a role through the `type` of the `ModelIdentifierField` it passes to `context.models.load()` or `get_config()`. The invocation context then returns a role view: an instance of the role's config class built from the record (`serves_as`, `role_variant` and `view_as` in `invokeai/backend/model_manager/configs/roles.py`). The loader nodes of MOSS-Image, Z-Image, FLUX.2 Klein, Anima and the Text LLM nodes do this themselves, so graphs keep sending the record's own type.
+- **Node authors.** A node that takes a role-capable model field must request the role by setting the identifier's `type` before `load` or `get_config`. The UI offers role-serving models in every picker of that type, and workflow fields store the record's own type, so the node cannot rely on the field to carry the role.
+- **Loading and cache.** A role view loads through the role's loader and is cached under `<key>[:<submodel>]:as_<type>[:<variant>]` (the loader's device-format suffix comes last), so the encoder and the Text LLM of one file never share a cache entry. Editing or re-identifying the record evicts both. Model load socket events carry the role view's config: the record key and the role type.
+- **Lifecycle.** Re-identification recomputes the roles. Changing `type` by hand through `update_model_record()` discards them.
+
### Limitations of the Data Model
The config hierarchy has a major limitation in its handling of the base model type. Each model can only be compatible with one base model, which breaks down in the event of models that are compatible with two or more base models. For example, SD-1 VAEs also work with SD-2 models. A partial workaround is to use `BaseModelType.Any`, which indicates that the model is compatible with any of the base models. This works OK for some models, such as the IP Adapter image encoders, but is an all-or-nothing proposition.
@@ -168,7 +179,7 @@ Returns the configurations of the models whose file has the given hash.
#### search_by_attr(model_name, base_model, model_type, model_format, order_by, direction) -> List[AnyModelConfig]
-Returns the models that match every filter given among `model_name`, `base_model`, `model_type` and `model_format`, ordered by a `ModelRecordOrderBy` (type, base, name and format by default; names and bases ignore case) in `direction`. Models that tie are ordered by key, in the same direction. Calling it without filters returns all the models in the database.
+Returns the models that match every filter given among `model_name`, `base_model`, `model_type` and `model_format`, ordered by a `ModelRecordOrderBy` (type, base, name and format by default; names and bases ignore case) in `direction`. Models that tie are ordered by key, in the same direction. `model_type` matches the primary type only, not `roles`. Calling it without filters returns all the models in the database.
A stored config that no longer validates, for instance one written by a newer version of the application, is skipped with a warning in the log.
diff --git a/docs/src/generated/invocation-context.json b/docs/src/generated/invocation-context.json
index a9259a2e98..5178ac3c05 100644
--- a/docs/src/generated/invocation-context.json
+++ b/docs/src/generated/invocation-context.json
@@ -238,7 +238,7 @@
"parameters": [
{
"default": "",
- "description": "The key or ModelField representing the model.",
+ "description": "The key or ModelField representing the model. A ModelField's `type` selects the role. The config is the record's view in that type when it serves as it (see `Config_Base.roles`), else the stored record.",
"name": "identifier",
"type": "Union[str, ModelIdentifierField]"
}
@@ -253,7 +253,7 @@
"parameters": [
{
"default": "",
- "description": "The key or ModelField representing the model.",
+ "description": "The key or ModelField representing the model. A ModelField's `type` is the type the model is loaded as, its own type or a role it serves as (see `Config_Base.roles`).",
"name": "identifier",
"type": "Union[str, ModelIdentifierField]"
},
diff --git a/invokeai/app/api/routers/model_manager.py b/invokeai/app/api/routers/model_manager.py
index d18dc45685..81fae12853 100644
--- a/invokeai/app/api/routers/model_manager.py
+++ b/invokeai/app/api/routers/model_manager.py
@@ -55,6 +55,7 @@ from invokeai.backend.model_manager.configs.main import (
Main_Checkpoint_SDXL_Config,
Main_Checkpoint_SDXLRefiner_Config,
)
+from invokeai.backend.model_manager.configs.roles import role_variant, serves_as
from invokeai.backend.model_manager.load.fp8_capability import Fp8StorageSupport, fp8_storage_support
from invokeai.backend.model_manager.load.model_cache.cache_stats import CacheStats
from invokeai.backend.model_manager.metadata.fetch.huggingface import HuggingFaceMetadataFetch
@@ -1522,8 +1523,9 @@ def get_is_installed(
if expected_variant is not None:
for model in installed_models:
- if model.type == ModelType.Qwen3Encoder and hasattr(model, "variant"):
- model_variant = model.variant
+ # A Qwen3 folder installed as a Text LLM serves as the encoder too.
+ if serves_as(model, ModelType.Qwen3Encoder):
+ model_variant = role_variant(model, ModelType.Qwen3Encoder)
# Handle both enum and string values
if isinstance(model_variant, Qwen3VariantType):
if model_variant == expected_variant:
diff --git a/invokeai/app/api/routers/utilities.py b/invokeai/app/api/routers/utilities.py
index 07fe8f4e12..ea86c943a2 100644
--- a/invokeai/app/api/routers/utilities.py
+++ b/invokeai/app/api/routers/utilities.py
@@ -33,6 +33,7 @@ from invokeai.app.services.wildcard_records.wildcard_records_common import build
from invokeai.app.util.dynamicprompts import expand_dynamic_prompt
from invokeai.app.util.misc import SEED_MAX, get_random_seed
from invokeai.backend.llava_onevision_pipeline import LlavaOnevisionPipeline
+from invokeai.backend.model_manager.configs.roles import serves_as, view_as
from invokeai.backend.model_manager.taxonomy import ModelType
from invokeai.backend.text_llm_pipeline import (
DEFAULT_SYSTEM_PROMPT,
@@ -447,8 +448,9 @@ def _run_expand_prompt(
events = ApiDependencies.invoker.services.events
model_config = model_manager.store.get_model(model_key)
- if model_config.type != ModelType.TextLLM:
+ if not serves_as(model_config, ModelType.TextLLM):
raise ValueError(f"Model '{model_key}' is not a TextLLM model (got {model_config.type})")
+ model_config = view_as(model_config, ModelType.TextLLM)
# Only the TextLLM config carries the flag (the record type is a union); older records validate to False.
if image_name is not None and not getattr(model_config, "supports_images", False):
raise ValueError(f"Model '{model_config.name}' cannot read images; choose a vision-capable text LLM")
diff --git a/invokeai/app/invocations/anima/anima_model_loader.py b/invokeai/app/invocations/anima/anima_model_loader.py
index 184fa7e182..de0c89a0c4 100644
--- a/invokeai/app/invocations/anima/anima_model_loader.py
+++ b/invokeai/app/invocations/anima/anima_model_loader.py
@@ -100,8 +100,10 @@ class AnimaModelLoaderInvocation(BaseInvocation):
vae = self.vae_model.model_copy(update={"submodel_type": SubModelType.VAE})
# Qwen3 Encoder
- qwen3_tokenizer = self.qwen3_encoder_model.model_copy(update={"submodel_type": SubModelType.Tokenizer})
- qwen3_encoder = self.qwen3_encoder_model.model_copy(update={"submodel_type": SubModelType.TextEncoder})
+ # Asked for as an encoder: a Text LLM holding a Qwen3 folder serves as one.
+ qwen3 = self.qwen3_encoder_model.model_copy(update={"type": ModelType.Qwen3Encoder})
+ qwen3_tokenizer = qwen3.model_copy(update={"submodel_type": SubModelType.Tokenizer})
+ qwen3_encoder = qwen3.model_copy(update={"submodel_type": SubModelType.TextEncoder})
return AnimaModelLoaderOutput(
transformer=TransformerField(transformer=transformer, loras=[]),
@@ -127,13 +129,14 @@ class AnimaModelLoaderInvocation(BaseInvocation):
# MOSS-Image's 9B installs under the same model type, and the connector was trained on the 4B.
# Without this check the 9B loads (~16 GB) and denoising then fails on a 4096-against-2560 shape
# mismatch, which says nothing about the encoder the user picked.
- encoder_config = context.models.get_config(self.qwen3_5_encoder_model)
+ encoder = self.qwen3_5_encoder_model.model_copy(update={"type": ModelType.Qwen35Encoder})
+ encoder_config = context.models.get_config(encoder)
if getattr(encoder_config, "variant", None) != Qwen35VariantType.Qwen35_4B:
raise ValueError(
f"'{encoder_config.name}' is not a Qwen3.5 4B encoder, which {self.model.name}'s semantic "
"connector was trained on (hidden size 2560). Select qwen35_4b.safetensors as the Qwen3.5 Encoder."
)
return Qwen35EncoderField(
- tokenizer=self.qwen3_5_encoder_model.model_copy(update={"submodel_type": SubModelType.Tokenizer}),
- text_encoder=self.qwen3_5_encoder_model.model_copy(update={"submodel_type": SubModelType.TextEncoder}),
+ tokenizer=encoder.model_copy(update={"submodel_type": SubModelType.Tokenizer}),
+ text_encoder=encoder.model_copy(update={"submodel_type": SubModelType.TextEncoder}),
)
diff --git a/invokeai/app/invocations/flux2/flux2_klein_model_loader.py b/invokeai/app/invocations/flux2/flux2_klein_model_loader.py
index 5c7424e5bb..c82eff5861 100644
--- a/invokeai/app/invocations/flux2/flux2_klein_model_loader.py
+++ b/invokeai/app/invocations/flux2/flux2_klein_model_loader.py
@@ -168,9 +168,11 @@ class Flux2KleinModelLoaderInvocation(BaseInvocation):
# Determine Qwen3 Encoder source
if self.qwen3_encoder_model is not None:
# Use standalone Qwen3 Encoder - validate it matches the FLUX.2 Klein variant
- self._validate_qwen3_encoder_variant(context, main_config)
- qwen3_tokenizer = self.qwen3_encoder_model.model_copy(update={"submodel_type": SubModelType.Tokenizer})
- qwen3_encoder = self.qwen3_encoder_model.model_copy(update={"submodel_type": SubModelType.TextEncoder})
+ # Asked for as an encoder: a Text LLM holding a Qwen3 folder serves as one.
+ encoder = self.qwen3_encoder_model.model_copy(update={"type": ModelType.Qwen3Encoder})
+ self._validate_qwen3_encoder_variant(context, main_config, encoder)
+ qwen3_tokenizer = encoder.model_copy(update={"submodel_type": SubModelType.Tokenizer})
+ qwen3_encoder = encoder.model_copy(update={"submodel_type": SubModelType.TextEncoder})
elif main_is_diffusers:
# Extract from main model (recommended for FLUX.2 Klein)
qwen3_tokenizer = self.model.model_copy(update={"submodel_type": SubModelType.Tokenizer})
@@ -258,19 +260,24 @@ class Flux2KleinModelLoaderInvocation(BaseInvocation):
"Select a Klein pipeline from the same family - 4B pairs with 4B, 9B with 9B."
)
- def _validate_qwen3_encoder_variant(self, context: InvocationContext, main_config: AnyModelConfig) -> None:
+ def _validate_qwen3_encoder_variant(
+ self, context: InvocationContext, main_config: AnyModelConfig, encoder: ModelIdentifierField
+ ) -> None:
"""Validate that the standalone Qwen3 encoder variant matches the FLUX.2 Klein variant.
- FLUX.2 Klein 4B (and 4B Base) require the Qwen3 4B encoder
- FLUX.2 Klein 9B (and 9B Base) require the Qwen3 8B encoder
"""
- if self.qwen3_encoder_model is None:
- return
-
# `getattr(..., None)` rather than `hasattr`: the field can exist and still be None, and
# comparing None against the expected variant would then raise `AttributeError` on
# `.value` in the error path instead of the intended `ValueError`.
- qwen3_variant = getattr(context.models.get_config(self.qwen3_encoder_model), "variant", None)
+ encoder_config = context.models.get_config(encoder)
+ if encoder_config.type is not ModelType.Qwen3Encoder:
+ raise ValueError(
+ f"'{encoder_config.name}' is not a Qwen3 encoder. Select a Qwen3 encoder or a Text LLM that serves "
+ "as one, or clear it and set 'Qwen3 Source' to a Diffusers FLUX.2 Klein model."
+ )
+ qwen3_variant = getattr(encoder_config, "variant", None)
if qwen3_variant is None:
return
diff --git a/invokeai/app/invocations/model.py b/invokeai/app/invocations/model.py
index 8d6b5bf3eb..9b7ca2d379 100644
--- a/invokeai/app/invocations/model.py
+++ b/invokeai/app/invocations/model.py
@@ -62,7 +62,10 @@ class ModelIdentifierField(BaseModel):
hash: str = Field(description="The model's BLAKE3 hash")
name: str = Field(description="The model's name")
base: BaseModelType = Field(description="The model's base model type")
- type: ModelType = Field(description="The model's type")
+ type: ModelType = Field(
+ description="The model's type, or a role it serves as (see its config's `roles`) when a node asks for it in "
+ "that role"
+ )
submodel_type: SubModelType | None = Field(
description="The submodel to load, if this is a main model",
default=None,
diff --git a/invokeai/app/invocations/moss_image/moss_image_model_loader.py b/invokeai/app/invocations/moss_image/moss_image_model_loader.py
index 8cadb37127..97bc849839 100644
--- a/invokeai/app/invocations/moss_image/moss_image_model_loader.py
+++ b/invokeai/app/invocations/moss_image/moss_image_model_loader.py
@@ -112,7 +112,9 @@ class MossImageModelLoaderInvocation(BaseInvocation):
vae = self.model.model_copy(update={"submodel_type": SubModelType.VAE})
if self.qwen3_5_encoder_model is not None:
- encoder_config = context.models.get_config(self.qwen3_5_encoder_model)
+ # Asked for as an encoder: a Text LLM holding a whole Qwen3.5 9B checkpoint serves as one.
+ encoder = self.qwen3_5_encoder_model.model_copy(update={"type": ModelType.Qwen35Encoder})
+ encoder_config = context.models.get_config(encoder)
# Two Qwen3.5 sizes install under this type, and only the 9B fits: MOSS-Image was trained on its 4096-wide
# last hidden state. The 4B (Anima-3.8B's) would load and then fail on a shape error naming a tensor.
if (
@@ -121,10 +123,10 @@ class MossImageModelLoaderInvocation(BaseInvocation):
):
raise ValueError(
f"'{encoder_config.name}' is not a Qwen3.5 9B encoder, which MOSS-Image conditions on (hidden "
- "size 4096). Select a Qwen3.5 9B encoder."
+ "size 4096). Select a Qwen3.5 9B encoder or a Text LLM that serves as one."
)
- tokenizer = self.qwen3_5_encoder_model.model_copy(update={"submodel_type": SubModelType.Tokenizer})
- text_encoder = self.qwen3_5_encoder_model.model_copy(update={"submodel_type": SubModelType.TextEncoder})
+ tokenizer = encoder.model_copy(update={"submodel_type": SubModelType.Tokenizer})
+ text_encoder = encoder.model_copy(update={"submodel_type": SubModelType.TextEncoder})
else:
tokenizer = self.model.model_copy(update={"submodel_type": SubModelType.Tokenizer})
text_encoder = self.model.model_copy(update={"submodel_type": SubModelType.TextEncoder})
diff --git a/invokeai/app/invocations/text_llm.py b/invokeai/app/invocations/text_llm.py
index fafad9503d..9494b1be80 100644
--- a/invokeai/app/invocations/text_llm.py
+++ b/invokeai/app/invocations/text_llm.py
@@ -31,6 +31,8 @@ def _run_text_llm(
seed: int,
) -> str:
"""Shared LLM invocation body used by every text-LLM node in this module."""
+ # Asked for as a Text LLM: a Qwen3.5 encoder record whose whole-model file serves as one is offered in these fields.
+ text_llm_model = text_llm_model.model_copy(update={"type": ModelType.TextLLM})
tokenizer, _ = load_text_llm_tokenizer_and_processor(
lambda submodel: context.models.load(text_llm_model, submodel), with_processor=False
)
diff --git a/invokeai/app/invocations/z_image/z_image_model_loader.py b/invokeai/app/invocations/z_image/z_image_model_loader.py
index 5a2591c4b0..e8a6a88dd4 100644
--- a/invokeai/app/invocations/z_image/z_image_model_loader.py
+++ b/invokeai/app/invocations/z_image/z_image_model_loader.py
@@ -128,9 +128,11 @@ class ZImageModelLoaderInvocation(BaseInvocation):
# Determine Qwen3 Encoder source
if self.qwen3_encoder_model is not None:
# Use standalone Qwen3 Encoder
- self._validate_qwen3_encoder_variant(context, self.qwen3_encoder_model)
- qwen3_tokenizer = self.qwen3_encoder_model.model_copy(update={"submodel_type": SubModelType.Tokenizer})
- qwen3_encoder = self.qwen3_encoder_model.model_copy(update={"submodel_type": SubModelType.TextEncoder})
+ # Asked for as an encoder: a Text LLM holding a Qwen3 folder serves as one.
+ encoder = self.qwen3_encoder_model.model_copy(update={"type": ModelType.Qwen3Encoder})
+ self._validate_qwen3_encoder_variant(context, encoder)
+ qwen3_tokenizer = encoder.model_copy(update={"submodel_type": SubModelType.Tokenizer})
+ qwen3_encoder = encoder.model_copy(update={"submodel_type": SubModelType.TextEncoder})
elif self.qwen3_source_model is not None:
# Extract from Diffusers Z-Image model
self._validate_diffusers_format(context, self.qwen3_source_model, "Qwen3 Source")
diff --git a/invokeai/app/services/model_load/model_load_default.py b/invokeai/app/services/model_load/model_load_default.py
index 5288bc9e3c..bc9e9693c5 100644
--- a/invokeai/app/services/model_load/model_load_default.py
+++ b/invokeai/app/services/model_load/model_load_default.py
@@ -16,6 +16,7 @@ from invokeai.app.services.model_load.model_load_base import ModelLoadServiceBas
from invokeai.app.services.model_load.model_load_common import distinct_caches, load_settings_changed
from invokeai.app.services.model_records import UnknownModelException
from invokeai.backend.model_manager.configs.factory import AnyModelConfig
+from invokeai.backend.model_manager.configs.roles import ModelRoleError, view_as
from invokeai.backend.model_manager.load import (
LoadedModel,
LoadedModelWithoutConfig,
@@ -188,7 +189,7 @@ class ModelLoadService(ModelLoadServiceBase):
# The record changed after the caller read it: loading what it says now is what this call
# would have done had it been made a moment later. Retried here rather than by callers so
# every caller gets it.
- return self._load(self._current_record(model_config.key), submodel_type)
+ return self._load(self._record_as(model_config), submodel_type)
except FileNotFoundError:
# The same, when the model was moved and its record updated to the new path; a missing
# file under an unchanged (or deleted) record is the caller's real error.
@@ -276,6 +277,19 @@ class ModelLoadService(ModelLoadServiceBase):
self._record_edits.wait_idle(key)
return self._invoker.services.model_manager.store.get_model(key)
+ @staticmethod
+ def _as_role_of(config: AnyModelConfig, current: AnyModelConfig) -> AnyModelConfig:
+ """`current` in the role `config` is a view of; `current` itself when `config` is a stored record.
+ Raises ModelRoleError when the record no longer serves that role."""
+ if getattr(config, "role_of", None) is None:
+ return current
+ return view_as(current, config.type)
+
+ def _record_as(self, config: AnyModelConfig) -> AnyModelConfig:
+ """The stored record for `config`'s key, in the role `config` is loaded as. A role view is compared with the
+ view of the stored record: its type and class never equal the stored record's."""
+ return self._as_role_of(config, self._current_record(config.key))
+
def _moved_record(self, config: AnyModelConfig) -> Optional[AnyModelConfig]:
"""The stored record for `config`'s key if it now loads differently from `config`, else None."""
if not hasattr(self, "_invoker"):
@@ -284,6 +298,11 @@ class ModelLoadService(ModelLoadServiceBase):
current = self._current_record(config.key)
except UnknownModelException:
return None
+ try:
+ current = self._as_role_of(config, current)
+ except ModelRoleError:
+ # Runs in the FileNotFoundError handler: the original error is the caller's.
+ return None
if self._load_settings_changed(config, current):
return current
return None
@@ -310,6 +329,10 @@ class ModelLoadService(ModelLoadServiceBase):
except UnknownModelException:
# Nothing newer to load instead, and the key can no longer be requested.
return True
+ try:
+ current = self._as_role_of(config, current)
+ except ModelRoleError:
+ return False
return not self._load_settings_changed(config, current)
def load_model_from_path(
diff --git a/invokeai/app/services/model_manager/model_manager_default.py b/invokeai/app/services/model_manager/model_manager_default.py
index e43d912660..17363c5ed2 100644
--- a/invokeai/app/services/model_manager/model_manager_default.py
+++ b/invokeai/app/services/model_manager/model_manager_default.py
@@ -86,8 +86,8 @@ class ModelManagerService(ModelManagerServiceBase):
if encoder_id := getattr(config, "image_encoder_model_id", None):
override_fields["image_encoder_model_id"] = encoder_id
if isinstance(config, Qwen35Encoder_Checkpoint_Config):
- # A Qwen3.5 encoder file can be the same tensors as a Text LLM (Comfy-Org's int8 MOSS-Image encoder against
- # the FLUX.3 upsampler), and a local copy has no source to tell them apart: keep the type it was given.
+ # The weights cannot tell the MOSS-Image encoder from the FLUX.3 prompt upsampler (the same tensors), so a
+ # record installed as an encoder keeps that type; identification adds the Text LLM role.
override_fields["type"] = config.type
result = ModelConfigFactory.from_model_on_disk(mod, override_fields)
if result.config is None:
diff --git a/invokeai/app/services/model_records/model_records_sql.py b/invokeai/app/services/model_records/model_records_sql.py
index 5d7e00333e..c8deb9c2f0 100644
--- a/invokeai/app/services/model_records/model_records_sql.py
+++ b/invokeai/app/services/model_records/model_records_sql.py
@@ -101,6 +101,12 @@ def _check_path_length(path: str) -> None:
raise ValueError(f"A model's path can be at most {MAX_PATH_LENGTH} characters long")
+def _stored_json(config: AnyModelConfig) -> str:
+ """The JSON a record is stored as. Empty roles are left out: a config with `extra="forbid"` would make an older
+ build, which has no `roles` field, drop the record."""
+ return config.model_dump_json(exclude=None if config.roles else {"roles"})
+
+
def _parse(config: str) -> AnyModelConfig:
return ModelConfigFactory.from_dict(json.loads(config))
@@ -125,7 +131,7 @@ class ModelRecordServiceSQL(ModelRecordServiceBase):
if len(config.key) > MAX_KEY_LENGTH:
raise ValueError(f"A model's key can be at most {MAX_KEY_LENGTH} characters long")
_check_path_length(config.path)
- stored = config.model_dump_json()
+ stored = _stored_json(config)
try:
self._queries.models.insert(config.key, stored)
except UniqueViolation as error:
@@ -183,6 +189,10 @@ class ModelRecordServiceSQL(ModelRecordServiceBase):
# under text_llm). If the initial validation fails and the type changed, retry with stale
# format/variant fields stripped so the new class can apply its own defaults.
type_changed = "type" in changes.model_fields_set and changes.type != record.type
+ if type_changed:
+ # Roles are derived by identification from the files. A manual type change discards them;
+ # Re-identify restores them.
+ record_as_dict["roles"] = []
try:
record = ModelConfigFactory.from_dict(record_as_dict)
except ValidationError:
@@ -215,7 +225,7 @@ class ModelRecordServiceSQL(ModelRecordServiceBase):
# If we get this far, the updated model config is valid, so we can save it to the database.
if "path" in changes.model_fields_set:
_check_path_length(record.path)
- updated = record.model_dump_json()
+ updated = _stored_json(record)
q.models.save(key, updated)
return updated
@@ -224,7 +234,7 @@ class ModelRecordServiceSQL(ModelRecordServiceBase):
def replace_model(self, key: str, new_config: AnyModelConfig) -> AnyModelConfig:
if key != new_config.key:
raise ValueError("key does not match new_config.key")
- stored = new_config.model_dump_json()
+ stored = _stored_json(new_config)
if not self._queries.models.save(key, stored):
raise UnknownModelException("model not found")
return _parse(stored)
diff --git a/invokeai/app/services/shared/invocation_context.py b/invokeai/app/services/shared/invocation_context.py
index a941923930..89a5f230c8 100644
--- a/invokeai/app/services/shared/invocation_context.py
+++ b/invokeai/app/services/shared/invocation_context.py
@@ -36,6 +36,7 @@ from invokeai.app.util.step_callback import PreviewRender, diffusion_step_callba
from invokeai.app.util.tiny_autoencoder_previews import TinyAutoencoderPreviews
from invokeai.backend.model_manager.configs.base import Config_Base
from invokeai.backend.model_manager.configs.factory import AnyModelConfig
+from invokeai.backend.model_manager.configs.roles import serves_as, view_as
from invokeai.backend.model_manager.load.load_base import LoadedModel, LoadedModelWithoutConfig
from invokeai.backend.model_manager.taxonomy import AnyModel, BaseModelType, ModelFormat, ModelType, SubModelType
from invokeai.backend.stable_diffusion.diffusers_pipeline import PipelineIntermediateState
@@ -628,6 +629,20 @@ class ModelsInterface(InvocationContextInterface):
super().__init__(services, data)
self._util = util
+ def _resolve(self, identifier: Union[str, "ModelIdentifierField"]) -> AnyModelConfig:
+ """The record an identifier names, or its view in the role the identifier asks for.
+
+ A key names the stored record. A field names the type the model is asked for in: when that is not the record's
+ own type but one it serves as, the result is the record's view in that role. Any other type returns the record
+ unchanged, so the node's own validation sees a mismatch.
+ """
+ if isinstance(identifier, str):
+ return self._services.model_manager.store.get_model(identifier)
+ config = self._services.model_manager.store.get_model(identifier.key)
+ if identifier.type != config.type and serves_as(config, identifier.type):
+ return view_as(config, identifier.type)
+ return config
+
def exists(self, identifier: Union[str, "ModelIdentifierField"]) -> bool:
"""Check if a model exists.
@@ -648,7 +663,8 @@ class ModelsInterface(InvocationContextInterface):
"""Load a model.
Args:
- identifier: The key or ModelField representing the model.
+ identifier: The key or ModelField representing the model. A ModelField's `type` is the type the model is
+ loaded as, its own type or a role it serves as (see `Config_Base.roles`).
submodel_type: The submodel of the model to get.
Returns:
@@ -658,11 +674,9 @@ class ModelsInterface(InvocationContextInterface):
# The model manager emits events as it loads the model. It needs the context data to build
# the event payloads.
- if isinstance(identifier, str):
- model = self._services.model_manager.store.get_model(identifier)
- else:
+ if not isinstance(identifier, str):
submodel_type = submodel_type or identifier.submodel_type
- model = self._services.model_manager.store.get_model(identifier.key)
+ model = self._resolve(identifier)
self._raise_if_external(model)
@@ -749,15 +763,14 @@ class ModelsInterface(InvocationContextInterface):
"""Get a model's config.
Args:
- identifier: The key or ModelField representing the model.
+ identifier: The key or ModelField representing the model. A ModelField's `type` selects the role. The
+ config is the record's view in that type when it serves as it (see `Config_Base.roles`), else the
+ stored record.
Returns:
The model's config.
"""
- if isinstance(identifier, str):
- return self._services.model_manager.store.get_model(identifier)
- else:
- return self._services.model_manager.store.get_model(identifier.key)
+ return self._resolve(identifier)
def search_by_path(self, path: Path) -> list[AnyModelConfig]:
"""Search for models by path.
diff --git a/invokeai/app/services/working_memory_calibration/working_memory_calibration_plan.py b/invokeai/app/services/working_memory_calibration/working_memory_calibration_plan.py
index 9b37da800f..6e29c8fca7 100644
--- a/invokeai/app/services/working_memory_calibration/working_memory_calibration_plan.py
+++ b/invokeai/app/services/working_memory_calibration/working_memory_calibration_plan.py
@@ -271,6 +271,15 @@ def _flux2_sources(main: ModelConfig, models: Sequence[ModelConfig]) -> list[Mod
return [model for model in models if _is_flux2_source(main, model)]
+def _qwen3_encoder_variant(model: ModelConfig) -> Optional[str]:
+ """The variant a model serves the Qwen3 encoder in, as filed or by a role (a Qwen3 folder installed as a Text LLM);
+ None when it does not serve it or names no variant. `roles` is read leniently: the configs here are duck-typed."""
+ if model.type == ModelType.Qwen3Encoder:
+ return _variant(model)
+ role = next((r for r in getattr(model, "roles", ()) if r.type == ModelType.Qwen3Encoder), None)
+ return None if role is None or role.variant is None else _value(role.variant)
+
+
def _has_standalone_encoder(main: ModelConfig, models: Sequence[ModelConfig]) -> bool:
"""Whether a standalone text encoder Generate can fill in for a FLUX.2 main model is installed: a Mistral encoder
other than the Ministral 3B for [dev] (`isFlux2MistralEncoder`), else a Qwen3 encoder other than the 0.6B, of the
@@ -281,11 +290,12 @@ def _has_standalone_encoder(main: ModelConfig, models: Sequence[ModelConfig]) ->
for model in models
)
required = _KLEIN_QWEN3.get(_variant(main) or "")
+ qwen3_variants = (_qwen3_encoder_variant(model) for model in models)
return any(
- model.type == ModelType.Qwen3Encoder
- and _variant(model) != Qwen3VariantType.Qwen3_06B.value
- and (required is None or _variant(model) == required)
- for model in models
+ variant is not None
+ and variant != Qwen3VariantType.Qwen3_06B.value
+ and (required is None or variant == required)
+ for variant in qwen3_variants
)
diff --git a/invokeai/backend/model_manager/configs/base.py b/invokeai/backend/model_manager/configs/base.py
index a72b67b94c..bba6caef21 100644
--- a/invokeai/backend/model_manager/configs/base.py
+++ b/invokeai/backend/model_manager/configs/base.py
@@ -10,7 +10,7 @@ from typing import (
Type,
)
-from pydantic import BaseModel, ConfigDict, Field, Tag, field_validator
+from pydantic import BaseModel, ConfigDict, Field, PrivateAttr, Tag, ValidationError, field_validator
from pydantic_core import PydanticUndefined
from invokeai.app.util.misc import uuid_string
@@ -28,6 +28,24 @@ if TYPE_CHECKING:
pass
+class ModelRole(BaseModel):
+ """Another model type a model's files serve as, beside the type its record is filed under. Set by identification."""
+
+ # Not extra="forbid": roles are persisted, and a field added later must not make an older build drop the record.
+ model_config = ConfigDict(
+ frozen=True,
+ json_schema_serialization_defaults_required=True,
+ json_schema_mode_override="serialization",
+ )
+
+ type: ModelType
+ format: ModelFormat | None = Field(
+ default=None,
+ description="The format the model loads in for this role, when it differs from the record's format",
+ )
+ variant: AnyVariant | None = Field(default=None, description="The variant the model serves as in this role")
+
+
class Config_Base(ABC, BaseModel):
"""
Abstract base class for model configurations. A model config describes a specific combination of model base, type and
@@ -97,6 +115,32 @@ class Config_Base(ABC, BaseModel):
default=None,
description="Url for image to preview model",
)
+ roles: list[ModelRole] = Field(
+ default_factory=list,
+ description="Other model types this model serves as, besides `type`. Derived from its files at identification; "
+ "re-identify to refresh.",
+ )
+ _role_of: ModelType | None = PrivateAttr(default=None)
+
+ @field_validator("roles", mode="before")
+ @classmethod
+ def _drop_unreadable_roles(cls, v: Any) -> Any:
+ # Roles are derived and Re-identify recomputes them, so a role this build cannot read (a type or variant added
+ # by a newer one) is dropped rather than failing the whole record.
+ if not isinstance(v, (list, tuple)):
+ return v
+ readable: list[ModelRole] = []
+ for item in v:
+ try:
+ readable.append(item if isinstance(item, ModelRole) else ModelRole.model_validate(item))
+ except ValidationError:
+ continue
+ return readable
+
+ @property
+ def role_of(self) -> ModelType | None:
+ """For a role view (see `configs.roles.view_as`): the type of the record it was made from. None for a stored record."""
+ return self._role_of
CONFIG_CLASSES: ClassVar[set[Type["Config_Base"]]] = set()
"""Set of all non-abstract subclasses of Config_Base, for use during model probing. In other words, this is the set
diff --git a/invokeai/backend/model_manager/configs/qwen3_5_encoder.py b/invokeai/backend/model_manager/configs/qwen3_5_encoder.py
index e8d78e89f7..5ff325ce66 100644
--- a/invokeai/backend/model_manager/configs/qwen3_5_encoder.py
+++ b/invokeai/backend/model_manager/configs/qwen3_5_encoder.py
@@ -7,14 +7,14 @@ are what tell them apart, and the Qwen3 and Qwen3-VL configs reject them for the
one requires them.
"""
-import re
from collections.abc import Container
+from pathlib import Path
from typing import Any, Literal, Optional, Self
import torch
from pydantic import Field
-from invokeai.backend.model_manager.configs.base import Checkpoint_Config_Base, Config_Base
+from invokeai.backend.model_manager.configs.base import Checkpoint_Config_Base, Config_Base, ModelRole
from invokeai.backend.model_manager.configs.identification_utils import (
InvalidMatchError,
NotAMatchError,
@@ -54,21 +54,6 @@ _MXFP8_SCALE_DTYPES = tuple(
)
-#: Where Comfy-Org publishes MOSS-Image's Qwen3.5 encoders: a `resolve`/`blob` URL of its `text_encoders/` folder at any
-#: revision, or the same file as a Hugging Face `repo_id[:variant]::subfolder` source. These files carry the vision
-#: tower, `lm_head.weight` and `mtp.*` -- the key set of the FLUX.3 prompt upsampler -- so only where they came from
-#: tells the two apart.
-_MOSS_IMAGE_ENCODER_SOURCE = re.compile(
- r"^(?:https?://[^/]+/Comfy-Org/MOSS-Image/(?:resolve|blob)/[^/?#]+/|Comfy-Org/MOSS-Image(?::[^:/]*)?::)"
- r"text_encoders/[^/?#]+\.safetensors(?:[?#].*)?$"
-)
-
-
-def is_moss_image_encoder_source(source: Any) -> bool:
- """Whether an install source is one of Comfy-Org's MOSS-Image text encoder files (a Qwen3.5 encoder, never a Text LLM)."""
- return isinstance(source, str) and _MOSS_IMAGE_ENCODER_SOURCE.match(source) is not None
-
-
def has_qwen3_5_linear_attention(state_dict: dict[str | int, Any]) -> bool:
"""True if the state dict holds Gated DeltaNet (`linear_attn`) layers -- Qwen3.5, never Qwen3."""
return any(isinstance(key, str) and ".linear_attn." in key for key in state_dict)
@@ -98,10 +83,9 @@ def is_qwen3_5_vision_language_lm(state_dict: dict[str | int, Any]) -> bool:
"""Whether this is a whole `Qwen3_5ForConditionalGeneration` that loads as a Text LLM.
Language model, vision tower and LM head under transformers' names, at a size with a vendored config: the
- FLUX.3 prompt upsampler's single files, which are `TextLLM_Checkpoint_Config`'s. The weights alone cannot tell
- them from Comfy-Org's MOSS-Image encoders, which carry the same tensors (tower, `lm_head`, `mtp.*`);
- `is_moss_image_encoder_source` does that, by where the file came from. Anything else stays the encoder config's,
- LM head or not: a 4B with its tower, which Anima-3.8B can read, or a text-only export.
+ FLUX.3 prompt upsampler's single files. Comfy-Org's MOSS-Image encoders carry the same tensors (tower, `lm_head`,
+ `mtp.*`), so such a file serves both roles. Anything else stays the encoder config's, LM head or not: a 4B with
+ its tower, which Anima-3.8B can read, or a text-only export.
"""
return (
qwen3_5_key_prefix(state_dict) == QWEN3_5_VL_LANGUAGE_MODEL_PREFIX
@@ -111,6 +95,14 @@ def is_qwen3_5_vision_language_lm(state_dict: dict[str | int, Any]) -> bool:
)
+def is_text_llm_qwen3_5_file(path: Path, state_dict: dict[str | int, Any]) -> bool:
+ """Whether `TextLLM_Checkpoint_Config` accepts this file, and so whether it serves as a Text LLM.
+
+ One predicate for both configs, so the Text LLM and encoder identifications cannot drift apart.
+ """
+ return path.suffix.lower() == ".safetensors" and is_qwen3_5_vision_language_lm(state_dict)
+
+
def _raise_if_not_whole(state_dict: dict[str | int, Any], prefix: str, variant: Qwen35VariantType) -> None:
"""Refuse a checkpoint that lacks decoder layers or the final norm of a variant read after that norm.
@@ -207,14 +199,13 @@ class Qwen35Encoder_Checkpoint_Config(Checkpoint_Config_Base, Config_Base):
prefix = qwen3_5_key_prefix(state_dict)
if prefix is None:
raise NotAMatchError("state dict does not look like a Qwen3.5 language model (no linear_attn layer 0)")
- # The FLUX.3 prompt upsampler is a TextLLM. An explicit type, or Comfy-Org's MOSS-Image encoder source, still
- # installs a file of its layout here.
- if (
- override_fields.get("type") != ModelType.Qwen35Encoder
- and not is_moss_image_encoder_source(override_fields.get("source"))
- and is_qwen3_5_vision_language_lm(state_dict)
- ):
- raise NotAMatchError("state dict is a whole Qwen3.5 vision-language model with an LM head: a TextLLM")
+ # A whole vision-language model is a Text LLM that also serves as this encoder. Only an explicit type files
+ # it here, with the Text LLM role.
+ if is_qwen3_5_vision_language_lm(state_dict) and override_fields.get("type") != ModelType.Qwen35Encoder:
+ raise NotAMatchError(
+ "state dict is a whole Qwen3.5 vision-language model with an LM head: a TextLLM, which also serves "
+ "as a Qwen3.5 encoder"
+ )
if any(isinstance(v, GGMLTensor) for v in state_dict.values()):
raise NotAMatchError("state dict looks like GGUF quantized")
raise_for_unsupported_qwen3_5_quantization(mod, state_dict)
@@ -224,4 +215,6 @@ class Qwen35Encoder_Checkpoint_Config(Checkpoint_Config_Base, Config_Base):
raise NotAMatchError("hidden size does not match a known Qwen3.5 variant")
if variant in QWEN3_5_FINAL_NORM_VARIANTS:
_raise_if_not_whole(state_dict, prefix, Qwen35VariantType(variant))
- return cls(**override_fields, variant=variant)
+ text_llm_file = is_text_llm_qwen3_5_file(mod.path, state_dict)
+ roles = [ModelRole(type=ModelType.TextLLM)] if text_llm_file else []
+ return cls(**override_fields, variant=variant, roles=roles)
diff --git a/invokeai/backend/model_manager/configs/qwen3_encoder.py b/invokeai/backend/model_manager/configs/qwen3_encoder.py
index ed1ac5f89b..740308ae14 100644
--- a/invokeai/backend/model_manager/configs/qwen3_encoder.py
+++ b/invokeai/backend/model_manager/configs/qwen3_encoder.py
@@ -109,7 +109,7 @@ def _folder_tensor_names(mod: ModelOnDisk) -> set[str]:
return names
-def _folder_is_sdnq_quantized(mod: ModelOnDisk) -> bool:
+def folder_is_sdnq_quantized(mod: ModelOnDisk) -> bool:
"""True if the Qwen3 encoder folder at `mod.path` holds SDNQ-quantized weights.
`Qwen3Encoder_Qwen3Encoder_Config` and `Qwen3Encoder_SDNQ_Folder_Config` must be mutually
@@ -209,6 +209,18 @@ def _has_qwen3_5_layers(tensor_names: Iterable[str | int]) -> bool:
return any(isinstance(key, str) and (".linear_attn." in key or ".ssm_" in key) for key in tensor_names)
+_QWEN3_HIDDEN_SIZES = {
+ 1024: Qwen3VariantType.Qwen3_06B,
+ 2560: Qwen3VariantType.Qwen3_4B,
+ 4096: Qwen3VariantType.Qwen3_8B,
+}
+
+
+def qwen3_variant_from_hidden_size(hidden_size: Any) -> Optional[Qwen3VariantType]:
+ """The Qwen3 variant of a hidden size, or None for a size no Qwen3 encoder comes in."""
+ return _QWEN3_HIDDEN_SIZES.get(hidden_size) if isinstance(hidden_size, int) else None
+
+
def _get_qwen3_variant_from_state_dict(state_dict: dict[str | int, Any]) -> Optional[Qwen3VariantType]:
"""Determine Qwen3 variant (0.6B, 4B, or 8B) from state dict based on hidden_size.
@@ -220,11 +232,6 @@ def _get_qwen3_variant_from_state_dict(state_dict: dict[str | int, Any]) -> Opti
For GGUF format, the key is 'token_embd.weight'.
For PyTorch format, the key is 'model.embed_tokens.weight'.
"""
- # Hidden size thresholds
- QWEN3_06B_HIDDEN_SIZE = 1024
- QWEN3_4B_HIDDEN_SIZE = 2560
- QWEN3_8B_HIDDEN_SIZE = 4096
-
# Try to find embed_tokens weight
embed_key = None
for key in state_dict.keys():
@@ -255,16 +262,9 @@ def _get_qwen3_variant_from_state_dict(state_dict: dict[str | int, Any]) -> Opti
else:
return None
- # Determine variant based on hidden_size. Unknown sizes mean this is NOT a
- # recognized Qwen3 variant (could be another causal LM in GGUF format such as
+ # Unknown sizes mean this is NOT a recognized Qwen3 variant (could be another causal LM in GGUF format such as
# Mistral or Llama, which use identical llama.cpp key naming).
- if hidden_size == QWEN3_06B_HIDDEN_SIZE:
- return Qwen3VariantType.Qwen3_06B
- elif hidden_size == QWEN3_4B_HIDDEN_SIZE:
- return Qwen3VariantType.Qwen3_4B
- elif hidden_size == QWEN3_8B_HIDDEN_SIZE:
- return Qwen3VariantType.Qwen3_8B
- return None
+ return qwen3_variant_from_hidden_size(hidden_size)
class Qwen3Encoder_Checkpoint_Config(Checkpoint_Config_Base, Config_Base):
@@ -396,6 +396,7 @@ class Qwen3Encoder_Qwen3Encoder_Config(Config_Base):
# root next to config.json, this is a complete causal LM (TextLLM), not a Qwen3 encoder subfolder.
tokenizer_files = ("tokenizer.json", "tokenizer.model", "tokenizer_config.json")
if any((mod.path / f).exists() for f in tokenizer_files):
+ # Such a folder installs as a Text LLM that also serves as a Qwen3 encoder (see text_llm.py).
raise NotAMatchError(
"directory looks like a complete causal LM (config.json and tokenizer files at root), "
"not a standalone Qwen3 encoder"
@@ -425,16 +426,12 @@ class Qwen3Encoder_Qwen3Encoder_Config(Config_Base):
def _reject_if_sdnq_quantized(cls, mod: ModelOnDisk) -> None:
# Shared with Qwen3Encoder_SDNQ_Folder_Config so the two configs cannot both reject (or both
# accept) the same folder.
- if _folder_is_sdnq_quantized(mod):
+ if folder_is_sdnq_quantized(mod):
raise NotAMatchError("folder is SDNQ-quantized; use Qwen3Encoder_SDNQ_Folder_Config")
@classmethod
def _get_variant_from_config(cls, config_path) -> Qwen3VariantType:
"""Get variant from config.json based on hidden_size, or raise NotAMatch if unknown."""
- QWEN3_06B_HIDDEN_SIZE = 1024
- QWEN3_4B_HIDDEN_SIZE = 2560
- QWEN3_8B_HIDDEN_SIZE = 4096
-
try:
with open(config_path, "r", encoding="utf-8") as f:
config = json.load(f)
@@ -442,13 +439,10 @@ class Qwen3Encoder_Qwen3Encoder_Config(Config_Base):
raise NotAMatchError(f"unable to read Qwen3 config.json: {e}") from e
hidden_size = config.get("hidden_size")
- if hidden_size == QWEN3_8B_HIDDEN_SIZE:
- return Qwen3VariantType.Qwen3_8B
- elif hidden_size == QWEN3_4B_HIDDEN_SIZE:
- return Qwen3VariantType.Qwen3_4B
- elif hidden_size == QWEN3_06B_HIDDEN_SIZE:
- return Qwen3VariantType.Qwen3_06B
- raise NotAMatchError(f"hidden_size {hidden_size} does not match a known Qwen3 variant")
+ variant = qwen3_variant_from_hidden_size(hidden_size)
+ if variant is None:
+ raise NotAMatchError(f"hidden_size {hidden_size} does not match a known Qwen3 variant")
+ return variant
# The llama.cpp architecture `Qwen3EncoderGGUFLoader` builds a `Qwen3ForCausalLM` for. Exact on purpose: the MoE
@@ -644,7 +638,7 @@ class Qwen3Encoder_SDNQ_Folder_Config(Config_Base):
# Shared with the rejection guard in Qwen3Encoder_Qwen3Encoder_Config: exactly one of the two
# configs claims a given folder. A corrupt or foreign quantization_config.json falls through
# to the key check there instead of aborting this probe with a JSONDecodeError.
- if not _folder_is_sdnq_quantized(mod):
+ if not folder_is_sdnq_quantized(mod):
raise NotAMatchError("directory does not look like an SDNQ-quantized Qwen3 encoder")
# A root config.json next to tokenizer files is a complete causal LM (TextLLM), not a Qwen3
diff --git a/invokeai/backend/model_manager/configs/roles.py b/invokeai/backend/model_manager/configs/roles.py
new file mode 100644
index 0000000000..77d31474a9
--- /dev/null
+++ b/invokeai/backend/model_manager/configs/roles.py
@@ -0,0 +1,63 @@
+"""Model roles: the other model types a record's files serve as.
+
+A record is filed under one primary `type`. Identification adds `roles` for the other `(type, format, variant)` its
+files load as, so a consumer asks `serves_as` instead of requiring one type. A loader that needs the role's config
+class gets `view_as`.
+"""
+
+from pydantic import ValidationError
+
+from invokeai.backend.model_manager.configs.base import ModelRole
+from invokeai.backend.model_manager.configs.factory import AnyModelConfig, ModelConfigFactory
+from invokeai.backend.model_manager.taxonomy import AnyVariant, ModelType
+
+
+class ModelRoleError(ValueError):
+ """A model asked for in a role it does not serve."""
+
+
+def serves_as(config: AnyModelConfig, model_type: ModelType) -> bool:
+ """Whether the model is of this type, as filed or by one of its roles."""
+ return config.type == model_type or any(role.type == model_type for role in config.roles)
+
+
+def role_variant(config: AnyModelConfig, model_type: ModelType) -> AnyVariant | None:
+ """The variant the model serves `model_type` in, or None if it has none or does not serve it."""
+ if config.type == model_type:
+ return getattr(config, "variant", None)
+ return next((role.variant for role in config.roles if role.type == model_type), None)
+
+
+def view_as(config: AnyModelConfig, model_type: ModelType) -> AnyModelConfig:
+ """The config of the model in the role `model_type`: an instance of that role's config class, same files.
+
+ The record's own config when it is already filed under `model_type`. The view is not stored; it lists the record's
+ primary type among its roles and `role_of` names that type.
+ """
+ if config.type == model_type:
+ return config
+ role = next((r for r in config.roles if r.type == model_type), None)
+ if role is None:
+ raise ModelRoleError(f"model '{config.name}' is a {config.type.value} and does not serve as {model_type.value}")
+
+ fields = config.model_dump()
+ fields.pop("variant", None)
+ fields["type"] = role.type
+ fields["format"] = role.format or config.format
+ if role.variant is not None:
+ fields["variant"] = role.variant
+ fields["roles"] = [r for r in config.roles if r.type != model_type] + [
+ ModelRole(
+ type=config.type,
+ format=config.format if config.format != fields["format"] else None,
+ variant=getattr(config, "variant", None),
+ )
+ ]
+ try:
+ view = ModelConfigFactory.from_dict(fields)
+ except ValidationError as error:
+ raise ModelRoleError(
+ f"model '{config.name}' cannot be read as {model_type.value}: its role is incomplete; re-identify it"
+ ) from error
+ view._role_of = config.type
+ return view
diff --git a/invokeai/backend/model_manager/configs/text_llm.py b/invokeai/backend/model_manager/configs/text_llm.py
index edf3a94384..3d1e4b99b5 100644
--- a/invokeai/backend/model_manager/configs/text_llm.py
+++ b/invokeai/backend/model_manager/configs/text_llm.py
@@ -6,7 +6,12 @@ from typing import (
from pydantic import Field
from typing_extensions import Any
-from invokeai.backend.model_manager.configs.base import Checkpoint_Config_Base, Config_Base, Diffusers_Config_Base
+from invokeai.backend.model_manager.configs.base import (
+ Checkpoint_Config_Base,
+ Config_Base,
+ Diffusers_Config_Base,
+ ModelRole,
+)
from invokeai.backend.model_manager.configs.gemma4_encoder import is_ltx2_gemma4_encoder_folder
from invokeai.backend.model_manager.configs.identification_utils import (
NotAMatchError,
@@ -18,16 +23,21 @@ from invokeai.backend.model_manager.configs.identification_utils import (
raise_if_not_file,
)
from invokeai.backend.model_manager.configs.qwen3_5_encoder import (
- is_moss_image_encoder_source,
- is_qwen3_5_vision_language_lm,
+ get_qwen3_5_variant,
+ is_text_llm_qwen3_5_file,
raise_for_unsupported_qwen3_5_quantization,
)
+from invokeai.backend.model_manager.configs.qwen3_encoder import (
+ folder_is_sdnq_quantized,
+ qwen3_variant_from_hidden_size,
+)
from invokeai.backend.model_manager.model_on_disk import ModelOnDisk
from invokeai.backend.model_manager.taxonomy import (
BaseModelType,
ModelFormat,
ModelType,
)
+from invokeai.backend.qwen3_5.qwen3_5_vl import QWEN3_5_VL_LANGUAGE_MODEL_PREFIX
# Gemma-2-2b's hidden size. Only this size is handled by the dedicated PiD Gemma2 encoder config; larger
# Gemma 2 variants (9B=3584, 27B=4608) are rejected there and must stay classifiable as a generic TextLLM.
@@ -49,6 +59,22 @@ _SUPPORTS_IMAGES_DESCRIPTION = (
)
+def _qwen3_encoder_roles(mod: ModelOnDisk, config_dict: dict[str, Any], class_name: str) -> list[ModelRole]:
+ """The Qwen3 encoder role of a complete Qwen3 causal-LM folder.
+
+ `Qwen3EncoderLoader` reads the standalone layout: config.json at the folder root, unquantized. Qwen2, Qwen-VL and
+ quantized folders, and sizes no Qwen3 encoder comes in, serve no such role.
+ """
+ if class_name != "Qwen3ForCausalLM" or not (mod.path / "config.json").is_file():
+ return []
+ if "quantization_config" in config_dict or folder_is_sdnq_quantized(mod):
+ return []
+ variant = qwen3_variant_from_hidden_size(config_dict.get("hidden_size"))
+ if variant is None:
+ return []
+ return [ModelRole(type=ModelType.Qwen3Encoder, format=ModelFormat.Qwen3Encoder, variant=variant)]
+
+
class TextLLM_Diffusers_Config(Diffusers_Config_Base, Config_Base):
"""Model config for a language model folder: a causal LM (Llama, Phi, Qwen, Mistral, ...) or an allow-listed
vision-language model (Gemma-4, Qwen3.5)."""
@@ -109,7 +135,9 @@ class TextLLM_Diffusers_Config(Diffusers_Config_Base, Config_Base):
and "vision_config" in config_dict
and any((mod.path / f).exists() for f in _PROCESSOR_CONFIG_FILES)
)
- return cls(**override_fields, supports_images=supports_images)
+ return cls(
+ **override_fields, supports_images=supports_images, roles=_qwen3_encoder_roles(mod, config_dict, class_name)
+ )
class TextLLM_Checkpoint_Config(Checkpoint_Config_Base, Config_Base):
@@ -118,8 +146,8 @@ class TextLLM_Checkpoint_Config(Checkpoint_Config_Base, Config_Base):
The layout is transformers' own `Qwen3_5ForConditionalGeneration` state dict, as ComfyUI exports the FLUX.3
prompt upsampler (bf16, or `int8_tensorwise` with a multi-token-prediction head the loader drops). The file
carries weights only; the loader supplies config, tokenizer and processor from the vendored Qwen3.5 assets,
- which exist for the 9B. Comfy-Org's MOSS-Image encoders have the same tensors and are
- `Qwen35Encoder_Checkpoint_Config`'s; they are told apart by their install source.
+ which exist for the 9B. The same file is Comfy-Org's MOSS-Image text encoder, so it also serves as a Qwen3.5
+ encoder (role).
"""
type: Literal[ModelType.TextLLM] = Field(default=ModelType.TextLLM)
@@ -137,16 +165,12 @@ class TextLLM_Checkpoint_Config(Checkpoint_Config_Base, Config_Base):
raise_for_override_fields(cls, override_fields)
- if override_fields.get("type") != ModelType.TextLLM and is_moss_image_encoder_source(
- override_fields.get("source")
- ):
- raise NotAMatchError("Comfy-Org's MOSS-Image text encoders are Qwen3.5 encoders, not Text LLMs")
-
state_dict = mod.load_state_dict()
- if not is_qwen3_5_vision_language_lm(state_dict):
+ if not is_text_llm_qwen3_5_file(mod.path, state_dict):
raise NotAMatchError(
"state dict is not a whole Qwen3.5 vision-language model (model.language_model.*, model.visual.*, "
"lm_head) of a size with a vendored config"
)
raise_for_unsupported_qwen3_5_quantization(mod, state_dict)
- return cls(**override_fields)
+ variant = get_qwen3_5_variant(state_dict, QWEN3_5_VL_LANGUAGE_MODEL_PREFIX)
+ return cls(**override_fields, roles=[ModelRole(type=ModelType.Qwen35Encoder, variant=variant)])
diff --git a/invokeai/backend/model_manager/load/load_default.py b/invokeai/backend/model_manager/load/load_default.py
index d8f07fb113..89c15e7d00 100644
--- a/invokeai/backend/model_manager/load/load_default.py
+++ b/invokeai/backend/model_manager/load/load_default.py
@@ -357,7 +357,8 @@ class ModelLoader(ModelLoaderBase):
Device caches share one canonical CPU copy per key, which a second device adopts instead of rerunning the
loader. A loader whose stored format depends on the device (float8 where supported, the dtype it computes in)
- returns the format here, so only devices that build the same weights share a copy. Empty by default.
+ returns the format here, so only devices that build the same weights share a copy. Empty by default. Appended after
+ the role suffix (`:as_<type>`, see `_load_and_cache`).
"""
return ""
@@ -376,6 +377,10 @@ class ModelLoader(ModelLoaderBase):
"""
stats_name = ":".join([config.base, config.type, config.name, (submodel_type or "")])
cache_key = get_model_cache_key(config.key, submodel_type)
+ if getattr(config, "role_of", None) is not None:
+ # A role view loads the record's files through another config class and loader, so it is its own entry.
+ # The "<key>:" prefix stays, so dropping or offloading the record still covers it.
+ cache_key = f"{cache_key}:as_{config.type.value}"
variant = self._cache_key_variant(config, submodel_type)
if variant:
cache_key = f"{cache_key}:{variant}"
diff --git a/invokeai/backend/model_manager/load/model_cache/model_cache.py b/invokeai/backend/model_manager/load/model_cache/model_cache.py
index b71337e45c..03ffb3d54e 100644
--- a/invokeai/backend/model_manager/load/model_cache/model_cache.py
+++ b/invokeai/backend/model_manager/load/model_cache/model_cache.py
@@ -1223,8 +1223,8 @@ class ModelCache:
Used by the session queue's device-affinity heuristic to prefer pending items whose
models are already warm on the claiming device. Two properties matter to that caller:
- - Entries keyed by `get_model_cache_key` (model key plus optional ``:submodel`` suffix)
- are reported with the suffix stripped so they match plain model keys. Entries keyed by
+ - Entries keyed by `get_model_cache_key` (model key plus optional ``:submodel`` and
+ ``:as_<type>`` role suffixes) are reported with the suffixes stripped so they match plain model keys. Entries keyed by
filesystem path (`load_model_from_path`) are excluded: a path - or the bare Windows
drive letter that splitting ``C:\\...`` on ``:`` would leave - is not a model key, and
such short strings would corrupt substring-based affinity scoring.
@@ -3081,8 +3081,9 @@ class ModelCache:
def drop_model(self, model_key: str) -> int:
"""Drop all cache entries belonging to a model so the next load rebuilds them.
- Cache keys are `<model_key>` or `<model_key>:<submodel>` (see `get_model_cache_key`),
- so a single model may have multiple entries. Locked entries - and entries inside a
+ Cache keys are `<model_key>` or `<model_key>:<submodel>` (see `get_model_cache_key`), plus
+ `:as_<type>` for a role view of the record (see `ModelLoader._load_and_cache`), so a single model may have
+ multiple entries. Locked entries - and entries inside a
first-use window (a LoadedModel wrapper obtained but not yet locked) - are marked
`is_stale` and evicted as soon as the last lock (or the window) releases - without that,
a setting toggled during an in-flight generation would survive on the locked entry and quietly
diff --git a/invokeai/backend/model_manager/load/model_loaders/qwen3_5_encoder.py b/invokeai/backend/model_manager/load/model_loaders/qwen3_5_encoder.py
index e7b43b20aa..65be2e6322 100644
--- a/invokeai/backend/model_manager/load/model_loaders/qwen3_5_encoder.py
+++ b/invokeai/backend/model_manager/load/model_loaders/qwen3_5_encoder.py
@@ -175,6 +175,14 @@ def load_qwen3_5_text_encoder(
class Qwen35EncoderCheckpointLoader(ModelLoader):
"""Loads a single-file Qwen3.5 text encoder and the vendored Qwen3.5 tokenizer."""
+ def get_size_fs(
+ self, config: AnyModelConfig, model_path: Path, submodel_type: Optional[SubModelType] = None
+ ) -> int:
+ # A few small tokenizer files, or the vendored one: the generic sizing would charge the whole model.
+ if submodel_type is SubModelType.Tokenizer:
+ return 0
+ return super().get_size_fs(config, model_path, submodel_type)
+
def _load_model(self, config: AnyModelConfig, submodel_type: Optional[SubModelType] = None) -> AnyModel:
if not isinstance(config, Qwen35Encoder_Checkpoint_Config):
raise ValueError("Only Qwen35Encoder_Checkpoint_Config models are supported here.")
diff --git a/invokeai/backend/model_manager/load/model_loaders/z_image.py b/invokeai/backend/model_manager/load/model_loaders/z_image.py
index 8ab8c97b19..7f71447988 100644
--- a/invokeai/backend/model_manager/load/model_loaders/z_image.py
+++ b/invokeai/backend/model_manager/load/model_loaders/z_image.py
@@ -966,6 +966,14 @@ class ZImageSDNQCheckpointModel(ModelLoader):
class Qwen3EncoderLoader(ModelLoader):
"""Class to load standalone Qwen3 Encoder models for Z-Image (directory format)."""
+ def get_size_fs(
+ self, config: AnyModelConfig, model_path: Path, submodel_type: Optional[SubModelType] = None
+ ) -> int:
+ # A few small tokenizer files, or the vendored one: the generic sizing would charge the whole model.
+ if submodel_type is SubModelType.Tokenizer:
+ return 0
+ return super().get_size_fs(config, model_path, submodel_type)
+
def _load_model(
self,
config: AnyModelConfig,
diff --git a/invokeai/backend/model_manager/starter_models/moss_image.py b/invokeai/backend/model_manager/starter_models/moss_image.py
index b4971ef6a8..4ee8f17623 100644
--- a/invokeai/backend/model_manager/starter_models/moss_image.py
+++ b/invokeai/backend/model_manager/starter_models/moss_image.py
@@ -47,10 +47,9 @@ moss_image_prompt_enhancer = StarterModel(
type=ModelType.TextLLM,
)
-# The file has the key set of the FLUX.3 prompt upsampler (a Text LLM), so only its source tells identification what it
-# is (`is_moss_image_encoder_source`); the starter names the type as well. Pinned to the Comfy repository commit the
-# int8 layout was checked against: the file's `comfy_quant` markers drive the decode, so a re-upload at the same path
-# could change how it loads, and the pinned URL still matches the source check.
+# The file has the key set of the FLUX.3 prompt upsampler, so the starter names its type (the file also serves as a
+# Text LLM). Pinned to the Comfy repository commit the int8 layout was checked against: the file's `comfy_quant`
+# markers drive the decode, so a re-upload at the same path could change how it loads.
moss_image_qwen3_5_encoder_int8 = StarterModel(
name="Qwen3.5 9B Encoder (int8)",
base=BaseModelType.Any,
@@ -59,7 +58,7 @@ moss_image_qwen3_5_encoder_int8 = StarterModel(
description=(
"ComfyUI's int8 build of the Qwen3.5-9B text encoder that MOSS-Image reads, about half the size of the bf16 "
"encoder. Select it as the Qwen3.5 encoder of a MOSS-Image model. The file also holds a vision tower and an LM "
- "head, which are not loaded. Apache-2.0. ~9.8GB"
+ "head, which are not loaded. Also usable as a Text LLM in Expand Prompt. Apache-2.0. ~9.8GB"
),
type=ModelType.Qwen35Encoder,
format=ModelFormat.Checkpoint,
diff --git a/invokeai/frontend/api/openapi.json b/invokeai/frontend/api/openapi.json
index bb04058ca0..fb68442724 100644
--- a/invokeai/frontend/api/openapi.json
+++ b/invokeai/frontend/api/openapi.json
@@ -25013,6 +25013,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -25075,6 +25083,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"base",
"type",
@@ -25168,6 +25177,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -25230,6 +25247,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"base",
"type",
@@ -25323,6 +25341,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"format": {
"type": "string",
"const": "diffusers",
@@ -25377,6 +25403,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"format",
"repo_variant",
"base",
@@ -25470,6 +25497,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"format": {
"type": "string",
"const": "diffusers",
@@ -25524,6 +25559,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"format",
"repo_variant",
"base",
@@ -25774,6 +25810,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"format": {
"type": "string",
"const": "diffusers",
@@ -25822,6 +25866,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"format",
"repo_variant",
"base",
@@ -29391,6 +29436,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"default_settings": {
"anyOf": [
{
@@ -29448,6 +29501,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"default_settings",
"base",
"type",
@@ -29836,6 +29890,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -29902,6 +29964,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"type",
"format",
@@ -29996,6 +30059,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -30050,6 +30121,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"type",
"format",
@@ -30142,6 +30214,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -30196,6 +30276,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"type",
"format",
@@ -30289,6 +30370,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -30350,6 +30439,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"type",
"format",
@@ -30444,6 +30534,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -30498,6 +30596,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"type",
"format",
@@ -30590,6 +30689,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -30644,6 +30751,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"type",
"format",
@@ -30736,6 +30844,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -30790,6 +30906,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"type",
"format",
@@ -30882,6 +30999,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -30936,6 +31061,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"type",
"format",
@@ -31029,6 +31155,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"format": {
"type": "string",
"const": "diffusers",
@@ -31075,6 +31209,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"format",
"repo_variant",
"type",
@@ -31167,6 +31302,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"format": {
"type": "string",
"const": "diffusers",
@@ -31213,6 +31356,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"format",
"repo_variant",
"type",
@@ -31305,6 +31449,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"format": {
"type": "string",
"const": "diffusers",
@@ -31351,6 +31503,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"format",
"repo_variant",
"type",
@@ -31443,6 +31596,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"format": {
"type": "string",
"const": "diffusers",
@@ -31489,6 +31650,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"format",
"repo_variant",
"type",
@@ -36846,6 +37008,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"base": {
"type": "string",
"const": "external",
@@ -36934,6 +37104,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"base",
"type",
"format",
@@ -37840,6 +38011,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "flux_redux",
@@ -37872,6 +38051,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"format",
"base"
@@ -46975,6 +47155,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"base": {
"type": "string",
"const": "any",
@@ -47019,6 +47207,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"base",
"type",
"format",
@@ -47111,6 +47300,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"base": {
"type": "string",
"const": "any",
@@ -47155,6 +47352,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"base",
"type",
"format",
@@ -47247,6 +47445,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -47303,6 +47509,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"base",
"type",
@@ -47396,6 +47603,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"base": {
"type": "string",
"const": "ltx-2",
@@ -47451,6 +47666,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"base",
"type",
"format",
@@ -50463,6 +50679,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "ip_adapter",
@@ -50495,6 +50719,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"format",
"base"
@@ -50585,6 +50810,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "ip_adapter",
@@ -50617,6 +50850,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"format",
"base"
@@ -50707,6 +50941,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "ip_adapter",
@@ -50739,6 +50981,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"format",
"base"
@@ -50829,6 +51072,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "ip_adapter",
@@ -50861,6 +51112,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"format",
"base"
@@ -50951,6 +51203,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "ip_adapter",
@@ -50983,6 +51243,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"format",
"base"
@@ -51073,6 +51334,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "ip_adapter",
@@ -51109,6 +51378,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"format",
"image_encoder_model_id",
@@ -51200,6 +51470,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "ip_adapter",
@@ -51236,6 +51514,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"format",
"image_encoder_model_id",
@@ -51327,6 +51606,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "ip_adapter",
@@ -51363,6 +51650,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"format",
"image_encoder_model_id",
@@ -69940,6 +70228,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "ltx2_duration_head",
@@ -69972,6 +70268,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"format",
"base"
@@ -72864,6 +73161,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"format": {
"type": "string",
"const": "diffusers",
@@ -72912,6 +73217,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"format",
"repo_variant",
"type",
@@ -73426,6 +73732,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "lora",
@@ -73485,6 +73799,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -73577,6 +73892,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "lora",
@@ -73646,6 +73969,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -73740,6 +74064,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "lora",
@@ -73799,6 +74131,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -73892,6 +74225,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "lora",
@@ -73951,6 +74292,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -74044,6 +74386,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "lora",
@@ -74103,6 +74453,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -74196,6 +74547,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "lora",
@@ -74255,6 +74614,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -74347,6 +74707,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "lora",
@@ -74406,6 +74774,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -74498,6 +74867,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "lora",
@@ -74567,6 +74944,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -74661,6 +75039,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "lora",
@@ -74720,6 +75106,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -74812,6 +75199,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "lora",
@@ -74881,6 +75276,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -74975,6 +75371,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "lora",
@@ -75034,6 +75438,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -75127,6 +75532,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "lora",
@@ -75186,6 +75599,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -75279,6 +75693,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "lora",
@@ -75338,6 +75760,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -75430,6 +75853,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "lora",
@@ -75499,6 +75930,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -75593,6 +76025,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "lora",
@@ -75652,6 +76092,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -75745,6 +76186,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "lora",
@@ -75804,6 +76253,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -75897,6 +76347,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "lora",
@@ -75956,6 +76414,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -76049,6 +76508,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "lora",
@@ -76108,6 +76575,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -76201,6 +76669,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "lora",
@@ -76260,6 +76736,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -76353,6 +76830,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "lora",
@@ -76412,6 +76897,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -76505,6 +76991,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "lora",
@@ -76564,6 +77058,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -76657,6 +77152,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "lora",
@@ -76716,6 +77219,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -76809,6 +77313,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "lora",
@@ -76868,6 +77380,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -76960,6 +77473,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "lora",
@@ -77019,6 +77540,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -77111,6 +77633,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "lora",
@@ -77180,6 +77710,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -77274,6 +77805,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "lora",
@@ -77333,6 +77872,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -77425,6 +77965,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "lora",
@@ -77508,6 +78056,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -77603,6 +78152,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "lora",
@@ -77672,6 +78229,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -77766,6 +78324,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "lora",
@@ -77825,6 +78391,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -77917,6 +78484,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "lora",
@@ -77976,6 +78551,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -78743,6 +79319,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -78817,6 +79401,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -78912,6 +79497,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -78987,6 +79580,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -79082,6 +79676,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -79153,6 +79755,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -79247,6 +79850,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -79321,6 +79932,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -79416,6 +80028,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -79490,6 +80110,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -79585,6 +80206,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -79659,6 +80288,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -79754,6 +80384,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -79831,6 +80469,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -79926,6 +80565,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -80000,6 +80647,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -80095,6 +80743,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -80174,6 +80830,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -80270,6 +80927,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -80349,6 +81014,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -80445,6 +81111,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -80516,6 +81190,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -80610,6 +81285,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -80684,6 +81367,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -80779,6 +81463,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -80860,6 +81552,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -80955,6 +81648,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -81032,6 +81733,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -81127,6 +81829,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -81204,6 +81914,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -81299,6 +82010,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -81376,6 +82095,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -81471,6 +82191,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -81548,6 +82276,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -81643,6 +82372,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -81724,6 +82461,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -81820,6 +82558,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -81894,6 +82640,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -81989,6 +82736,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -82052,6 +82807,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -82145,6 +82901,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -82208,6 +82972,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -82302,6 +83067,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -82368,6 +83141,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -82463,6 +83237,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -82529,6 +83311,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -82624,6 +83407,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -82690,6 +83481,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -82785,6 +83577,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -82848,6 +83648,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -82942,166 +83743,183 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
- "type": {
- "type": "string",
- "const": "main",
- "title": "Type",
- "default": "main"
- },
- "trigger_phrases": {
- "anyOf": [
- {
- "items": {
- "type": "string"
- },
- "type": "array",
- "uniqueItems": true
- },
- {
- "type": "null"
- }
- ],
- "title": "Trigger Phrases",
- "description": "Set of trigger phrases for this model"
- },
- "default_settings": {
- "anyOf": [
- {
- "$ref": "#/components/schemas/MainModelDefaultSettings"
- },
- {
- "type": "null"
- }
- ],
- "description": "Default settings for this model"
- },
- "format": {
- "type": "string",
- "const": "diffusers",
- "title": "Format",
- "default": "diffusers"
- },
- "repo_variant": {
- "$ref": "#/components/schemas/ModelRepoVariant",
- "default": ""
- },
- "base": {
- "type": "string",
- "const": "krea-2",
- "title": "Base",
- "default": "krea-2"
- },
- "variant": {
- "$ref": "#/components/schemas/Krea2VariantType"
- }
- },
- "type": "object",
- "required": [
- "key",
- "hash",
- "path",
- "file_size",
- "name",
- "description",
- "source",
- "source_type",
- "source_api_response",
- "source_url",
- "cover_image",
- "type",
- "trigger_phrases",
- "default_settings",
- "format",
- "repo_variant",
- "base",
- "variant"
- ],
- "title": "Main_Diffusers_Krea2_Config",
- "description": "Model config for Krea-2 diffusers models (Krea-2-Turbo)."
- },
- "Main_Diffusers_LTX2_Config": {
- "properties": {
- "key": {
- "type": "string",
- "title": "Key",
- "description": "A unique key for this model."
- },
- "hash": {
- "type": "string",
- "title": "Hash",
- "description": "The hash of the model file(s)."
- },
- "path": {
- "type": "string",
- "title": "Path",
- "description": "Path to the model on the filesystem. Relative paths are relative to the Invoke root directory."
- },
- "file_size": {
- "type": "integer",
- "title": "File Size",
- "description": "The size of the model in bytes."
- },
- "name": {
- "type": "string",
- "title": "Name",
- "description": "Name of the model."
- },
- "description": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "title": "Description",
- "description": "Model description"
- },
- "source": {
- "type": "string",
- "title": "Source",
- "description": "The original source of the model (path, URL or repo_id)."
- },
- "source_type": {
- "$ref": "#/components/schemas/ModelSourceType",
- "description": "The type of source"
- },
- "source_api_response": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "title": "Source Api Response",
- "description": "The original API response from the source, as stringified JSON."
- },
- "source_url": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "title": "Source Url",
- "description": "Optional URL for the model (e.g. download page or model page)."
- },
- "cover_image": {
- "anyOf": [
- {
- "type": "string"
- },
- {
- "type": "null"
- }
- ],
- "title": "Cover Image",
- "description": "Url for image to preview model"
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
+ "type": {
+ "type": "string",
+ "const": "main",
+ "title": "Type",
+ "default": "main"
+ },
+ "trigger_phrases": {
+ "anyOf": [
+ {
+ "items": {
+ "type": "string"
+ },
+ "type": "array",
+ "uniqueItems": true
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Trigger Phrases",
+ "description": "Set of trigger phrases for this model"
+ },
+ "default_settings": {
+ "anyOf": [
+ {
+ "$ref": "#/components/schemas/MainModelDefaultSettings"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Default settings for this model"
+ },
+ "format": {
+ "type": "string",
+ "const": "diffusers",
+ "title": "Format",
+ "default": "diffusers"
+ },
+ "repo_variant": {
+ "$ref": "#/components/schemas/ModelRepoVariant",
+ "default": ""
+ },
+ "base": {
+ "type": "string",
+ "const": "krea-2",
+ "title": "Base",
+ "default": "krea-2"
+ },
+ "variant": {
+ "$ref": "#/components/schemas/Krea2VariantType"
+ }
+ },
+ "type": "object",
+ "required": [
+ "key",
+ "hash",
+ "path",
+ "file_size",
+ "name",
+ "description",
+ "source",
+ "source_type",
+ "source_api_response",
+ "source_url",
+ "cover_image",
+ "roles",
+ "type",
+ "trigger_phrases",
+ "default_settings",
+ "format",
+ "repo_variant",
+ "base",
+ "variant"
+ ],
+ "title": "Main_Diffusers_Krea2_Config",
+ "description": "Model config for Krea-2 diffusers models (Krea-2-Turbo)."
+ },
+ "Main_Diffusers_LTX2_Config": {
+ "properties": {
+ "key": {
+ "type": "string",
+ "title": "Key",
+ "description": "A unique key for this model."
+ },
+ "hash": {
+ "type": "string",
+ "title": "Hash",
+ "description": "The hash of the model file(s)."
+ },
+ "path": {
+ "type": "string",
+ "title": "Path",
+ "description": "Path to the model on the filesystem. Relative paths are relative to the Invoke root directory."
+ },
+ "file_size": {
+ "type": "integer",
+ "title": "File Size",
+ "description": "The size of the model in bytes."
+ },
+ "name": {
+ "type": "string",
+ "title": "Name",
+ "description": "Name of the model."
+ },
+ "description": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Description",
+ "description": "Model description"
+ },
+ "source": {
+ "type": "string",
+ "title": "Source",
+ "description": "The original source of the model (path, URL or repo_id)."
+ },
+ "source_type": {
+ "$ref": "#/components/schemas/ModelSourceType",
+ "description": "The type of source"
+ },
+ "source_api_response": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Source Api Response",
+ "description": "The original API response from the source, as stringified JSON."
+ },
+ "source_url": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Source Url",
+ "description": "Optional URL for the model (e.g. download page or model page)."
+ },
+ "cover_image": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Cover Image",
+ "description": "Url for image to preview model"
+ },
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
},
"type": {
"type": "string",
@@ -83188,6 +84006,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -83286,6 +84105,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -83358,6 +84185,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -83454,6 +84282,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -83517,6 +84353,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -83611,6 +84448,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -83677,6 +84522,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -83772,6 +84618,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -83845,6 +84699,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -83940,6 +84795,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -84009,6 +84872,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -84104,6 +84968,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -84173,6 +85045,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -84268,6 +85141,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -84359,6 +85240,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -84454,6 +85336,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -84523,6 +85413,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -84618,6 +85509,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -84687,6 +85586,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -84782,6 +85682,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -84866,6 +85774,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -84963,6 +85872,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -85029,6 +85946,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -85124,6 +86042,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -85199,6 +86125,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -85294,6 +86221,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -85365,6 +86300,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -85459,6 +86395,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -85533,6 +86477,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -85628,6 +86573,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -85702,6 +86655,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -85797,6 +86751,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -85871,6 +86833,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -85966,6 +86929,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -86043,6 +87014,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -86138,6 +87110,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -86212,6 +87192,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -86307,6 +87288,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -86386,6 +87375,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -86482,6 +87472,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -86553,6 +87551,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -86647,6 +87646,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -86721,6 +87728,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -86816,6 +87824,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -86897,6 +87913,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -86992,6 +88009,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -87073,6 +88098,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -87168,6 +88194,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -87249,6 +88283,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -87345,6 +88380,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -87419,6 +88462,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -87514,6 +88558,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -87598,6 +88650,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -87694,6 +88747,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -87778,6 +88839,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -87874,6 +88936,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -87958,6 +89028,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -88054,6 +89125,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -88128,6 +89207,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -88223,6 +89303,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -88297,6 +89385,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -88392,6 +89481,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "main",
@@ -88466,6 +89563,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"trigger_phrases",
"default_settings",
@@ -94439,6 +95537,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -94499,6 +95605,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"base",
"type",
@@ -94593,6 +95700,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"base": {
"type": "string",
"const": "any",
@@ -94641,6 +95756,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"base",
"type",
"format",
@@ -94734,6 +95850,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -94794,6 +95918,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"base",
"type",
@@ -94863,7 +95988,7 @@
},
"type": {
"$ref": "#/components/schemas/ModelType",
- "description": "The model's type"
+ "description": "The model's type, or a role it serves as (see its config's `roles`) when a node asks for it in that role"
},
"submodel_type": {
"anyOf": [
@@ -98323,6 +99448,97 @@
"title": "ModelRepoVariant",
"description": "Various hugging face variants on the diffusers format."
},
+ "ModelRole": {
+ "properties": {
+ "type": {
+ "$ref": "#/components/schemas/ModelType"
+ },
+ "format": {
+ "anyOf": [
+ {
+ "$ref": "#/components/schemas/ModelFormat"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "The format the model loads in for this role, when it differs from the record's format"
+ },
+ "variant": {
+ "anyOf": [
+ {
+ "$ref": "#/components/schemas/ModelVariantType"
+ },
+ {
+ "$ref": "#/components/schemas/ClipVariantType"
+ },
+ {
+ "$ref": "#/components/schemas/FluxVariantType"
+ },
+ {
+ "$ref": "#/components/schemas/Flux2VariantType"
+ },
+ {
+ "$ref": "#/components/schemas/Flux3VariantType"
+ },
+ {
+ "$ref": "#/components/schemas/ZImageVariantType"
+ },
+ {
+ "$ref": "#/components/schemas/QwenImageVariantType"
+ },
+ {
+ "$ref": "#/components/schemas/WanVariantType"
+ },
+ {
+ "$ref": "#/components/schemas/WanLoRAVariantType"
+ },
+ {
+ "$ref": "#/components/schemas/SD3VariantType"
+ },
+ {
+ "$ref": "#/components/schemas/Qwen3VariantType"
+ },
+ {
+ "$ref": "#/components/schemas/Qwen3VLVariantType"
+ },
+ {
+ "$ref": "#/components/schemas/Qwen35VariantType"
+ },
+ {
+ "$ref": "#/components/schemas/AnimaVariantType"
+ },
+ {
+ "$ref": "#/components/schemas/Krea2VariantType"
+ },
+ {
+ "$ref": "#/components/schemas/QwenImage21VariantType"
+ },
+ {
+ "$ref": "#/components/schemas/MiniMaxH3VariantType"
+ },
+ {
+ "$ref": "#/components/schemas/LTX2VariantType"
+ },
+ {
+ "$ref": "#/components/schemas/MistralVariantType"
+ },
+ {
+ "$ref": "#/components/schemas/PiDDecoderVariantType"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Variant",
+ "description": "The variant the model serves as in this role"
+ }
+ },
+ "type": "object",
+ "required": ["type", "format", "variant"],
+ "title": "ModelRole",
+ "description": "Another model type a model's files serve as, beside the type its record is filed under. Set by identification."
+ },
"ModelSourceType": {
"type": "string",
"enum": ["path", "url", "hf_repo_id", "external"],
@@ -101525,6 +102741,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -101573,6 +102797,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"type",
"format",
@@ -101666,6 +102891,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -101714,6 +102947,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"type",
"format",
@@ -101807,6 +103041,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -101855,6 +103097,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"type",
"format",
@@ -101948,6 +103191,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -101996,6 +103247,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"type",
"format",
@@ -102089,6 +103341,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -102137,6 +103397,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"type",
"format",
@@ -103825,6 +105086,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -103885,6 +105154,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"base",
"type",
@@ -104009,6 +105279,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -104069,6 +105347,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"base",
"type",
@@ -104163,6 +105442,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -104223,6 +105510,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"base",
"type",
@@ -104317,6 +105605,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"base": {
"type": "string",
"const": "any",
@@ -104365,6 +105661,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"base",
"type",
"format",
@@ -104458,6 +105755,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -104518,6 +105823,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"base",
"type",
@@ -104612,6 +105918,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"base": {
"type": "string",
"const": "any",
@@ -104660,6 +105974,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"base",
"type",
"format",
@@ -104789,6 +106104,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -104849,6 +106172,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"base",
"type",
@@ -104943,6 +106267,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -104999,6 +106331,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"base",
"type",
@@ -105092,6 +106425,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -105152,6 +106493,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"base",
"type",
@@ -105246,6 +106588,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"base": {
"type": "string",
"const": "any",
@@ -105294,6 +106644,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"base",
"type",
"format",
@@ -105393,6 +106744,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -105453,6 +106812,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"base",
"type",
@@ -108267,6 +109627,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -108311,6 +109679,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"base",
"type",
@@ -108403,6 +109772,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"base": {
"type": "string",
"const": "any",
@@ -108435,6 +109812,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"base",
"type",
"format"
@@ -108526,6 +109904,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -108570,6 +109956,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"base",
"type",
@@ -114293,6 +115680,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"format": {
"type": "string",
"const": "diffusers",
@@ -114341,6 +115736,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"format",
"repo_variant",
"type",
@@ -114700,6 +116096,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"base": {
"type": "string",
"const": "any",
@@ -114744,6 +116148,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"base",
"type",
"format",
@@ -117033,6 +118438,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"format": {
"type": "string",
"const": "diffusers",
@@ -117079,6 +118492,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"format",
"repo_variant",
"type",
@@ -117171,6 +118585,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"format": {
"type": "string",
"const": "diffusers",
@@ -117217,6 +118639,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"format",
"repo_variant",
"type",
@@ -117332,6 +118755,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"base": {
"type": "string",
"const": "any",
@@ -117376,6 +118807,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"base",
"type",
"format",
@@ -117468,6 +118900,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -117524,6 +118964,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"base",
"type",
@@ -117617,6 +119058,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -117673,6 +119122,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"base",
"type",
@@ -117766,6 +119216,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"base": {
"type": "string",
"const": "any",
@@ -117810,6 +119268,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"base",
"type",
"format",
@@ -117902,6 +119361,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"base": {
"type": "string",
"const": "any",
@@ -117946,6 +119413,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"base",
"type",
"format",
@@ -118061,6 +119529,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "embedding",
@@ -118093,6 +119569,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"format",
"base"
@@ -118183,6 +119660,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "embedding",
@@ -118215,6 +119700,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"format",
"base"
@@ -118305,6 +119791,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "embedding",
@@ -118337,6 +119831,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"format",
"base"
@@ -118427,6 +119922,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "embedding",
@@ -118459,6 +119962,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"format",
"base"
@@ -118549,6 +120053,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "embedding",
@@ -118581,6 +120093,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"format",
"base"
@@ -118671,6 +120184,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"type": {
"type": "string",
"const": "embedding",
@@ -118703,6 +120224,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"type",
"format",
"base"
@@ -119032,6 +120554,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -119094,6 +120624,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"type",
"format",
@@ -119102,7 +120633,7 @@
"supports_images"
],
"title": "TextLLM_Checkpoint_Config",
- "description": "Model config for a single-file Qwen3.5 vision-language model, run as a text LLM.\n\nThe layout is transformers' own `Qwen3_5ForConditionalGeneration` state dict, as ComfyUI exports the FLUX.3\nprompt upsampler (bf16, or `int8_tensorwise` with a multi-token-prediction head the loader drops). The file\ncarries weights only; the loader supplies config, tokenizer and processor from the vendored Qwen3.5 assets,\nwhich exist for the 9B. Comfy-Org's MOSS-Image encoders have the same tensors and are\n`Qwen35Encoder_Checkpoint_Config`'s; they are told apart by their install source."
+ "description": "Model config for a single-file Qwen3.5 vision-language model, run as a text LLM.\n\nThe layout is transformers' own `Qwen3_5ForConditionalGeneration` state dict, as ComfyUI exports the FLUX.3\nprompt upsampler (bf16, or `int8_tensorwise` with a multi-token-prediction head the loader drops). The file\ncarries weights only; the loader supplies config, tokenizer and processor from the vendored Qwen3.5 assets,\nwhich exist for the 9B. The same file is Comfy-Org's MOSS-Image text encoder, so it also serves as a Qwen3.5\nencoder (role)."
},
"TextLLM_Diffusers_Config": {
"properties": {
@@ -119188,6 +120719,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"format": {
"type": "string",
"const": "diffusers",
@@ -119242,6 +120781,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"format",
"repo_variant",
"type",
@@ -119940,6 +121480,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -120001,6 +121549,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"type",
"format",
@@ -120094,6 +121643,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -120155,6 +121712,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"type",
"format",
@@ -120248,6 +121806,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -120309,6 +121875,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"type",
"format",
@@ -120402,6 +121969,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -120463,6 +122038,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"type",
"format",
@@ -120556,6 +122132,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -120617,6 +122201,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"type",
"format",
@@ -120710,6 +122295,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -120771,6 +122364,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"type",
"format",
@@ -120864,6 +122458,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -120925,6 +122527,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"type",
"format",
@@ -121018,6 +122621,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -121079,6 +122690,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"type",
"format",
@@ -121481,6 +123093,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"base": {
"type": "string",
"const": "unknown",
@@ -121513,6 +123133,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"base",
"type",
"format"
@@ -122108,6 +123729,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -122164,6 +123793,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"type",
"format",
@@ -122257,6 +123887,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -122313,6 +123951,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"type",
"format",
@@ -122405,6 +124044,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -122461,6 +124108,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"type",
"format",
@@ -122554,6 +124202,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -122610,6 +124266,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"type",
"format",
@@ -122703,6 +124360,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -122759,6 +124424,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"type",
"format",
@@ -122852,6 +124518,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -122908,6 +124582,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"type",
"format",
@@ -123000,6 +124675,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -123056,6 +124739,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"type",
"format",
@@ -123148,6 +124832,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -123204,6 +124896,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"type",
"format",
@@ -123296,6 +124989,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -123352,6 +125053,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"type",
"format",
@@ -123444,6 +125146,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -123506,6 +125216,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"type",
"format",
@@ -123600,6 +125311,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"format": {
"type": "string",
"const": "diffusers",
@@ -123648,6 +125367,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"format",
"repo_variant",
"type",
@@ -123740,6 +125460,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"format": {
"type": "string",
"const": "diffusers",
@@ -123788,6 +125516,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"format",
"repo_variant",
"type",
@@ -123881,6 +125610,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"format": {
"type": "string",
"const": "diffusers",
@@ -123929,6 +125666,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"format",
"repo_variant",
"type",
@@ -124022,6 +125760,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"format": {
"type": "string",
"const": "diffusers",
@@ -124070,6 +125816,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"format",
"repo_variant",
"type",
@@ -124162,6 +125909,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"format": {
"type": "string",
"const": "diffusers",
@@ -124210,6 +125965,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"format",
"repo_variant",
"type",
@@ -124302,6 +126058,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"format": {
"type": "string",
"const": "diffusers",
@@ -124350,6 +126114,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"format",
"repo_variant",
"type",
@@ -124442,6 +126207,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"format": {
"type": "string",
"const": "diffusers",
@@ -124497,6 +126270,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"format",
"repo_variant",
"type",
@@ -127711,6 +129485,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"config_path": {
"anyOf": [
{
@@ -127767,6 +129549,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"config_path",
"base",
"type",
@@ -127860,6 +129643,14 @@
"title": "Cover Image",
"description": "Url for image to preview model"
},
+ "roles": {
+ "items": {
+ "$ref": "#/components/schemas/ModelRole"
+ },
+ "type": "array",
+ "title": "Roles",
+ "description": "Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh."
+ },
"base": {
"type": "string",
"const": "any",
@@ -127904,6 +129695,7 @@
"source_api_response",
"source_url",
"cover_image",
+ "roles",
"base",
"type",
"format",
diff --git a/invokeai/frontend/api/schema.ts b/invokeai/frontend/api/schema.ts
index 1ecfc7417d..7d30d99848 100644
--- a/invokeai/frontend/api/schema.ts
+++ b/invokeai/frontend/api/schema.ts
@@ -7640,6 +7640,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -7729,6 +7734,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -7818,6 +7828,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Format
* @default diffusers
@@ -7904,6 +7919,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Format
* @default diffusers
@@ -8086,6 +8106,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Format
* @default diffusers
@@ -10028,6 +10053,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
default_settings: components["schemas"]["ControlAdapterDefaultSettings"] | null;
/**
* Base
@@ -10263,6 +10293,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -10347,6 +10382,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -10436,6 +10476,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -10527,6 +10572,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -10613,6 +10663,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -10692,6 +10747,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -10771,6 +10831,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -10860,6 +10925,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -10939,6 +11009,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Format
* @default diffusers
@@ -11015,6 +11090,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Format
* @default diffusers
@@ -11091,6 +11171,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Format
* @default diffusers
@@ -11167,6 +11252,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Format
* @default diffusers
@@ -13725,6 +13815,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Base
* @default external
@@ -14195,6 +14290,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default flux_redux
@@ -18891,6 +18991,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Base
* @default any
@@ -18980,6 +19085,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Base
* @default any
@@ -19061,6 +19171,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -19147,6 +19262,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Base
* @default ltx-2
@@ -19928,6 +20048,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default ip_adapter
@@ -20001,6 +20126,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default ip_adapter
@@ -20074,6 +20204,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default ip_adapter
@@ -20147,6 +20282,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default ip_adapter
@@ -20220,6 +20360,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default ip_adapter
@@ -20293,6 +20438,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default ip_adapter
@@ -20368,6 +20518,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default ip_adapter
@@ -20443,6 +20598,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default ip_adapter
@@ -27713,6 +27873,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default ltx2_duration_head
@@ -29394,6 +29559,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Format
* @default diffusers
@@ -29702,6 +29872,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default lora
@@ -29785,6 +29960,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default lora
@@ -29871,6 +30051,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default lora
@@ -29956,6 +30141,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default lora
@@ -30041,6 +30231,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default lora
@@ -30121,6 +30316,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default lora
@@ -30201,6 +30401,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default lora
@@ -30286,6 +30491,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default lora
@@ -30367,6 +30577,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default lora
@@ -30450,6 +30665,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default lora
@@ -30534,6 +30754,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default lora
@@ -30622,6 +30847,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default lora
@@ -30702,6 +30932,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default lora
@@ -30785,6 +31020,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default lora
@@ -30874,6 +31114,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default lora
@@ -30962,6 +31207,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default lora
@@ -31045,6 +31295,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default lora
@@ -31137,6 +31392,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default lora
@@ -31229,6 +31489,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default lora
@@ -31318,6 +31583,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default lora
@@ -31402,6 +31672,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default lora
@@ -31485,6 +31760,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default lora
@@ -31565,6 +31845,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default lora
@@ -31645,6 +31930,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default lora
@@ -31732,6 +32022,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default lora
@@ -31813,6 +32108,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default lora
@@ -31904,6 +32204,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default lora
@@ -31994,6 +32299,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default lora
@@ -32075,6 +32385,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default lora
@@ -32155,6 +32470,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default lora
@@ -32553,6 +32873,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -32645,6 +32970,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -32739,6 +33069,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -32827,6 +33162,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -32916,6 +33256,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -33010,6 +33355,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -33108,6 +33458,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -33202,6 +33557,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -33297,6 +33657,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -33403,6 +33768,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -33503,6 +33873,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -33591,6 +33966,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -33686,6 +34066,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -33772,6 +34157,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -33859,6 +34249,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -33946,6 +34341,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -34033,6 +34433,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -34135,6 +34540,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -34231,6 +34641,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -34317,6 +34732,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -34402,6 +34822,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -34487,6 +34912,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -34573,6 +35003,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -34663,6 +35098,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -34754,6 +35194,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -34839,6 +35284,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -34938,6 +35388,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -35042,6 +35497,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -35137,6 +35597,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -35222,6 +35687,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -35308,6 +35778,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -35391,6 +35866,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -35475,6 +35955,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -35559,6 +36044,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -35649,6 +36139,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -35733,6 +36228,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -35824,6 +36324,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -35921,6 +36426,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -36012,6 +36522,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -36107,6 +36622,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -36195,6 +36715,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -36284,6 +36809,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -36373,6 +36903,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -36467,6 +37002,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -36561,6 +37101,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -36657,6 +37202,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -36756,6 +37306,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -36844,6 +37399,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -36933,6 +37493,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -37029,6 +37594,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -37122,6 +37692,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -37218,6 +37793,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -37307,6 +37887,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -37401,6 +37986,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -37494,6 +38084,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -37587,6 +38182,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -37676,6 +38276,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -37765,6 +38370,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default main
@@ -40874,6 +41484,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -40977,6 +41592,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Base
* @default any
@@ -41063,6 +41683,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -41125,7 +41750,7 @@ export type components = {
name: string;
/** @description The model's base model type */
base: components["schemas"]["BaseModelType"];
- /** @description The model's type */
+ /** @description The model's type, or a role it serves as (see its config's `roles`) when a node asks for it in that role */
type: components["schemas"]["ModelType"];
/**
* @description The submodel to load, if this is a main model
@@ -41740,6 +42365,20 @@ export type components = {
* @enum {string}
*/
ModelRepoVariant: "" | "fp16" | "fp32" | "onnx" | "openvino" | "flax";
+ /**
+ * ModelRole
+ * @description Another model type a model's files serve as, beside the type its record is filed under. Set by identification.
+ */
+ ModelRole: {
+ type: components["schemas"]["ModelType"];
+ /** @description The format the model loads in for this role, when it differs from the record's format */
+ format: components["schemas"]["ModelFormat"] | null;
+ /**
+ * Variant
+ * @description The variant the model serves as in this role
+ */
+ variant: components["schemas"]["ModelVariantType"] | components["schemas"]["ClipVariantType"] | components["schemas"]["FluxVariantType"] | components["schemas"]["Flux2VariantType"] | components["schemas"]["Flux3VariantType"] | components["schemas"]["ZImageVariantType"] | components["schemas"]["QwenImageVariantType"] | components["schemas"]["WanVariantType"] | components["schemas"]["WanLoRAVariantType"] | components["schemas"]["SD3VariantType"] | components["schemas"]["Qwen3VariantType"] | components["schemas"]["Qwen3VLVariantType"] | components["schemas"]["Qwen35VariantType"] | components["schemas"]["AnimaVariantType"] | components["schemas"]["Krea2VariantType"] | components["schemas"]["QwenImage21VariantType"] | components["schemas"]["MiniMaxH3VariantType"] | components["schemas"]["LTX2VariantType"] | components["schemas"]["MistralVariantType"] | components["schemas"]["PiDDecoderVariantType"] | null;
+ };
/**
* ModelSourceType
* @description Model source type.
@@ -43181,6 +43820,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -43264,6 +43908,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -43351,6 +44000,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -43434,6 +44088,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -43517,6 +44176,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -44616,6 +45280,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -44729,6 +45398,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -44817,6 +45491,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -44908,6 +45587,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Base
* @default any
@@ -44991,6 +45675,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -45082,6 +45771,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Base
* @default any
@@ -45191,6 +45885,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -45293,6 +45992,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -45391,6 +46095,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -45484,6 +46193,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Base
* @default any
@@ -45584,6 +46298,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -47021,6 +47740,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -47117,6 +47841,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Base
* @default any
@@ -47202,6 +47931,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -50114,6 +50848,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Format
* @default diffusers
@@ -50321,6 +51060,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Base
* @default any
@@ -51496,6 +52240,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Format
* @default diffusers
@@ -51572,6 +52321,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Format
* @default diffusers
@@ -51663,6 +52417,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Base
* @default any
@@ -51747,6 +52506,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -51837,6 +52601,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -51935,6 +52704,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Base
* @default any
@@ -52017,6 +52791,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Base
* @default any
@@ -52106,6 +52885,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default embedding
@@ -52179,6 +52963,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default embedding
@@ -52252,6 +53041,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default embedding
@@ -52325,6 +53119,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default embedding
@@ -52398,6 +53197,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default embedding
@@ -52471,6 +53275,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Type
* @default embedding
@@ -52634,8 +53443,8 @@ export type components = {
* The layout is transformers' own `Qwen3_5ForConditionalGeneration` state dict, as ComfyUI exports the FLUX.3
* prompt upsampler (bf16, or `int8_tensorwise` with a multi-token-prediction head the loader drops). The file
* carries weights only; the loader supplies config, tokenizer and processor from the vendored Qwen3.5 assets,
- * which exist for the 9B. Comfy-Org's MOSS-Image encoders have the same tensors and are
- * `Qwen35Encoder_Checkpoint_Config`'s; they are told apart by their install source.
+ * which exist for the 9B. The same file is Comfy-Org's MOSS-Image text encoder, so it also serves as a Qwen3.5
+ * encoder (role).
*/
TextLLM_Checkpoint_Config: {
/**
@@ -52690,6 +53499,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -52783,6 +53597,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Format
* @default diffusers
@@ -53152,6 +53971,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -53240,6 +54064,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -53328,6 +54157,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -53416,6 +54250,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -53504,6 +54343,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -53592,6 +54436,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -53680,6 +54529,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -53771,6 +54625,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -54038,6 +54897,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Base
* @default unknown
@@ -54398,6 +55262,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -54481,6 +55350,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -54567,6 +55441,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -54653,6 +55532,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -54739,6 +55623,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -54822,6 +55711,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -54905,6 +55799,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -54988,6 +55887,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -55071,6 +55975,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -55160,6 +56069,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -55249,6 +56163,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Format
* @default diffusers
@@ -55332,6 +56251,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Format
* @default diffusers
@@ -55415,6 +56339,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Format
* @default diffusers
@@ -55495,6 +56424,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Format
* @default diffusers
@@ -55575,6 +56509,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Format
* @default diffusers
@@ -55655,6 +56594,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Format
* @default diffusers
@@ -55738,6 +56682,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Format
* @default diffusers
@@ -57569,6 +58518,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Config Path
* @description Path to the config for this model, if any.
@@ -57661,6 +58615,11 @@ export type components = {
* @description Url for image to preview model
*/
cover_image: string | null;
+ /**
+ * Roles
+ * @description Other model types this model serves as, besides `type`. Derived from its files at identification; re-identify to refresh.
+ */
+ roles: components["schemas"]["ModelRole"][];
/**
* Base
* @default any
diff --git a/invokeai/frontend/webv2/VERIFICATION.md b/invokeai/frontend/webv2/VERIFICATION.md
index 5c38d48522..39c912ecf2 100644
--- a/invokeai/frontend/webv2/VERIFICATION.md
+++ b/invokeai/frontend/webv2/VERIFICATION.md
@@ -9,6 +9,7 @@ Paths and commands are relative to this package. This map links user vocabulary
- `anima-lllite`, `spandrel`: adapters and upscalers installed before their channels or scale were recorded; re-identify fills those fields.
- `control-sdxl`: SDXL ControlNets naming their preprocessor in both id forms, a Union, an unpurposed model, and a T2I-Adapter.
- `control-flux`: FLUX dev with a depth Control LoRA and a Union ControlNet.
+ - `model-roles`: single-file MOSS-Image and Z-Image mains with VAEs, a Text LLM that is also the Qwen3.5 9B encoder, a Qwen3.5 9B encoder that is also a Text LLM, and a Qwen3 4B Text LLM folder that is also the Qwen3 encoder (`roles`).
- The mock serves in-memory HTTP without Socket.IO. It proves nothing about real authorization, persistence, or model execution.
- Production-build journeys start and stop their own preview and backend. Run their package commands; do not write a new driver. Their setup, fault injection, and selectors are working examples. Focused runs use a spare port and respect the one-performance-gate-per-machine rule.
diff --git a/invokeai/frontend/webv2/public/locales/en.json b/invokeai/frontend/webv2/public/locales/en.json
index 02d7c4b5b2..5eca7183bc 100644
--- a/invokeai/frontend/webv2/public/locales/en.json
+++ b/invokeai/frontend/webv2/public/locales/en.json
@@ -1426,6 +1426,7 @@
"allBases": "All bases",
"allInstalled": "all installed",
"allModels": "All models",
+ "alsoUsableAs": "Also usable as",
"apiKey": "API key",
"apiKeyConfigured": "API key configured",
"apiKeyFor": "{{title}} API key",
@@ -1642,6 +1643,7 @@
},
"library": "Model library",
"libraryMaintenance": "Model library maintenance",
+ "listedAs": "{{name}}, listed as {{type}}",
"linkedModel": "Linked model",
"linkedToModel": "Linked to {{name}}",
"loadingModels": "Loading models…",
diff --git a/invokeai/frontend/webv2/scripts/mock-backend-fixtures.mjs b/invokeai/frontend/webv2/scripts/mock-backend-fixtures.mjs
index 50547eebdf..01e1118184 100644
--- a/invokeai/frontend/webv2/scripts/mock-backend-fixtures.mjs
+++ b/invokeai/frontend/webv2/scripts/mock-backend-fixtures.mjs
@@ -538,7 +538,7 @@ const EXTERNAL_MODEL_FIXTURES = [
/** The last slots of the model library hold the hosted-provider records so the profile counts stay as declared. */
const createModels = (count) => [
...createLocalModels(Math.max(0, count - EXTERNAL_MODEL_FIXTURES.length)),
- ...EXTERNAL_MODEL_FIXTURES.slice(0, count).map((model) => structuredClone(model)),
+ ...EXTERNAL_MODEL_FIXTURES.slice(0, count).map((model) => ({ roles: [], ...structuredClone(model) })),
];
const createLocalModels = (count) =>
@@ -563,6 +563,7 @@ const createLocalModels = (count) =>
key: `fixture-model-${id}`,
name: `Fixture Model ${id}`,
path: `fixtures/models/fixture-model-${id}.safetensors`,
+ roles: [],
source: `fixtures/models/fixture-model-${id}.safetensors`,
source_type: 'path',
source_url: null,
@@ -584,6 +585,7 @@ const seedModel = ({ key, name, ...fields }) => ({
key,
name,
path: `seeds/${key}.safetensors`,
+ roles: [],
source: `seeds/${key}.safetensors`,
source_type: 'path',
source_url: null,
@@ -691,6 +693,65 @@ export const MODEL_SEED_SETS = Object.freeze({
}),
controlSeed('flux-controlnet-union-pro', 'flux', null),
],
+ // Models whose files also serve as another type: single-file MOSS-Image and Z-Image mains with their VAEs, a Text
+ // LLM that is also the Qwen3.5 9B encoder, a Qwen3.5 encoder that is also a Text LLM, and a Qwen3 4B causal-LM
+ // folder that is also the Qwen3 encoder.
+ 'model-roles': [
+ {
+ record: seedModel({
+ base: 'moss-image',
+ key: 'seed-moss-image-main',
+ name: 'MOSS-Image (single file)',
+ trigger_phrases: null,
+ type: 'main',
+ }),
+ },
+ {
+ record: seedModel({ base: 'flux2', cpu_only: null, key: 'seed-flux2-vae', name: 'FLUX.2 VAE', type: 'vae' }),
+ },
+ {
+ record: seedModel({
+ cpu_only: null,
+ key: 'seed-text-llm-qwen35-9b',
+ name: 'Qwen3.5 9B VLM (int8)',
+ roles: [{ format: null, type: 'qwen3_5_encoder', variant: 'qwen3_5_9b' }],
+ supports_images: true,
+ type: 'text_llm',
+ variant: undefined,
+ }),
+ },
+ {
+ record: seedModel({
+ cpu_only: null,
+ key: 'seed-qwen35-encoder-9b',
+ name: 'Qwen3.5 9B Encoder (int8)',
+ roles: [{ format: null, type: 'text_llm', variant: null }],
+ type: 'qwen3_5_encoder',
+ variant: 'qwen3_5_9b',
+ }),
+ },
+ {
+ record: seedModel({
+ base: 'z-image',
+ key: 'seed-z-image-main',
+ name: 'Z-Image (single file)',
+ trigger_phrases: null,
+ type: 'main',
+ }),
+ },
+ { record: seedModel({ base: 'flux', cpu_only: null, key: 'seed-flux-vae', name: 'FLUX VAE', type: 'vae' }) },
+ {
+ record: seedModel({
+ cpu_only: null,
+ format: 'diffusers',
+ key: 'seed-qwen3-4b-llm',
+ name: 'Qwen3 4B',
+ roles: [{ format: 'qwen3_encoder', type: 'qwen3_encoder', variant: 'qwen3_4b' }],
+ type: 'text_llm',
+ variant: undefined,
+ }),
+ },
+ ],
});
const createNodePacks = (nodeCount) =>
diff --git a/invokeai/frontend/webv2/src/app/VideoModelSwitch.browser.test.tsx b/invokeai/frontend/webv2/src/app/VideoModelSwitch.browser.test.tsx
index 3c5d2b12e3..db028841de 100644
--- a/invokeai/frontend/webv2/src/app/VideoModelSwitch.browser.test.tsx
+++ b/invokeai/frontend/webv2/src/app/VideoModelSwitch.browser.test.tsx
@@ -110,7 +110,11 @@ vi.mock('@features/models/react', async (importOriginal) => ({
}
const options = (useModelSnapshot().models as ModelConfig[]).filter(
- (candidate) => modelTypes.includes(candidate.type) && (!filter || filter(candidate))
+ (candidate) =>
+ [candidate.type, ...(candidate.roles ?? []).map((role) => role.type)].some((type) =>
+ modelTypes.includes(type)
+ ) &&
+ (!filter || filter(candidate))
);
return (
diff --git a/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.test.ts b/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.test.ts
index db6b5ae799..9a1258d705 100644
--- a/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.test.ts
+++ b/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.test.ts
@@ -1282,6 +1282,65 @@ describe('the Qwen3.5 encoder slots of Anima-3.8B and MOSS-Image', () => {
});
});
+describe('Text LLM records that also serve as an encoder', () => {
+ const textLlm = (roleType: string, roleVariant: string): ComponentModelConfig => ({
+ base: 'any',
+ format: 'checkpoint',
+ key: `llm-${roleVariant}`,
+ name: `LLM ${roleVariant}`,
+ roles: [{ type: roleType, variant: roleVariant }],
+ type: 'text_llm',
+ });
+ const offers = (model: MainModelConfig, slotKey: string, candidate: ComponentModelConfig): boolean | undefined => {
+ const settings = createSettings(model);
+ const slot = getComponentSectionPolicy(model, settings).slots.find((s) => s.key === slotKey);
+
+ return slot?.filter?.(candidate, { model, selectedComponents: settings, settings });
+ };
+
+ it('offers a role-serving Text LLM only to the slot whose encoder size it matches', () => {
+ const moss = createModel('moss-image', { format: 'checkpoint' });
+ const zImage = createModel('z-image', { format: 'checkpoint' });
+ const klein4b = createModel('flux2', { format: 'gguf_quantized', variant: 'klein_4b' });
+ const anima = createModel('anima', { format: 'checkpoint', variant: 'anima_qwen3' });
+
+ expect(offers(moss, 'qwen35EncoderModel', textLlm('qwen3_5_encoder', 'qwen3_5_9b'))).toBe(true);
+ expect(offers(moss, 'qwen35EncoderModel', textLlm('qwen3_5_encoder', 'qwen3_5_4b'))).toBe(false);
+ expect(offers(zImage, 'qwen3EncoderModel', textLlm('qwen3_encoder', 'qwen3_4b'))).toBe(true);
+ expect(offers(zImage, 'qwen3EncoderModel', textLlm('qwen3_encoder', 'qwen3_8b'))).toBe(false);
+ expect(offers(klein4b, 'qwen3EncoderModel', textLlm('qwen3_encoder', 'qwen3_4b'))).toBe(true);
+ expect(offers(klein4b, 'qwen3EncoderModel', textLlm('qwen3_encoder', 'qwen3_8b'))).toBe(false);
+ expect(offers(anima, 'qwen3EncoderModel', textLlm('qwen3_encoder', 'qwen3_06b'))).toBe(true);
+ expect(offers(zImage, 'qwen3EncoderModel', { ...textLlm('qwen3_encoder', 'qwen3_4b'), roles: [] })).toBe(false);
+ });
+
+ it('counts a selected role-serving Text LLM as the missing encoder', () => {
+ const moss = createModel('moss-image', { format: 'checkpoint' });
+ const zImage = createModel('z-image', { format: 'checkpoint' });
+
+ expect(
+ getGenerationValidationReasons(
+ moss,
+ createSettings(moss, { qwen35EncoderModel: textLlm('qwen3_5_encoder', 'qwen3_5_9b'), vae: flux2Vae })
+ )
+ ).toEqual([]);
+ expect(
+ getGenerationValidationReasons(
+ zImage,
+ createSettings(zImage, { qwen3EncoderModel: textLlm('qwen3_encoder', 'qwen3_4b'), vae: fluxVae })
+ )
+ ).toEqual([]);
+ expect(
+ getGenerationValidationReasons(
+ zImage,
+ createSettings(zImage, { qwen3EncoderModel: textLlm('qwen3_encoder', 'qwen3_8b'), vae: fluxVae })
+ )
+ ).toEqual([
+ 'The selected Qwen3 Encoder is not the 4B one Z-Image conditions on. Select a Qwen3 4B Encoder or clear it.',
+ ]);
+ });
+});
+
describe('Anima IP-Adapter references', () => {
const animaQwen3 = createModel('anima', { format: 'checkpoint', variant: 'anima_qwen3' });
const animaIpAdapter: ComponentModelConfig = {
diff --git a/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts b/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts
index 09f519435d..262e19951d 100644
--- a/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts
+++ b/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts
@@ -60,6 +60,7 @@ import {
isVaeAcceptedByBase,
isVaeCompatibleWithGenerateModel,
isZImageQwen3Encoder,
+ servesAsType,
type GenerateComponentFilter,
} from './componentCompatibility';
import { MAX_DIMENSION, MIN_DIMENSION } from './dimensionLimits';
@@ -1003,8 +1004,8 @@ const qwen3EncoderSlot = (helpText: string, filter?: GenerateComponentFilter): C
valueKind: 'component',
helpText,
filter: filter
- ? (candidate) => candidate.type === 'qwen3_encoder' && filter(candidate)
- : (candidate) => candidate.type === 'qwen3_encoder',
+ ? (candidate) => servesAsType(candidate, 'qwen3_encoder') && filter(candidate)
+ : (candidate) => servesAsType(candidate, 'qwen3_encoder'),
});
const mistralEncoderSlot = (
diff --git a/invokeai/frontend/webv2/src/features/generation/core/componentCompatibility.test.ts b/invokeai/frontend/webv2/src/features/generation/core/componentCompatibility.test.ts
index eb28bb6d09..ef4d20a20d 100644
--- a/invokeai/frontend/webv2/src/features/generation/core/componentCompatibility.test.ts
+++ b/invokeai/frontend/webv2/src/features/generation/core/componentCompatibility.test.ts
@@ -9,7 +9,9 @@ import type { ComponentModelConfig, GenerateModelConfig, VaeModelConfig } from '
import {
getCompatibleSelectedComponentKey,
+ isAnimaQwen35Encoder,
isAnimaQwen3Encoder,
+ isMossImageQwen35Encoder,
isErnieImageMistralEncoder,
isBundledFlux2Main,
isFlux2EncoderSourceForModel,
@@ -21,6 +23,9 @@ import {
isVaeAcceptedByBase,
isVaeCompatibleWithGenerateModel,
isZImageQwen3Encoder,
+ roleVariantOf,
+ servesAsType,
+ servesAsVariant,
type GenerateComponentCandidate,
} from './componentCompatibility';
@@ -256,6 +261,55 @@ describe('Generate component compatibility', () => {
});
});
+describe('encoder predicates over roles', () => {
+ const textLlm = (roleType: string, roleVariant: string | null): GenerateComponentCandidate =>
+ candidate({ roles: [{ type: roleType, variant: roleVariant }], type: 'text_llm' });
+
+ it('answers primary type and role with the variant of the matching source', () => {
+ const withBothVariants = candidate({
+ roles: [{ type: 'qwen3_5_encoder', variant: 'qwen3_5_9b' }],
+ type: 'qwen3_encoder',
+ variant: 'qwen3_4b',
+ });
+
+ expect(servesAsType(withBothVariants, 'qwen3_encoder')).toBe(true);
+ expect(servesAsType(withBothVariants, 'qwen3_5_encoder')).toBe(true);
+ expect(servesAsType(withBothVariants, 'text_llm')).toBe(false);
+ expect(roleVariantOf(withBothVariants, 'qwen3_encoder')).toBe('qwen3_4b');
+ expect(roleVariantOf(withBothVariants, 'qwen3_5_encoder')).toBe('qwen3_5_9b');
+ expect(servesAsVariant(withBothVariants, 'qwen3_5_encoder', 'qwen3_4b')).toBe(false);
+ });
+
+ it.each([
+ ['Anima Qwen3', isAnimaQwen3Encoder, 'qwen3_encoder', 'qwen3_06b'],
+ ['Z-Image Qwen3', isZImageQwen3Encoder, 'qwen3_encoder', 'qwen3_4b'],
+ ['Anima Qwen3.5', isAnimaQwen35Encoder, 'qwen3_5_encoder', 'qwen3_5_4b'],
+ ['MOSS-Image Qwen3.5', isMossImageQwen35Encoder, 'qwen3_5_encoder', 'qwen3_5_9b'],
+ ] as const)(
+ '%s: primary match, role match, wrong role variant and a bare Text LLM',
+ (_name, predicate, type, variant) => {
+ expect(predicate(candidate({ type, variant }))).toBe(true);
+ expect(predicate(textLlm(type, variant))).toBe(true);
+ expect(predicate(textLlm(type, 'other_variant'))).toBe(false);
+ expect(predicate(textLlm(type, null))).toBe(false);
+ expect(predicate(candidate({ type: 'text_llm' }))).toBe(false);
+ // A role of another type with the right variant string does not count.
+ expect(predicate(textLlm(type === 'qwen3_encoder' ? 'qwen3_5_encoder' : 'qwen3_encoder', variant))).toBe(false);
+ }
+ );
+
+ it('takes a Qwen3 causal LM as the FLUX.2 Klein encoder by the variant of its role', () => {
+ const klein9b = isFlux2Qwen3EncoderForModel(flux2Model('klein_9b'));
+ const anyKlein = isFlux2Qwen3EncoderForModel({ base: 'flux2', key: 'k', name: 'k', type: 'main' });
+
+ expect(klein9b(textLlm('qwen3_encoder', 'qwen3_8b'))).toBe(true);
+ expect(klein9b(textLlm('qwen3_encoder', 'qwen3_4b'))).toBe(false);
+ expect(anyKlein(textLlm('qwen3_encoder', 'qwen3_4b'))).toBe(true);
+ expect(anyKlein(textLlm('qwen3_encoder', 'qwen3_06b'))).toBe(false);
+ expect(anyKlein(candidate({ type: 'text_llm' }))).toBe(false);
+ });
+});
+
describe('the VAE filters and the backend declarations', () => {
const mainOf = (base: string, variant: string | null = null) =>
({
diff --git a/invokeai/frontend/webv2/src/features/generation/core/componentCompatibility.ts b/invokeai/frontend/webv2/src/features/generation/core/componentCompatibility.ts
index b4a1a12ec6..11fd3e2340 100644
--- a/invokeai/frontend/webv2/src/features/generation/core/componentCompatibility.ts
+++ b/invokeai/frontend/webv2/src/features/generation/core/componentCompatibility.ts
@@ -1,3 +1,5 @@
+import type { ModelRole } from '@features/models';
+
import type { ComponentModelConfig, GenerateModelConfig, VaeModelConfig } from './types';
import { getArchitectureCapabilityRow } from './architectureCapabilities';
@@ -13,6 +15,8 @@ export type GenerateComponentCandidate = {
key?: string;
/** VAE latent width. Only `wan` ships more than one, and its two are different decoders. */
latent_channels?: number | null;
+ /** Other types the same files serve as; the backend always sends it. */
+ roles?: readonly ModelRole[];
submodels?: Record<string, unknown> | null;
/** Text LLMs only: whether the model reads images. */
supports_images?: unknown;
@@ -76,20 +80,31 @@ export const isClipVariant =
(model) =>
model.type === 'clip_embed' && model.variant === variant;
+/** Whether the model is a `type`, as its primary type or through a role. */
+export const servesAsType = (model: GenerateComponentCandidate, type: string): boolean =>
+ model.type === type || (model.roles ?? []).some((role) => role.type === type);
+
+/** The variant the model has as a `type`: its own for the primary type, the role's for a role. */
+export const roleVariantOf = (model: GenerateComponentCandidate, type: string): unknown =>
+ model.type === type ? model.variant : (model.roles ?? []).find((role) => role.type === type)?.variant;
+
+export const servesAsVariant = (model: GenerateComponentCandidate, type: string, variant: unknown): boolean =>
+ roleVariantOf(model, type) === variant;
+
export const isAnimaQwen3Encoder: GenerateComponentFilter = (model) =>
- model.type === 'qwen3_encoder' && model.variant === 'qwen3_06b';
+ servesAsVariant(model, 'qwen3_encoder', 'qwen3_06b');
/** Anima-3.8B's semantic connector was trained on the Qwen3.5 4B. */
export const isAnimaQwen35Encoder: GenerateComponentFilter = (model) =>
- model.type === 'qwen3_5_encoder' && model.variant === 'qwen3_5_4b';
+ servesAsVariant(model, 'qwen3_5_encoder', 'qwen3_5_4b');
/** MOSS-Image conditions on the Qwen3.5 9B; the 4B's hidden size does not fit its text embedder. */
export const isMossImageQwen35Encoder: GenerateComponentFilter = (model) =>
- model.type === 'qwen3_5_encoder' && model.variant === 'qwen3_5_9b';
+ servesAsVariant(model, 'qwen3_5_encoder', 'qwen3_5_9b');
/** Z-Image's caption embedder is 2560 wide, the Qwen3 4B hidden size; the 8B encoder's 4096 cannot feed it. */
export const isZImageQwen3Encoder: GenerateComponentFilter = (model) =>
- model.type === 'qwen3_encoder' && model.variant === 'qwen3_4b';
+ servesAsVariant(model, 'qwen3_encoder', 'qwen3_4b');
/** The optional 4-channel ControlNet-LLLite adapter the canvas feeds during Anima inpainting and outpainting. */
export const isAnimaInpaintAdapter: GenerateComponentFilter = (model) => isAnimaInpaintAdapterModel(model);
@@ -144,11 +159,17 @@ export const isFlux2Qwen3EncoderForModel = (selectedModel: GenerateModelConfig):
typeof selectedModel.variant === 'string' ? KLEIN_TO_QWEN3_VARIANT[selectedModel.variant] : null;
return (model) => {
- if (model.type !== 'qwen3_encoder' || model.variant === 'qwen3_06b') {
+ if (!servesAsType(model, 'qwen3_encoder')) {
+ return false;
+ }
+
+ const variant = roleVariantOf(model, 'qwen3_encoder');
+
+ if (variant === 'qwen3_06b') {
return false;
}
- return requiredVariant ? model.variant === requiredVariant : true;
+ return requiredVariant ? variant === requiredVariant : true;
};
};
diff --git a/invokeai/frontend/webv2/src/features/generation/core/contracts.ts b/invokeai/frontend/webv2/src/features/generation/core/contracts.ts
index e2163224c2..6691f8ca44 100644
--- a/invokeai/frontend/webv2/src/features/generation/core/contracts.ts
+++ b/invokeai/frontend/webv2/src/features/generation/core/contracts.ts
@@ -1,4 +1,5 @@
/** Public, storage-independent contracts owned by Generation. */
+import type { ModelRole } from '@features/models';
export type ResultDestination = 'canvas' | 'gallery';
@@ -92,6 +93,7 @@ export interface GenerationModelCatalogItem {
type: string;
format?: string;
variant?: string | null;
+ roles?: readonly ModelRole[];
hash?: string;
submodel_type?: string;
trigger_phrases?: string[] | null;
diff --git a/invokeai/frontend/webv2/src/features/generation/core/graph.test.ts b/invokeai/frontend/webv2/src/features/generation/core/graph.test.ts
index ad00406749..e235a7c2c5 100644
--- a/invokeai/frontend/webv2/src/features/generation/core/graph.test.ts
+++ b/invokeai/frontend/webv2/src/features/generation/core/graph.test.ts
@@ -366,6 +366,21 @@ describe('compileGenerateGraph', () => {
expect(zImage.nodes.model_loader).toMatchObject({ qwen3_encoder_model: undefined, vae_model: undefined });
});
+ it('sends a standalone Z-Image transformer a Qwen3 4B Text LLM as its stored config', () => {
+ const zImageGguf: MainModelConfig = { ...zImageModel, format: 'gguf_quantized' };
+ const textLlm: ComponentModelConfig = {
+ base: 'any',
+ format: 'diffusers',
+ key: 'llm-4b',
+ name: 'Qwen3 4B',
+ roles: [{ type: 'qwen3_encoder', variant: 'qwen3_4b' }],
+ type: 'text_llm',
+ };
+ const graph = compile(zImageGguf, { qwen3EncoderModel: textLlm, vae: fluxVae });
+
+ expect(graph.nodes.model_loader?.qwen3_encoder_model).toEqual(textLlm);
+ });
+
it('sends a standalone Z-Image transformer the Qwen3 4B encoder and refuses the 8B one', () => {
const zImageGguf: MainModelConfig = { ...zImageModel, format: 'gguf_quantized' };
const qwen3_4b: ComponentModelConfig = { ...qwen3Encoder, key: 'qwen3-4b', variant: 'qwen3_4b' };
diff --git a/invokeai/frontend/webv2/src/features/generation/core/graphExport.ts b/invokeai/frontend/webv2/src/features/generation/core/graphExport.ts
index ee566926a2..8765b171e1 100644
--- a/invokeai/frontend/webv2/src/features/generation/core/graphExport.ts
+++ b/invokeai/frontend/webv2/src/features/generation/core/graphExport.ts
@@ -37,6 +37,7 @@ import {
isControlKindSupportedForBase,
isControlModelUsableForKind,
} from './canvas/controlValidation';
+import { servesAsType } from './componentCompatibility';
import { expandsDynamicPrompts, planGenerateSubmission, type GenerateSubmissionPrompts } from './dynamicPrompts';
import { compileGenerateGraph } from './graph';
import { stabilizeBackendGraphNodeIds } from './previewGraph';
@@ -193,7 +194,8 @@ const withSettingsOverrides = (
};
const fitsSlot = (slot: ComponentSlotPolicy, candidate: ModelConfig, ctx: ComponentPolicyContext): boolean =>
- (slot.modelTypes as readonly string[]).includes(candidate.type) && (!slot.filter || slot.filter(candidate, ctx));
+ (slot.modelTypes as readonly string[]).some((type) => servesAsType(candidate, type)) &&
+ (!slot.filter || slot.filter(candidate, ctx));
/** The value the component picker commits for `model`, by the slot's value kind. */
const toSlotValue = (slot: ComponentSlotPolicy, model: ModelConfig): ComponentModelConfig | null => {
diff --git a/invokeai/frontend/webv2/src/features/generation/core/types.ts b/invokeai/frontend/webv2/src/features/generation/core/types.ts
index 5432bc3e01..99908bf973 100644
--- a/invokeai/frontend/webv2/src/features/generation/core/types.ts
+++ b/invokeai/frontend/webv2/src/features/generation/core/types.ts
@@ -1,6 +1,7 @@
import type { BackendGraphContract, GraphContract } from '@features/generation/core/contracts';
import type { DynamicPromptsSeedBehaviour } from '@features/generation/core/dynamicPrompts';
import type { PromptTemplateSnapshot } from '@features/generation/core/promptTemplates';
+import type { ModelRole } from '@features/models';
import type { SeedMode } from '@platform/core/seed';
export type ModelIdentifierConfig = {
@@ -10,6 +11,7 @@ export type ModelIdentifierConfig = {
type: string;
format?: string;
variant?: string | null;
+ roles?: readonly ModelRole[];
hash?: string;
submodel_type?: string;
[key: string]: unknown;
diff --git a/invokeai/frontend/webv2/src/features/generation/settings.ts b/invokeai/frontend/webv2/src/features/generation/settings.ts
index 23c849c142..2da4ae22e6 100644
--- a/invokeai/frontend/webv2/src/features/generation/settings.ts
+++ b/invokeai/frontend/webv2/src/features/generation/settings.ts
@@ -120,6 +120,7 @@ export {
isVaeAcceptedByBase,
isVaeCompatibleWithGenerateModel,
isZImageQwen3Encoder,
+ servesAsType,
} from './core/componentCompatibility';
export {
getLockedAspectRatioSettings,
diff --git a/invokeai/frontend/webv2/src/features/generation/ui/GenerateSettingsForm.browser.test.tsx b/invokeai/frontend/webv2/src/features/generation/ui/GenerateSettingsForm.browser.test.tsx
index 7276af3d11..9a064ad213 100644
--- a/invokeai/frontend/webv2/src/features/generation/ui/GenerateSettingsForm.browser.test.tsx
+++ b/invokeai/frontend/webv2/src/features/generation/ui/GenerateSettingsForm.browser.test.tsx
@@ -124,7 +124,13 @@ const MainModelPicker = ({
data-component-value={value ?? ''}
>
{stableGroups.models.catalog
- .filter((model) => modelTypes.includes(model.type) && (filter?.(model) ?? true))
+ .filter(
+ (model) =>
+ [model.type, ...((model.roles as { type: string }[] | undefined) ?? []).map((role) => role.type)].some(
+ (type) => modelTypes.includes(type)
+ ) &&
+ (filter?.(model) ?? true)
+ )
.map((model) => (
<button key={model.key} data-component-pick={model.key} type="button" onClick={() => onChange(model)}>
{model.name}
diff --git a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/ExpandPromptSuggestion.browser.test.tsx b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/ExpandPromptSuggestion.browser.test.tsx
index e01b543ada..5f16f766c2 100644
--- a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/ExpandPromptSuggestion.browser.test.tsx
+++ b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/ExpandPromptSuggestion.browser.test.tsx
@@ -51,7 +51,24 @@ const ENHANCER = {
supports_images: true,
type: 'text_llm',
};
+
+/** A record whose primary type is another one but whose files also serve as a Text LLM. */
+const ROLE_ENHANCER = {
+ ...ENHANCER,
+ key: 'role-e4b',
+ name: 'Gemma 4 E4B (encoder)',
+ roles: [{ format: null, type: 'text_llm', variant: null }],
+ source: 'google/gemma-4-E4B-it',
+ type: 'qwen3_5_encoder',
+};
const MOSS_PROMPT_ID = '0f8f5b2e-1c9e-4f2a-9a4e-1f1f1f1f0011';
+const MOSS_SUGGESTION: ExpandPromptSuggestion = {
+ image: null,
+ imageSystemPromptId: null,
+ modelName: 'Gemma 4 E4B (Prompt Enhancer)',
+ modelSource: 'google/gemma-4-E4B-it',
+ systemPromptId: MOSS_PROMPT_ID,
+};
const FLUX3_PROMPT_ID = '0f8f5b2e-1c9e-4f2a-9a4e-1f1f1f1f0012';
const prompt = (id: string, content: string) => ({
content,
@@ -81,7 +98,13 @@ const LTX_SUGGESTION: ExpandPromptSuggestion = {
const notices = vi.hoisted(() => ({ info: vi.fn(), offer: vi.fn(), undoable: vi.fn() }));
-let catalog: (typeof TEXT_ONLY | typeof ENHANCER | typeof VISION_A)[] = [];
+// Read at render time by the mocks below, so each test can set them before rendering.
+let catalog: (
+ | typeof TEXT_ONLY
+ | typeof ENHANCER
+ | typeof VISION_A
+ | (Omit<typeof ROLE_ENHANCER, 'roles'> & { roles?: unknown[] })
+)[] = [];
let arePromptsLoading = false;
const StubSelect = ({
@@ -321,6 +344,21 @@ it("keeps the surface's saved pick over an installed suggestion, also after a re
expect(saved.onChange).toHaveBeenCalledExactlyOnceWith({ expandPromptModelKey: 'e2b' });
});
+it('offers a record that serves as a Text LLM through a role, and suggests it by source', async () => {
+ catalog = [TEXT_ONLY, ROLE_ENHANCER];
+ await renderAndOpen(MOSS_SUGGESTION, savedModels());
+
+ expect(select('text llm')?.value).toBe('role-e4b');
+});
+
+it('does not take a record of another type without the Text LLM role as a candidate', async () => {
+ catalog = [TEXT_ONLY, { ...ROLE_ENHANCER, roles: [] }];
+ await renderAndOpen(MOSS_SUGGESTION, savedModels());
+
+ expect(select('text llm')?.value).toBe('qwen');
+ expect(document.body.textContent).toContain('is not installed');
+});
+
it("starts another project from its own saved Expand Prompt model, not the previous project's pick", async () => {
await renderAndOpen(null, savedModels());
await choose('text llm', 'qwen');
diff --git a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx
index 36149fe488..33839da353 100644
--- a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx
+++ b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx
@@ -29,6 +29,7 @@ import {
} from '@chakra-ui/react';
import { galleryImageUrls } from '@features/gallery/utility';
import { isSuggestedExpandPromptModel } from '@features/generation/core/baseGenerationPolicies';
+import { servesAsType } from '@features/generation/core/componentCompatibility';
import { filterPromptHistory } from '@features/generation/core/promptHistory';
import { resolveSelectedSystemPromptId } from '@features/generation/core/systemPrompts';
import { llmTaskProgressStore } from '@features/generation/data/llmTaskProgress';
@@ -669,7 +670,7 @@ const ExpandPromptButton = ({
const [selectedSystemPromptId, setSelectedSystemPromptId] = useState<string | null>(null);
// Keyed by image so unticking one frame does not carry over to the next one.
const [excludedImageName, setExcludedImageName] = useState<string | null>(null);
- const textLlmModels = models.filter((model) => model.type === 'text_llm');
+ const textLlmModels = models.filter((model) => servesAsType(model, 'text_llm'));
const suggestedModelKey = suggestion?.modelSource
? (textLlmModels.find((model) =>
isSuggestedExpandPromptModel(typeof model.source === 'string' ? model.source : null, suggestion)
diff --git a/invokeai/frontend/webv2/src/features/models/core/library.test.ts b/invokeai/frontend/webv2/src/features/models/core/library.test.ts
index aeca05da0e..4f24376430 100644
--- a/invokeai/frontend/webv2/src/features/models/core/library.test.ts
+++ b/invokeai/frontend/webv2/src/features/models/core/library.test.ts
@@ -9,6 +9,7 @@ import {
DEFAULT_LIBRARY_FILTERS,
filterModels,
getModelPickerGroups,
+ getQualifyingType,
groupModelsByType,
} from './library';
@@ -80,12 +81,93 @@ describe('filterModels', () => {
});
});
+const textLlm = createModel({
+ base: 'any',
+ key: 'llm',
+ name: 'Qwen3.5 9B VLM',
+ roles: [{ type: 'qwen3_5_encoder', variant: 'qwen3_5_9b' }],
+ type: 'text_llm',
+});
+const roleLibrary = [...library, textLlm];
+
+describe('role-serving models', () => {
+ it('filters by role type as well as primary type', () => {
+ const keys = (typeFilter: ModelConfig['type']) =>
+ filterModels(roleLibrary, { ...DEFAULT_LIBRARY_FILTERS, typeFilter }, NO_MISSING).map((m) => m.key);
+
+ expect(keys('qwen3_5_encoder')).toEqual(['llm']);
+ expect(keys('text_llm')).toEqual(['llm']);
+ expect(keys('qwen3_encoder')).toEqual([]);
+ });
+
+ it('finds a model by its role type in the search', () => {
+ expect(
+ filterModels(roleLibrary, { ...DEFAULT_LIBRARY_FILTERS, searchTerm: 'qwen3_5_encoder' }, NO_MISSING).map(
+ (m) => m.key
+ )
+ ).toEqual(['llm']);
+ });
+
+ it('lists the model in its primary and each role group, and only in the filtered one under a type filter', () => {
+ const groups = groupModelsByType(roleLibrary);
+ const entriesOf = (type: string) => groups.find((group) => group.type === type)?.entries;
+
+ expect(entriesOf('text_llm')).toEqual([{ model: textLlm, viaType: null }]);
+ expect(entriesOf('qwen3_5_encoder')).toEqual([{ model: textLlm, viaType: 'qwen3_5_encoder' }]);
+
+ const filtered = groupModelsByType([textLlm], 'qwen3_5_encoder');
+
+ expect(filtered.map((group) => group.type)).toEqual(['qwen3_5_encoder']);
+ // The only row of the model, so it keeps its plain identity.
+ expect(filtered[0]?.entries).toEqual([{ model: textLlm, viaType: null }]);
+ expect(groupModelsByType([textLlm], 'text_llm')[0]?.entries).toEqual([{ model: textLlm, viaType: null }]);
+ });
+
+ it('leads a picker with models of the asked type, then those that only serve as it', () => {
+ const encoder = createModel({ base: 'any', key: 'enc', name: 'Zeta Encoder', type: 'qwen3_5_encoder' });
+ const roleEncoder = createModel({
+ base: 'any',
+ key: 'role-enc',
+ name: 'Alpha Encoder',
+ roles: [{ type: 'text_llm' }],
+ type: 'qwen3_5_encoder',
+ });
+ const realLlm = createModel({ base: 'any', key: 'llm-z', name: 'Zeta LLM', type: 'text_llm' });
+ const keysFor = (models: ModelConfig[], modelTypes: ModelConfig['type'][]) =>
+ getModelPickerGroups(models, { modelTypes }).groups.flatMap((group) => group.models.map((m) => m.key));
+
+ // Name order alone would put the role candidates first.
+ expect(keysFor([roleEncoder, realLlm], ['text_llm'])).toEqual(['llm-z', 'role-enc']);
+ expect(keysFor([textLlm, encoder], ['qwen3_5_encoder'])).toEqual(['enc', 'llm']);
+ expect(getQualifyingType(textLlm, ['qwen3_5_encoder'])).toBe('qwen3_5_encoder');
+ expect(getQualifyingType(textLlm, ['text_llm', 'qwen3_5_encoder'])).toBe('text_llm');
+ });
+
+ it('collects role types', () => {
+ expect(collectTypes(roleLibrary)).toEqual(expect.arrayContaining(['text_llm', 'qwen3_5_encoder']));
+ });
+
+ it('offers a role-serving model to a picker of the role type and nothing else', () => {
+ const picker = (modelTypes: ModelConfig['type'][]) =>
+ getModelPickerGroups(roleLibrary, { modelTypes }).candidates.map((m) => m.key);
+
+ expect(picker(['qwen3_5_encoder'])).toEqual(['llm']);
+ expect(picker(['qwen3_encoder'])).toEqual([]);
+ expect(
+ getModelPickerGroups(roleLibrary, {
+ filter: (model) => model.roles?.[0]?.variant === 'qwen3_5_4b',
+ modelTypes: ['qwen3_5_encoder'],
+ }).candidates
+ ).toEqual([]);
+ });
+});
+
describe('groupModelsByType', () => {
it('groups in canonical category order', () => {
const groups = groupModelsByType(filterModels(library, DEFAULT_LIBRARY_FILTERS, NO_MISSING));
expect(groups.map((group) => group.type)).toEqual(['main', 'lora', 'vae']);
- expect(groups.reduce((count, group) => count + group.models.length, 0)).toBe(library.length);
+ expect(groups.reduce((count, group) => count + group.entries.length, 0)).toBe(library.length);
});
});
diff --git a/invokeai/frontend/webv2/src/features/models/core/library.ts b/invokeai/frontend/webv2/src/features/models/core/library.ts
index 93c8ff87eb..9618b18578 100644
--- a/invokeai/frontend/webv2/src/features/models/core/library.ts
+++ b/invokeai/frontend/webv2/src/features/models/core/library.ts
@@ -25,12 +25,24 @@ export const DEFAULT_LIBRARY_FILTERS: ModelLibraryFilters = {
typeFilter: null,
};
+/** A model listed in a type group; `viaType` is the role type when the group is a role type of a model listed there as well as under its primary type. */
+export interface ModelGroupEntry {
+ model: ModelConfig;
+ viaType: ModelTaxonomyType | null;
+}
+
export interface ModelGroup {
type: ModelTaxonomyType;
label: string;
- models: ModelConfig[];
+ entries: ModelGroupEntry[];
}
+type WithRoles = { type: ModelTaxonomyType; roles?: readonly { type: ModelTaxonomyType }[] };
+
+/** A model serves a type as its primary type or through a role. */
+export const modelServesType = (model: WithRoles, type: ModelTaxonomyType): boolean =>
+ model.type === type || (model.roles ?? []).some((role) => role.type === type);
+
export interface ModelPickerOptions {
/** Multi-select base filter; empty/undefined = all bases. */
baseFilter?: ReadonlySet<string>;
@@ -64,7 +76,7 @@ const matchesSearchTerms = (model: ModelConfig, terms: readonly string[]): boole
}
const haystack =
- `${model.name} ${model.description ?? ''} ${model.base} ${model.type} ${model.format} ${(model.trigger_phrases ?? []).join(' ')}`.toLowerCase();
+ `${model.name} ${model.description ?? ''} ${model.base} ${model.type} ${(model.roles ?? []).map((role) => role.type).join(' ')} ${model.format} ${(model.trigger_phrases ?? []).join(' ')}`.toLowerCase();
return terms.every((term) => haystack.includes(term));
};
@@ -103,39 +115,63 @@ export const filterModels = (
.filter(
(model) =>
(!filters.missingOnly || missingModelKeys.has(model.key)) &&
- (filters.typeFilter === null || model.type === filters.typeFilter) &&
+ (filters.typeFilter === null || modelServesType(model, filters.typeFilter)) &&
(filters.baseFilter === null || model.base === filters.baseFilter) &&
matchesSearchTerms(model, terms)
)
.sort((a, b) => compareBySortField(a, b, filters.sortField) * directionFactor);
};
-/** Group filtered models by category in canonical category order. */
-export const groupModelsByType = (models: ModelConfig[]): ModelGroup[] => {
- const groupsByType = new Map<ModelTaxonomyType, ModelConfig[]>();
-
- for (const model of models) {
- const group = groupsByType.get(model.type);
+/**
+ * Group filtered models by category in canonical category order. A model also sits in each of its role types'
+ * groups; under a type filter it sits in the filtered type's group only, as a plain entry.
+ */
+export const groupModelsByType = (models: ModelConfig[], typeFilter: ModelTaxonomyType | null = null): ModelGroup[] => {
+ const groupsByType = new Map<ModelTaxonomyType, ModelGroupEntry[]>();
+ const add = (type: ModelTaxonomyType, entry: ModelGroupEntry) => {
+ const group = groupsByType.get(type);
if (group) {
- group.push(model);
+ group.push(entry);
} else {
- groupsByType.set(model.type, [model]);
+ groupsByType.set(type, [entry]);
+ }
+ };
+
+ for (const model of models) {
+ if (typeFilter !== null) {
+ // Listed once, so it is the model's only row: no section-qualified identity needed.
+ add(typeFilter, { model, viaType: null });
+ continue;
+ }
+
+ add(model.type, { model, viaType: null });
+
+ for (const roleType of new Set((model.roles ?? []).map((role) => role.type))) {
+ if (roleType !== model.type) {
+ add(roleType, { model, viaType: roleType });
+ }
}
}
return [...groupsByType.entries()]
.sort(([a], [b]) => getModelCategoryRank(a) - getModelCategoryRank(b))
- .map(([type, groupModels]) => ({ label: getModelTypePluralLabel(type), models: groupModels, type }));
+ .map(([type, entries]) => ({ entries, label: getModelTypePluralLabel(type), type }));
};
+/** The type a candidate qualifies as in a picker: its primary type if asked for, else its first asked-for role type. */
+export const getQualifyingType = (model: WithRoles, allowedTypes: readonly string[]): ModelTaxonomyType =>
+ allowedTypes.includes(model.type)
+ ? model.type
+ : ((model.roles ?? []).find((role) => allowedTypes.includes(role.type))?.type ?? model.type);
+
/** Candidate, sort, and grouping rules shared by every model picker instance. */
const isModelPickerCandidate = (
model: ModelConfig,
allowedTypes: ReadonlySet<string>,
options: Pick<ModelPickerOptions, 'excludeKeys' | 'filter'>
): boolean =>
- allowedTypes.has(model.type) &&
+ (allowedTypes.has(model.type) || (model.roles ?? []).some((role) => allowedTypes.has(role.type))) &&
!options.excludeKeys?.has(model.key) &&
(options.filter ? options.filter(model) : true);
@@ -159,14 +195,18 @@ export const getModelPickerGroups = (models: ModelConfig[], options: ModelPicker
// everything out behind a hidden chip.
const baseFilter = new Set(availableBases.filter((base) => options.baseFilter?.has(base)));
const { relatedKeys } = options;
+ const qualifyingTypes = new Map(candidates.map((model) => [model, getQualifyingType(model, options.modelTypes)]));
+ const isNative = (model: ModelConfig) => qualifyingTypes.get(model) === model.type;
const visibleModels = candidates
.filter((model) => baseFilter.size === 0 || baseFilter.has(String(model.base)))
.sort(
(a, b) =>
getBaseDisplayRank(String(a.base)) - getBaseDisplayRank(String(b.base)) ||
String(a.base).localeCompare(String(b.base)) ||
+ // Models of the asked type lead; those that only serve as it follow.
+ Number(isNative(b)) - Number(isNative(a)) ||
Number(relatedKeys?.has(b.key) ?? false) - Number(relatedKeys?.has(a.key) ?? false) ||
- getModelCategoryRank(a.type) - getModelCategoryRank(b.type) ||
+ getModelCategoryRank(qualifyingTypes.get(a)!) - getModelCategoryRank(qualifyingTypes.get(b)!) ||
a.name.localeCompare(b.name, undefined, { sensitivity: 'base' })
);
@@ -216,5 +256,7 @@ export const collectBasesForDisplay = (models: Pick<ModelConfig, 'base'>[]): str
};
/** Distinct types present in a model list, in canonical order. */
-export const collectTypes = (models: Pick<ModelConfig, 'type'>[]): ModelTaxonomyType[] =>
- [...new Set(models.map((model) => model.type))].sort((a, b) => getModelCategoryRank(a) - getModelCategoryRank(b));
+export const collectTypes = (models: WithRoles[]): ModelTaxonomyType[] =>
+ [...new Set(models.flatMap((model) => [model.type, ...(model.roles ?? []).map((role) => role.type)]))].sort(
+ (a, b) => getModelCategoryRank(a) - getModelCategoryRank(b)
+ );
diff --git a/invokeai/frontend/webv2/src/features/models/core/relationships.test.ts b/invokeai/frontend/webv2/src/features/models/core/relationships.test.ts
index a7c3f172c2..f9a8283beb 100644
--- a/invokeai/frontend/webv2/src/features/models/core/relationships.test.ts
+++ b/invokeai/frontend/webv2/src/features/models/core/relationships.test.ts
@@ -8,6 +8,7 @@ import {
hasLinkableBase,
isBaseCompatible,
isLinkablePair,
+ isLinkableModel,
isLinkableType,
LINKABLE_TYPES,
NULL_BASE_ALLOWANCES,
@@ -144,6 +145,44 @@ describe('hasLinkableBase', () => {
});
});
+describe('models that serve as another type through a role', () => {
+ // A directly downloaded MOSS encoder: a Text LLM record whose files also serve as the Qwen3.5 encoder.
+ const roleEncoder: RelatableModel = {
+ base: 'any',
+ roles: [{ type: 'qwen3_5_encoder', variant: 'qwen3_5_9b' }],
+ type: 'text_llm',
+ };
+ const plainTextLlm: RelatableModel = { base: 'any', roles: [], type: 'text_llm' };
+
+ it('treats the model as linkable when any of its types is', () => {
+ expect(isLinkableModel(roleEncoder)).toBe(true);
+ expect(hasLinkableBase(roleEncoder)).toBe(true);
+ expect(isLinkableModel(plainTextLlm)).toBe(false);
+ expect(hasLinkableBase(plainTextLlm)).toBe(false);
+ expect(isLinkableModel({ type: 'text_llm' })).toBe(false);
+ });
+
+ it('links to the hosts its role type has an allowance for, and not to others', () => {
+ // The rule is by base like the native encoder's; the role variant (9B vs 4B) is not consulted.
+ expect(isLinkablePair(roleEncoder, model('moss-image', 'main'))).toBe(true);
+ expect(isLinkablePair(model('moss-image', 'main'), roleEncoder)).toBe(true);
+ expect(isLinkablePair(roleEncoder, model('sdxl', 'main'))).toBe(false);
+ });
+
+ it('never links a plain Text LLM', () => {
+ expect(isLinkablePair(plainTextLlm, model('moss-image', 'main'))).toBe(false);
+ expect(isLinkablePair(model('moss-image', 'main'), plainTextLlm)).toBe(false);
+ });
+
+ it('refuses a pair that shares a single-slot type through a role', () => {
+ const native: RelatableModel = { base: 'any', type: 'qwen3_5_encoder' };
+
+ expect(isLinkablePair(roleEncoder, native)).toBe(false);
+ expect(isLinkablePair(native, roleEncoder)).toBe(false);
+ expect(isLinkablePair(roleEncoder, { ...roleEncoder })).toBe(false);
+ });
+});
+
describe('LINKABLE_TYPES', () => {
it('includes every curated type', () => {
for (const type of Object.keys(NULL_BASE_ALLOWANCES)) {
diff --git a/invokeai/frontend/webv2/src/features/models/core/relationships.ts b/invokeai/frontend/webv2/src/features/models/core/relationships.ts
index 1a8427bb15..3f148c3539 100644
--- a/invokeai/frontend/webv2/src/features/models/core/relationships.ts
+++ b/invokeai/frontend/webv2/src/features/models/core/relationships.ts
@@ -2,7 +2,10 @@ import type { ModelBase, ModelConfig, ModelTaxonomyType } from './types';
/** Related-model links are symmetric curation hints and permit only models usable in one pipeline. */
-export type RelatableModel = Pick<ModelConfig, 'base' | 'type'>;
+/** The fields the compatibility rule reads. A model counts as each of its types: the primary one and its roles. */
+export type RelatableModel = Pick<ModelConfig, 'base' | 'roles' | 'type'>;
+
+const typesOf = (model: RelatableModel): ModelTaxonomyType[] => [model.type, ...(model.roles ?? []).map((r) => r.type)];
/**
* any denotes no base association, not universal compatibility; external and unknown convey no architecture
@@ -81,17 +84,22 @@ const LINKABLE_TYPE_SET: ReadonlySet<ModelTaxonomyType> = new Set(LINKABLE_TYPES
export const isLinkableType = (type: ModelTaxonomyType): boolean => LINKABLE_TYPE_SET.has(type);
+/** Whether any type the model counts as can be linked, e.g. a Text LLM that also serves as a Qwen3.5 encoder. */
+export const isLinkableModel = (model: Pick<RelatableModel, 'roles' | 'type'>): boolean =>
+ typesOf({ ...model, base: 'any' }).some(isLinkableType);
+
/** Only concrete bases or explicitly allowed any-based helper types can receive new links. */
export const hasLinkableBase = (model: RelatableModel): boolean =>
- !NULL_BASES.has(String(model.base)) || (model.base === 'any' && NULL_BASE_ALLOWANCES[model.type] !== undefined);
+ !NULL_BASES.has(String(model.base)) ||
+ (model.base === 'any' && typesOf(model).some((type) => NULL_BASE_ALLOWANCES[type] !== undefined));
const isAllowedHelperFor = (helper: RelatableModel, host: RelatableModel): boolean =>
helper.base === 'any' &&
!NULL_BASES.has(String(host.base)) &&
- (NULL_BASE_ALLOWANCES[helper.type]?.has(host.base) ?? false);
+ typesOf(helper).some((type) => NULL_BASE_ALLOWANCES[type]?.has(host.base) ?? false);
const isAllowedCrossBaseHelperFor = (helper: RelatableModel, host: RelatableModel): boolean =>
- CROSS_BASE_ALLOWANCES[helper.type]?.[helper.base]?.has(host.base) ?? false;
+ typesOf(helper).some((type) => CROSS_BASE_ALLOWANCES[type]?.[helper.base]?.has(host.base) ?? false);
/**
* Match concrete bases unless a helper allowance permits crossing; any-based models require explicit concrete-host
@@ -130,4 +138,4 @@ const SINGLETON_LINK_TYPES: ReadonlySet<ModelTaxonomyType> = new Set<ModelTaxono
/** The full candidate rule for the link picker: compatible bases, and no same-type pair of a single-slot type. */
export const isLinkablePair = (a: RelatableModel, b: RelatableModel): boolean =>
- isBaseCompatible(a, b) && !(a.type === b.type && SINGLETON_LINK_TYPES.has(a.type));
+ isBaseCompatible(a, b) && !typesOf(a).some((type) => SINGLETON_LINK_TYPES.has(type) && typesOf(b).includes(type));
diff --git a/invokeai/frontend/webv2/src/features/models/core/types.ts b/invokeai/frontend/webv2/src/features/models/core/types.ts
index 936487b536..de12e8a4ac 100644
--- a/invokeai/frontend/webv2/src/features/models/core/types.ts
+++ b/invokeai/frontend/webv2/src/features/models/core/types.ts
@@ -162,6 +162,13 @@ export interface ExternalModelCapabilities {
input_image_required_for?: ExternalGenerationMode[] | null;
}
+/** Another model type the same files serve as, besides the record's primary `type`. */
+export type ModelRole = {
+ type: ModelTaxonomyType;
+ format?: string | null;
+ variant?: string | null;
+};
+
/**
* A model config record. This is the union of fields across all backend config classes; fields not applicable to a
* given type/format are absent.
@@ -181,6 +188,8 @@ export interface ModelConfig {
type: ModelTaxonomyType;
format: ModelFileFormat;
variant?: string | null;
+ /** Other types these files serve as. The backend always sends it; older fixtures may omit it. */
+ roles?: ModelRole[];
prediction_type?: PredictionType | null;
config_path?: string | null;
cpu_only?: boolean | null;
diff --git a/invokeai/frontend/webv2/src/features/models/index.ts b/invokeai/frontend/webv2/src/features/models/index.ts
index a8a78a8ed8..21c3a5251e 100644
--- a/invokeai/frontend/webv2/src/features/models/index.ts
+++ b/invokeai/frontend/webv2/src/features/models/index.ts
@@ -3,6 +3,7 @@ export type {
ModelBase,
ModelConfig,
ModelFileFormat,
+ ModelRole,
ModelTaxonomyType,
PredictionType,
StarterModel,
diff --git a/invokeai/frontend/webv2/src/features/models/ui/components/ModelSelect.browser.test.tsx b/invokeai/frontend/webv2/src/features/models/ui/components/ModelSelect.browser.test.tsx
index ba7d50f6fe..6478d72969 100644
--- a/invokeai/frontend/webv2/src/features/models/ui/components/ModelSelect.browser.test.tsx
+++ b/invokeai/frontend/webv2/src/features/models/ui/components/ModelSelect.browser.test.tsx
@@ -109,6 +109,56 @@ describe('ModelSelect loading states', () => {
await expect.poll(() => document.querySelectorAll('[role="option"]').length).toBeGreaterThan(0);
};
+ const optionTexts = (): string[] =>
+ [...document.querySelectorAll('[role="option"]')].map((option) => option.textContent ?? '');
+
+ it('offers a Text LLM that serves a role in a picker of that type, without a type badge, and shows the role type in a mixed picker', async () => {
+ const textLlm = {
+ ...model,
+ base: 'any',
+ key: 'text-llm',
+ name: 'Qwen3.5 VLM',
+ roles: [{ type: 'qwen3_5_encoder', variant: 'qwen3_5_9b' }],
+ type: 'text_llm',
+ } as ModelConfig;
+ const encoder = {
+ ...model,
+ base: 'any',
+ key: 'encoder',
+ name: 'Plain Encoder',
+ type: 'qwen3_5_encoder',
+ } as ModelConfig;
+
+ setModelsSnapshotForTests({ error: null, models: [textLlm, model], status: 'loaded' });
+ await renderPicker({ id: 'test-role-only', modelTypes: ['qwen3_5_encoder'] });
+
+ // Only the role-serving model qualifies; a single-type picker shows no type badge at all.
+ expect(optionTexts()).toHaveLength(1);
+ expect(optionTexts()[0]).toContain('Qwen3.5 VLM');
+ expect(optionTexts()[0]).not.toContain('Text LLM');
+ expect(optionTexts()[0]).not.toContain('Qwen3.5 Encoder');
+
+ await act(() => root.unmount());
+ root = createRoot(host);
+ document.querySelectorAll('[data-scope="popover"]').forEach((element) => element.remove());
+ setModelsSnapshotForTests({ error: null, models: [textLlm, encoder], status: 'loaded' });
+ await renderPicker({ id: 'test-role-and-primary', modelTypes: ['qwen3_5_encoder'] });
+
+ expect(optionTexts().join(' ')).not.toContain('Qwen3.5 Encoder');
+ expect(optionTexts().join(' ')).not.toContain('Text LLM');
+
+ await act(() => root.unmount());
+ root = createRoot(host);
+ document.querySelectorAll('[data-scope="popover"]').forEach((element) => element.remove());
+ setModelsSnapshotForTests({ error: null, models: [textLlm, model], status: 'loaded' });
+ await renderPicker({ id: 'test-role-mixed', modelTypes: ['main', 'qwen3_5_encoder'] });
+
+ // In a mixed picker the role candidate shows the type it qualifies as, never its primary type.
+ expect(optionTexts().find((text) => text.includes('Qwen3.5 VLM'))).toContain('Qwen3.5 Encoder');
+ expect(optionTexts().find((text) => text.includes('Qwen3.5 VLM'))).not.toContain('Text LLM');
+ expect(optionTexts().find((text) => text.includes('SDXL Main'))).toContain('Main');
+ });
+
it('moves the active row across a group boundary and selects with Enter', async () => {
const onChange = vi.fn();
diff --git a/invokeai/frontend/webv2/src/features/models/ui/components/ModelSelect.tsx b/invokeai/frontend/webv2/src/features/models/ui/components/ModelSelect.tsx
index 707b2ba6da..2c7b90908e 100644
--- a/invokeai/frontend/webv2/src/features/models/ui/components/ModelSelect.tsx
+++ b/invokeai/frontend/webv2/src/features/models/ui/components/ModelSelect.tsx
@@ -18,7 +18,7 @@ import {
VisuallyHidden,
} from '@chakra-ui/react';
import { getModelBaseColorPalette, getModelBaseLabel, getModelBaseLongLabel } from '@features/models/core/baseIdentity';
-import { getModelPickerGroups, hasModelPickerCandidates } from '@features/models/core/library';
+import { getModelPickerGroups, getQualifyingType, hasModelPickerCandidates } from '@features/models/core/library';
import { getModelTypeLabel, getModelTypePluralLabel } from '@features/models/core/taxonomy';
import { getModelImageUrl } from '@features/models/data/api';
import { ensureModelsLoaded, useModelsSelector } from '@features/models/data/modelsStore';
@@ -214,7 +214,9 @@ export const ModelSelect = ({
);
const selectedModel = useModelsSelector((snapshot) => (value ? (snapshot.modelsByKey.get(value) ?? null) : null));
- const hasMixedTypes = useMemo(() => new Set(candidates.map((model) => model.type)).size > 1, [candidates]);
+ // The type a candidate qualifies as in this picker: its primary type, else the first role type asked for.
+ const effectiveType = useCallback((model: ModelConfig) => getQualifyingType(model, modelTypes), [modelTypes]);
+ const hasMixedTypes = useMemo(() => new Set(candidates.map(effectiveType)).size > 1, [candidates, effectiveType]);
const scopeLabel =
scopeLabelOverride ??
(modelTypes.length === 1
@@ -265,9 +267,10 @@ export const ModelSelect = ({
model={model}
showType={hasMixedTypes}
state={state}
+ type={effectiveType(model)}
/>
),
- [enableModelDescriptions, hasMixedTypes, relatedKeys, relatedToName]
+ [effectiveType, enableModelDescriptions, hasMixedTypes, relatedKeys, relatedToName]
);
return (
@@ -571,6 +574,7 @@ const ModelOptionContent = ({
relatedToName,
showType,
state,
+ type,
}: {
enableDescription: boolean;
isRelated: boolean;
@@ -578,6 +582,7 @@ const ModelOptionContent = ({
relatedToName: string | null;
showType: boolean;
state: PickerOptionState;
+ type: ModelTaxonomyType;
}) => {
const { t } = useTranslation();
const linkedLabel =
@@ -610,7 +615,7 @@ const ModelOptionContent = ({
{isRelated ? <VisuallyHidden>{`, ${linkedLabel}`}</VisuallyHidden> : null}
{showType ? (
<Badge colorPalette="gray" flexShrink={0} fontSize="xs" variant="surface">
- {getModelTypeLabel(model.type)}
+ {getModelTypeLabel(type)}
</Badge>
) : null}
</HStack>
diff --git a/invokeai/frontend/webv2/src/features/models/ui/detail/ModelDetail.browser.test.tsx b/invokeai/frontend/webv2/src/features/models/ui/detail/ModelDetail.browser.test.tsx
index be899fb4f4..a95218b825 100644
--- a/invokeai/frontend/webv2/src/features/models/ui/detail/ModelDetail.browser.test.tsx
+++ b/invokeai/frontend/webv2/src/features/models/ui/detail/ModelDetail.browser.test.tsx
@@ -19,7 +19,9 @@ vi.mock('./DefaultSettingsSection', () => ({ DefaultSettingsSection: section('de
vi.mock('./RelatedModelsSection', () => ({ RelatedModelsSection: section('related-models') }));
vi.mock('./TriggerPhrasesEditor', () => ({ MemoizedTriggerPhrasesEditor: section('trigger-phrases') }));
vi.mock('./WorkingMemorySection', () => ({ WorkingMemorySection: section('working-memory') }));
-vi.mock('react-i18next', () => ({ useTranslation: () => ({ t: (key: string) => key }) }));
+vi.mock('react-i18next', () => ({
+ useTranslation: () => ({ i18n: { resolvedLanguage: 'en' }, t: (key: string) => key }),
+}));
(globalThis as typeof globalThis & { IS_REACT_ACT_ENVIRONMENT: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
@@ -102,6 +104,40 @@ describe('ModelDetail', () => {
)
);
+ it('lists the roles a model also serves, and no row without any', async () => {
+ const withRoles = config('llm', 'text_llm', {
+ roles: [
+ { type: 'qwen3_5_encoder', variant: 'qwen3_5_9b' },
+ { format: null, type: 'qwen3_encoder' },
+ ],
+ });
+ setModelsSnapshotForTests({ models: [MAIN, withRoles], status: 'loaded' });
+ const alsoUsableAs = () =>
+ [...host.querySelectorAll('dt')].find((label) => label.textContent === 'models.alsoUsableAs')?.nextElementSibling
+ ?.textContent;
+
+ await renderDetail(withRoles.key);
+ expect(alsoUsableAs()).toBe('Qwen3.5 Encoder · Qwen3.5 9B (MOSS-Image) and Qwen3 Encoder');
+
+ await renderDetail(MAIN.key);
+ expect(alsoUsableAs()).toBeUndefined();
+ });
+
+ it('offers Related Models to a Text LLM only when it serves as a linkable type', async () => {
+ const encoderLlm = config('encoder-llm', 'text_llm', {
+ roles: [{ type: 'qwen3_5_encoder', variant: 'qwen3_5_9b' }],
+ });
+ const plainLlm = config('plain-llm', 'text_llm', { roles: [] });
+ setModelsSnapshotForTests({ models: [encoderLlm, plainLlm], status: 'loaded' });
+ const hasRelated = () => host.querySelector('[data-section="related-models"]') !== null;
+
+ await renderDetail(encoderLlm.key);
+ expect(hasRelated()).toBe(true);
+
+ await renderDetail(plainLlm.key);
+ expect(hasRelated()).toBe(false);
+ });
+
it('offers Run on CPU exactly when the config carries cpu_only', async () => {
setModelsSnapshotForTests({ models: [GEMMA4_ENCODER, QWEN3_VL_ENCODER_WITHOUT_CPU_ONLY], status: 'loaded' });
const hasCpuSwitch = () =>
diff --git a/invokeai/frontend/webv2/src/features/models/ui/detail/ModelDetail.tsx b/invokeai/frontend/webv2/src/features/models/ui/detail/ModelDetail.tsx
index 483f7a03b1..9daac09335 100644
--- a/invokeai/frontend/webv2/src/features/models/ui/detail/ModelDetail.tsx
+++ b/invokeai/frontend/webv2/src/features/models/ui/detail/ModelDetail.tsx
@@ -8,9 +8,14 @@ import {
supportsExternalModelSettings,
type ExternalModelSettingsModel,
} from '@features/models/core/externalModelFields';
-import { isLinkableType } from '@features/models/core/relationships';
+import { isLinkableModel } from '@features/models/core/relationships';
import { isAbsoluteModelPath, resolveModelAbsolutePath } from '@features/models/core/schemas';
-import { getModelSourceHref, getUnrecordedModelFact } from '@features/models/core/taxonomy';
+import {
+ getModelSourceHref,
+ getModelTypeLabel,
+ getModelVariantLabel,
+ getUnrecordedModelFact,
+} from '@features/models/core/taxonomy';
import { supportsWorkingMemoryCalibration } from '@features/models/core/workingMemory';
import { useModelsSelector, type ModelsSnapshot } from '@features/models/data/modelsStore';
import {
@@ -47,7 +52,7 @@ import { WorkingMemorySection } from './WorkingMemorySection';
const EMPTY_TRIGGER_PHRASES: readonly string[] = [];
-type ModelDetailShellModel = Pick<ModelConfig, 'key' | 'type'> & {
+type ModelDetailShellModel = Pick<ModelConfig, 'key' | 'roles' | 'type'> & {
hasCpuOnlySetting: boolean;
hasTriggerPhrases: boolean;
};
@@ -71,6 +76,7 @@ type ModelIdentityModel = Pick<
| 'provider_id'
| 'provider_model_id'
| 'repo_variant'
+ | 'roles'
| 'scale'
| 'source'
| 'source_type'
@@ -95,6 +101,7 @@ const selectModelShell = (snapshot: ModelsSnapshot, modelKey: string): ModelDeta
hasCpuOnlySetting: supportsCpuOnlySetting(model),
hasTriggerPhrases: model.trigger_phrases !== undefined && model.type !== 'control_lora',
key: model.key,
+ roles: model.roles,
type: model.type,
}
: null;
@@ -121,6 +128,7 @@ const selectModelIdentity = (snapshot: ModelsSnapshot, modelKey: string): ModelI
provider_id: model.provider_id,
provider_model_id: model.provider_model_id,
repo_variant: model.repo_variant,
+ roles: model.roles,
scale: model.scale,
source: model.source,
source_type: model.source_type,
@@ -233,7 +241,7 @@ export const ModelDetail = ({
</>
) : null}
- {isLinkableType(model.type) ? (
+ {isLinkableModel(model) ? (
<>
<Separator borderColor="border.subtle" />
<RelatedModelsSectionContainer modelKey={model.key} />
@@ -497,9 +505,15 @@ const RelatedModelsSectionContainer = memo(function RelatedModelsSectionContaine
(snapshot) => {
const candidate = snapshot.modelsByKey.get(modelKey);
- return candidate ? { base: candidate.base, key: candidate.key, type: candidate.type } : null;
+ return candidate
+ ? { base: candidate.base, key: candidate.key, roles: candidate.roles, type: candidate.type }
+ : null;
},
- (left, right) => left?.key === right?.key && left?.base === right?.base && left?.type === right?.type
+ (left, right) =>
+ left?.key === right?.key &&
+ left?.base === right?.base &&
+ left?.type === right?.type &&
+ left?.roles === right?.roles
);
const handleSectionError = useCallback(
(message: string) => notify.error(t('models.modelManager'), message),
@@ -514,7 +528,7 @@ const RelatedModelsSectionContainer = memo(function RelatedModelsSectionContaine
});
const ModelAttributes = ({ isMissing, model }: { isMissing: boolean; model: ModelIdentityModel }) => {
- const { t } = useTranslation();
+ const { i18n, t } = useTranslation();
const modelsDir = useModelsSelector((snapshot) => snapshot.modelsDir);
const [isPathDialogOpen, setIsPathDialogOpen] = useState(false);
const pathDialog = useExitPresence(isPathDialogOpen);
@@ -528,6 +542,20 @@ const ModelAttributes = ({ isMissing, model }: { isMissing: boolean; model: Mode
{ label: t('models.fileSize'), value: formatBytes(model.file_size) },
{ label: t('models.variant'), value: model.variant ?? '—' },
{ label: t('models.predictionType'), value: model.prediction_type ?? '—' },
+ ...(model.roles?.length
+ ? [
+ {
+ label: t('models.alsoUsableAs'),
+ value: new Intl.ListFormat(i18n.resolvedLanguage, { style: 'long', type: 'conjunction' }).format(
+ model.roles.map((role) =>
+ role.variant
+ ? `${getModelTypeLabel(role.type)} · ${getModelVariantLabel(role.variant)}`
+ : getModelTypeLabel(role.type)
+ )
+ ),
+ },
+ ]
+ : []),
// Recorded by the probe for upscalers; an unrecorded one is explained by the notice above instead.
...(typeof model.scale === 'number'
? [{ label: t('models.nativeScale'), value: t('models.nativeScaleValue', { scale: model.scale }) }]
diff --git a/invokeai/frontend/webv2/src/features/models/ui/detail/RelatedModelsSection.tsx b/invokeai/frontend/webv2/src/features/models/ui/detail/RelatedModelsSection.tsx
index 39c003a55d..b4b9ba5ad5 100644
--- a/invokeai/frontend/webv2/src/features/models/ui/detail/RelatedModelsSection.tsx
+++ b/invokeai/frontend/webv2/src/features/models/ui/detail/RelatedModelsSection.tsx
@@ -24,7 +24,7 @@ import { useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
interface RelatedModelsSectionProps {
- model: Pick<ModelConfig, 'base' | 'key' | 'type'>;
+ model: Pick<ModelConfig, 'base' | 'key' | 'roles' | 'type'>;
onError: (message: string) => void;
}
diff --git a/invokeai/frontend/webv2/src/features/models/ui/library/ModelLibraryList.browser.test.tsx b/invokeai/frontend/webv2/src/features/models/ui/library/ModelLibraryList.browser.test.tsx
index 05187a51b4..f62a8a0e4d 100644
--- a/invokeai/frontend/webv2/src/features/models/ui/library/ModelLibraryList.browser.test.tsx
+++ b/invokeai/frontend/webv2/src/features/models/ui/library/ModelLibraryList.browser.test.tsx
@@ -12,7 +12,11 @@ import { userEvent } from 'vitest/browser';
import { ModelLibraryList } from './ModelLibraryList';
-vi.mock('react-i18next', () => ({ useTranslation: () => ({ t: (key: string) => key }) }));
+vi.mock('react-i18next', () => ({
+ useTranslation: () => ({
+ t: (key: string, options?: Record<string, unknown>) => (options ? `${key} ${JSON.stringify(options)}` : key),
+ }),
+}));
(globalThis as typeof globalThis & { IS_REACT_ACT_ENVIRONMENT: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
@@ -37,16 +41,26 @@ const library: ModelConfig[] = [
const noop = () => undefined;
-const Harness = ({ filters }: { filters: ModelLibraryFilters }) => (
+const Harness = ({
+ activeModelKey = null,
+ filters,
+ onActivate = noop,
+ onToggleSelected = noop,
+}: {
+ activeModelKey?: string | null;
+ filters: ModelLibraryFilters;
+ onActivate?: (modelKey: string) => void;
+ onToggleSelected?: (modelKey: string) => void;
+}) => (
<ChakraProvider value={system}>
<div style={{ display: 'flex', flexDirection: 'column', height: '800px', width: '360px' }}>
<ModelLibraryList
- activeModelKey={null}
+ activeModelKey={activeModelKey}
filters={filters}
instanceId="manager"
selectedKeys={new Set<string>()}
- onActivate={noop}
- onToggleSelected={noop}
+ onActivate={onActivate}
+ onToggleSelected={onToggleSelected}
/>
</div>
</ChakraProvider>
@@ -146,6 +160,106 @@ describe('ModelLibraryList keyboard context menu', () => {
});
});
+describe('ModelLibraryList role rows', () => {
+ let host: HTMLDivElement;
+ let root: Root;
+ const textLlm = {
+ ...model('llm', 'text_llm'),
+ roles: [{ type: 'qwen3_5_encoder', variant: 'qwen3_5_9b' }],
+ } as ModelConfig;
+
+ beforeEach(() => {
+ accountLifecycle.activate('library-roles-test-a', ':user:library-roles-test-a');
+ setModelsSnapshotForTests({ models: [model('main-0', 'main'), textLlm], status: 'loaded' });
+ host = document.createElement('div');
+ document.body.append(host);
+ root = createRoot(host);
+ });
+
+ afterEach(async () => {
+ await act(() => root.unmount());
+ host.remove();
+ accountLifecycle.invalidate();
+ });
+
+ const renderList = async (props: Partial<Parameters<typeof Harness>[0]> = {}) => {
+ await act(() => root.render(<Harness filters={DEFAULT_LIBRARY_FILTERS} {...props} />));
+ await act(async () => {
+ await Promise.resolve();
+ });
+ };
+ const rowKeys = () => [...host.querySelectorAll('[data-list-row]')].map((row) => row.getAttribute('data-list-row'));
+ const roleRow = () => host.querySelector<HTMLElement>('[data-list-row="qwen3_5_encoder:llm"]')!;
+
+ it('lists the model under its primary type and again under each role type, with unique rows', async () => {
+ await renderList();
+
+ expect(rowKeys().filter((key) => key?.startsWith('header:') === false)).toEqual(
+ expect.arrayContaining(['main-0', 'llm', 'qwen3_5_encoder:llm'])
+ );
+ expect(new Set(rowKeys()).size).toBe(rowKeys().length);
+ expect(host.querySelectorAll('[data-list-row="llm"]')).toHaveLength(1);
+ });
+
+ it('shows the same tags on the role row, activates the same model and keeps the highlight on the primary row', async () => {
+ const onActivate = vi.fn();
+
+ await renderList({ activeModelKey: 'llm', onActivate });
+
+ // The same tags in every section: the role row reads exactly like the primary row.
+ expect(roleRow().textContent).toBe(host.querySelector('[data-list-row="llm"]')!.textContent);
+ expect(host.querySelector('[data-list-row="llm"] [aria-current="true"]')).not.toBeNull();
+ expect(roleRow().querySelector('[aria-current="true"]')).toBeNull();
+
+ await act(() => roleRow().querySelector<HTMLButtonElement>('[data-list-primary]')!.click());
+ expect(onActivate).toHaveBeenCalledExactlyOnceWith('llm');
+ });
+
+ it('names the section a role row is listed in, since sections are not announced', async () => {
+ await renderList();
+
+ const primaryLabel = host.querySelector('[data-list-row="llm"] [data-list-primary]')!.getAttribute('aria-label');
+ const roleLabel = roleRow().querySelector('[data-list-primary]')!.getAttribute('aria-label');
+
+ expect(primaryLabel).toBeNull();
+ expect(roleLabel).toContain('models.listedAs');
+ expect(roleLabel).toContain('Qwen3.5 Encoder');
+ });
+
+ it('selects the model, not the row, from a role row checkbox', async () => {
+ const onToggleSelected = vi.fn();
+
+ await renderList({ onToggleSelected });
+ await act(() => roleRow().querySelector<HTMLInputElement>('input[type="checkbox"]')!.click());
+
+ expect(onToggleSelected).toHaveBeenCalledExactlyOnceWith('llm');
+ });
+
+ it('opens the context menu for one row only', async () => {
+ await renderList();
+
+ await act(() => {
+ roleRow().dispatchEvent(
+ new MouseEvent('contextmenu', { bubbles: true, cancelable: true, clientX: 5, clientY: 5 })
+ );
+ });
+ await vi.waitFor(() => expect(document.querySelector('[role="menu"]')).not.toBeNull());
+
+ const open = [...host.querySelectorAll('[data-menu-open]')];
+
+ expect(open).toHaveLength(1);
+ expect(open[0]!.closest('[data-list-row]')?.getAttribute('data-list-row')).toBe('qwen3_5_encoder:llm');
+ });
+
+ it('lists the model once under the filtered type, as an ordinary row the list can mark current', async () => {
+ await renderList({ activeModelKey: 'llm', filters: { ...DEFAULT_LIBRARY_FILTERS, typeFilter: 'qwen3_5_encoder' } });
+
+ expect(rowKeys().filter((key) => !key?.startsWith('header:'))).toEqual(['llm']);
+ expect(host.querySelector('[data-list-row="llm"] [aria-current="true"]')).not.toBeNull();
+ expect(host.querySelector('[data-list-row="llm"] [data-list-primary]')!.getAttribute('aria-label')).toBeNull();
+ });
+});
+
describe('ModelLibraryList pinned group header', () => {
let host: HTMLDivElement;
let root: Root;
diff --git a/invokeai/frontend/webv2/src/features/models/ui/library/ModelLibraryList.tsx b/invokeai/frontend/webv2/src/features/models/ui/library/ModelLibraryList.tsx
index 071f6e01a2..d10e89078f 100644
--- a/invokeai/frontend/webv2/src/features/models/ui/library/ModelLibraryList.tsx
+++ b/invokeai/frontend/webv2/src/features/models/ui/library/ModelLibraryList.tsx
@@ -1,10 +1,15 @@
/* eslint-disable react-perf/jsx-no-jsx-as-prop, react-perf/jsx-no-new-array-as-prop, react-perf/jsx-no-new-function-as-prop, react-perf/jsx-no-new-object-as-prop */
-import type { ModelConfig } from '@features/models/core/types';
import type { ListRowProps } from '@platform/ui/list/List';
import type { ListContextMenuAnchor } from '@platform/ui/list/ListItem';
import { Box, Flex, HStack, Icon, Image } from '@chakra-ui/react';
-import { filterModels, groupModelsByType, type ModelLibraryFilters } from '@features/models/core/library';
+import {
+ filterModels,
+ groupModelsByType,
+ type ModelGroupEntry,
+ type ModelLibraryFilters,
+} from '@features/models/core/library';
+import { getModelTypeLabel } from '@features/models/core/taxonomy';
import { getModelImageUrl } from '@features/models/data/api';
import { useModelsSelector } from '@features/models/data/modelsStore';
import { MissingFileBadge, ModelBaseBadge, ModelFormatBadge } from '@features/models/ui/detail/ModelBadges';
@@ -22,7 +27,8 @@ import { useTranslation } from 'react-i18next';
import { ModelRowContextMenu, type ModelContextMenuTarget } from './ModelRowContextMenu';
-const getModelKey = (model: ModelConfig): string => model.key;
+/** A role row repeats the model under another type's section, so its row key carries that type. */
+const getRowKey = ({ model, viaType }: ModelGroupEntry): string => (viaType ? `${viaType}:${model.key}` : model.key);
export const ModelLibraryList = ({
activeModelKey,
@@ -57,12 +63,15 @@ export const ModelLibraryList = ({
left.status === right.status
);
const deferredFilters = useDeferredValue(filters);
- const [contextMenuTarget, setContextMenuTarget] = useState<ModelContextMenuTarget | null>(null);
+ const [contextMenuTarget, setContextMenuTarget] = useState<(ModelContextMenuTarget & { rowKey: string }) | null>(
+ null
+ );
const openAddModels = () => {
openModelManagerTab('add');
};
const handleContextMenu = useCallback(
- (modelKey: string, anchor: ListContextMenuAnchor) => setContextMenuTarget({ ...anchor, modelKey }),
+ (modelKey: string, anchor: ListContextMenuAnchor, rowKey: string) =>
+ setContextMenuTarget({ ...anchor, modelKey, rowKey }),
[]
);
const handleCloseContextMenu = useCallback(() => {
@@ -73,12 +82,14 @@ export const ModelLibraryList = ({
const rows = useMemo(
() =>
listRowsFromSections(
- groupModelsByType(filterModels(models, deferredFilters, missingModelKeys)).map((group) => ({
- items: group.models,
- key: group.type,
- label: group.label,
- })),
- getModelKey
+ groupModelsByType(filterModels(models, deferredFilters, missingModelKeys), deferredFilters.typeFilter).map(
+ (group) => ({
+ items: group.entries,
+ key: group.type,
+ label: group.label,
+ })
+ ),
+ getRowKey
),
[deferredFilters, missingModelKeys, models]
);
@@ -90,24 +101,31 @@ export const ModelLibraryList = ({
[instanceId]
);
- const renderItem = (model: ModelConfig, rowProps: ListRowProps) => (
- <ModelRow
- {...rowProps}
- base={model.base}
- coverImage={model.cover_image}
- fileSize={model.file_size}
- format={model.format}
- imageVersion={coverImageVersions[model.key]}
- isMenuOpen={contextMenuTarget?.modelKey === model.key}
- isMissing={missingModelKeys.has(model.key)}
- isSelected={selectedKeys.has(model.key)}
- modelKey={model.key}
- name={model.name}
- onActivate={onActivate}
- onContextMenu={handleContextMenu}
- onToggleSelected={onToggleSelected}
- />
- );
+ const renderItem = (entry: ModelGroupEntry, rowProps: ListRowProps) => {
+ const { model, viaType } = entry;
+ const rowKey = getRowKey(entry);
+
+ return (
+ <ModelRow
+ {...rowProps}
+ base={model.base}
+ coverImage={model.cover_image}
+ fileSize={model.file_size}
+ format={model.format}
+ imageVersion={coverImageVersions[model.key]}
+ isMenuOpen={contextMenuTarget?.rowKey === rowKey}
+ isMissing={missingModelKeys.has(model.key)}
+ isSelected={selectedKeys.has(model.key)}
+ modelKey={model.key}
+ name={model.name}
+ pressLabel={viaType ? t('models.listedAs', { name: model.name, type: getModelTypeLabel(viaType) }) : undefined}
+ onActivate={onActivate}
+ onContextMenu={handleContextMenu}
+ onToggleSelected={onToggleSelected}
+ rowKey={rowKey}
+ />
+ );
+ };
return (
<>
@@ -154,9 +172,12 @@ interface ModelRowProps extends ListRowProps {
isSelected: boolean;
modelKey: string;
name: string;
+ /** Role rows repeat a model under another section; the name says which one, since sections are not announced. */
+ pressLabel?: string;
onActivate: (modelKey: string) => void;
- onContextMenu: (modelKey: string, anchor: ListContextMenuAnchor) => void;
+ onContextMenu: (modelKey: string, anchor: ListContextMenuAnchor, rowKey: string) => void;
onToggleSelected: (modelKey: string) => void;
+ rowKey: string;
}
const ModelRow = memo(function ModelRow({
@@ -169,9 +190,11 @@ const ModelRow = memo(function ModelRow({
isSelected,
modelKey,
name,
+ pressLabel,
onActivate,
onContextMenu,
onToggleSelected,
+ rowKey,
...rowProps
}: ModelRowProps) {
// Per-row subscription: a keystroke in one model's draft re-renders only a row whose marker flips.
@@ -179,8 +202,8 @@ const ModelRow = memo(function ModelRow({
const handlePress = useCallback(() => onActivate(modelKey), [modelKey, onActivate]);
const handleCheckedChange = useCallback(() => onToggleSelected(modelKey), [modelKey, onToggleSelected]);
const handleContextMenu = useCallback(
- (anchor: ListContextMenuAnchor) => onContextMenu(modelKey, anchor),
- [modelKey, onContextMenu]
+ (anchor: ListContextMenuAnchor) => onContextMenu(modelKey, anchor, rowKey),
+ [modelKey, onContextMenu, rowKey]
);
return (
@@ -204,6 +227,7 @@ const ModelRow = memo(function ModelRow({
modelKey={modelKey}
/>
}
+ pressLabel={pressLabel}
title={name}
trailing={formatBytes(fileSize)}
onCheckedChange={handleCheckedChange}
diff --git a/invokeai/frontend/webv2/src/features/upscale/core/settings.test.ts b/invokeai/frontend/webv2/src/features/upscale/core/settings.test.ts
index edcc36a53a..1b881228e6 100644
--- a/invokeai/frontend/webv2/src/features/upscale/core/settings.test.ts
+++ b/invokeai/frontend/webv2/src/features/upscale/core/settings.test.ts
@@ -98,6 +98,20 @@ describe('upscale settings', () => {
});
});
+ it('keeps a saved Text LLM that serves as the encoder through a role, and drops one without the role', () => {
+ const textLlm = {
+ ...model('llm', 'text_llm', 'any'),
+ roles: [{ type: 'qwen3_encoder', variant: 'qwen3_4b' }],
+ };
+
+ expect(normalizeUpscaleWidgetValues({ qwen3EncoderModel: textLlm })).toMatchObject({
+ qwen3EncoderModel: { key: 'llm', type: 'text_llm' },
+ });
+ expect(normalizeUpscaleWidgetValues({ qwen3EncoderModel: { ...textLlm, roles: [] } })).toMatchObject({
+ qwen3EncoderModel: null,
+ });
+ });
+
it('normalizes partial persisted values and calculates multiple-of-eight output dimensions', () => {
expect(
normalizeUpscaleWidgetValues({ negativePromptHeightPx: 4, positivePrompt: 'detail', positivePromptHeightPx: 999 })
@@ -207,6 +221,23 @@ const QWEN3_4B = withVariant(model('qwen3-4b', 'qwen3_encoder', 'any'), 'qwen3_4
const QWEN3_8B = withVariant(model('qwen3-8b', 'qwen3_encoder', 'any'), 'qwen3_8b');
const QWEN3_06B = withVariant(model('qwen3-06b', 'qwen3_encoder', 'any'), 'qwen3_06b');
describe('text encoder and VAE components', () => {
+ it('offers a Qwen3 4B Text LLM to Z-Image upscale through its role and refuses an 8B one', () => {
+ const roleLlm = (variant: string): ModelConfig =>
+ ({ ...model(`llm-${variant}`, 'text_llm', 'any'), roles: [{ type: 'qwen3_encoder', variant }] }) as ModelConfig;
+ const values = (llm: ModelConfig) => ({
+ ...createDefaultUpscaleWidgetValues([
+ model('spandrel', 'spandrel_image_to_image', 'any'),
+ model('z', 'main', 'z-image'),
+ model('flux-vae', 'vae', 'flux'),
+ llm,
+ ]),
+ inputImage: { height: 64, image_name: 'in.png', width: 64 },
+ });
+
+ expect(values(roleLlm('qwen3_4b')).qwen3EncoderModel?.key).toBe('llm-qwen3_4b');
+ expect(values(roleLlm('qwen3_8b')).qwen3EncoderModel).toBeNull();
+ });
+
const ready = (models: ModelConfig[]) => ({
...createDefaultUpscaleWidgetValues(models),
inputImage: { height: 64, image_name: 'in.png', width: 64 },
diff --git a/invokeai/frontend/webv2/src/features/upscale/core/settings.ts b/invokeai/frontend/webv2/src/features/upscale/core/settings.ts
index 362d8d033c..993c54b4d6 100644
--- a/invokeai/frontend/webv2/src/features/upscale/core/settings.ts
+++ b/invokeai/frontend/webv2/src/features/upscale/core/settings.ts
@@ -37,6 +37,7 @@ import {
MIN_NEGATIVE_PROMPT_HEIGHT_PX,
MIN_POSITIVE_PROMPT_HEIGHT_PX,
sanitizeBatchCount,
+ servesAsType,
} from '@features/generation/settings';
import { isSeedMode, SEED_MAX } from '@platform/core/seed';
@@ -490,7 +491,7 @@ export const isSupportedUpscaleMainModel = (value: unknown): value is MainModelC
isMainModelConfig(value) && isUpscaleBase(value.base);
const isComponentModelOfType = (value: unknown, type: string): value is ComponentModelConfig =>
- isRecord(value) && value.type === type && isModelIdentifierConfig(value);
+ isRecord(value) && isModelIdentifierConfig(value) && servesAsType(value, type);
type UpscaleComponentValues = Record<UpscaleComponentField, ComponentModelConfig | null>;
diff --git a/invokeai/frontend/webv2/src/features/workflow/core/modelRequirements.test.ts b/invokeai/frontend/webv2/src/features/workflow/core/modelRequirements.test.ts
index bc0005c27b..27c0c9d3c4 100644
--- a/invokeai/frontend/webv2/src/features/workflow/core/modelRequirements.test.ts
+++ b/invokeai/frontend/webv2/src/features/workflow/core/modelRequirements.test.ts
@@ -330,6 +330,32 @@ describe('resolveWorkflowModelRequirements', () => {
expect(resolved).toMatchObject({ matchedModelName: 'Some SDXL Checkpoint', status: 'installed' });
});
+ it('resolves a slot requirement through a role of an installed model, not by type alone', () => {
+ const requirement: WorkflowModelRequirement = {
+ base: null,
+ kind: 'slot',
+ label: 'Qwen3.5 Encoder',
+ modelType: 'qwen3_5_encoder',
+ };
+ const roleServing: InstalledModelSummary = {
+ base: 'any',
+ hash: 'h',
+ key: 'llm',
+ name: 'Qwen3.5 9B VLM',
+ roles: [{ type: 'qwen3_5_encoder' }],
+ type: 'text_llm',
+ };
+ const resolve = (installedModels: InstalledModelSummary[]) =>
+ resolveWorkflowModelRequirements([requirement], {
+ activeInstallSources: new Set(),
+ installedModels,
+ starterModels: [],
+ })[0];
+
+ expect(resolve([roleServing])).toMatchObject({ matchedModelName: 'Qwen3.5 9B VLM', status: 'installed' });
+ expect(resolve([{ ...roleServing, roles: [] }])).toMatchObject({ status: 'unresolvable' });
+ });
+
it('matches a starter catalog entry via previous_names, case-insensitively', () => {
const requirement: WorkflowModelRequirement = {
identifier: { base: 'sdxl', key: 'missing-key', name: 'old name', type: 'main' },
diff --git a/invokeai/frontend/webv2/src/features/workflow/core/modelRequirements.ts b/invokeai/frontend/webv2/src/features/workflow/core/modelRequirements.ts
index 95e90983fe..32dd8fd085 100644
--- a/invokeai/frontend/webv2/src/features/workflow/core/modelRequirements.ts
+++ b/invokeai/frontend/webv2/src/features/workflow/core/modelRequirements.ts
@@ -1,3 +1,5 @@
+import type { ModelRole } from '@features/models';
+
import type {
FieldInputTemplate,
InvocationTemplate,
@@ -352,6 +354,7 @@ export interface InstalledModelSummary {
name: string;
base: string;
type: string;
+ roles?: readonly ModelRole[];
}
export interface StarterCatalogEntry {
@@ -410,14 +413,16 @@ const findInstalledForExact = (
return null;
};
+/** A model fills a slot of `modelType` through its primary type or any role (null = any type). */
+const servesType = (model: InstalledModelSummary, modelType: string | null): boolean =>
+ modelType === null || model.type === modelType || (model.roles ?? []).some((role) => role.type === modelType);
+
const findInstalledForSlot = (
base: string | null,
modelType: string | null,
installedModels: readonly InstalledModelSummary[]
): InstalledModelSummary | null =>
- installedModels.find(
- (model) => (base === null || model.base === base) && (modelType === null || model.type === modelType)
- ) ?? null;
+ installedModels.find((model) => (base === null || model.base === base) && servesType(model, modelType)) ?? null;
const matchesStarterName = (starter: StarterCatalogEntry, name: string): boolean => {
const target = name.toLowerCase();
diff --git a/tests/app/invocations/test_anima_model_loader.py b/tests/app/invocations/test_anima_model_loader.py
index f9ff857b8b..54584be170 100644
--- a/tests/app/invocations/test_anima_model_loader.py
+++ b/tests/app/invocations/test_anima_model_loader.py
@@ -4,7 +4,15 @@ import pytest
from invokeai.app.invocations.anima.anima_model_loader import AnimaModelLoaderInvocation, AnimaModelLoaderOutput
from invokeai.app.invocations.model import ModelIdentifierField
-from invokeai.backend.model_manager.taxonomy import AnimaVariantType, BaseModelType, ModelType, Qwen35VariantType
+from invokeai.backend.model_manager.taxonomy import (
+ AnimaVariantType,
+ BaseModelType,
+ ModelType,
+ Qwen3VariantType,
+ Qwen35VariantType,
+ SubModelType,
+)
+from tests.fixtures.model_roles import node_context, text_llm_file, text_llm_qwen3_folder
def _model(key: str, base: BaseModelType, model_type: ModelType) -> ModelIdentifierField:
@@ -41,3 +49,38 @@ def test_anima_3_8b_refuses_a_qwen3_5_encoder_of_another_size(variant: Qwen35Var
"""
with pytest.raises(ValueError, match="'My Qwen3.5 encoder' is not a Qwen3.5 4B encoder"):
_load_anima_3_8b(variant)
+
+
+def _load_with_text_llms(qwen3_5_variant: Qwen35VariantType | None) -> AnimaModelLoaderOutput:
+ configs = {
+ "anima": SimpleNamespace(name="Anima-3.8B", type=ModelType.Main, variant=AnimaVariantType.Qwen35),
+ "qwen3": text_llm_qwen3_folder("qwen3", Qwen3VariantType.Qwen3_06B),
+ "qwen35": text_llm_file("qwen35", qwen3_5_variant),
+ }
+ return AnimaModelLoaderInvocation(
+ model=_model("anima", BaseModelType.Anima, ModelType.Main),
+ vae_model=_model("vae", BaseModelType.QwenImage, ModelType.VAE),
+ qwen3_encoder_model=_model("qwen3", BaseModelType.Any, ModelType.TextLLM),
+ qwen3_5_encoder_model=_model("qwen35", BaseModelType.Any, ModelType.TextLLM),
+ ).invoke(node_context(configs)) # type: ignore[arg-type]
+
+
+def test_text_llms_serving_as_the_encoders_are_emitted_in_those_roles() -> None:
+ output = _load_with_text_llms(Qwen35VariantType.Qwen35_4B)
+
+ assert output.qwen3_5_encoder is not None
+ qwen3 = output.qwen3_encoder
+ qwen3_5 = output.qwen3_5_encoder
+ assert [(f.key, f.type, f.submodel_type) for f in (qwen3.text_encoder, qwen3.tokenizer)] == [
+ ("qwen3", ModelType.Qwen3Encoder, SubModelType.TextEncoder),
+ ("qwen3", ModelType.Qwen3Encoder, SubModelType.Tokenizer),
+ ]
+ assert [(f.key, f.type, f.submodel_type) for f in (qwen3_5.text_encoder, qwen3_5.tokenizer)] == [
+ ("qwen35", ModelType.Qwen35Encoder, SubModelType.TextEncoder),
+ ("qwen35", ModelType.Qwen35Encoder, SubModelType.Tokenizer),
+ ]
+
+
+def test_a_text_llm_without_the_4b_encoder_role_is_refused_by_name() -> None:
+ with pytest.raises(ValueError, match="'qwen35 llm' is not a Qwen3.5 4B encoder"):
+ _load_with_text_llms(None)
diff --git a/tests/app/invocations/test_flux2_klein_model_loader.py b/tests/app/invocations/test_flux2_klein_model_loader.py
index 3bd20232e9..fd30fff7a7 100644
--- a/tests/app/invocations/test_flux2_klein_model_loader.py
+++ b/tests/app/invocations/test_flux2_klein_model_loader.py
@@ -13,7 +13,15 @@ import pytest
from invokeai.app.invocations.flux2.flux2_klein_model_loader import Flux2KleinModelLoaderInvocation
from invokeai.app.invocations.model import ModelIdentifierField
-from invokeai.backend.model_manager.taxonomy import BaseModelType, ModelFormat, ModelType, SubModelType
+from invokeai.backend.model_manager.taxonomy import (
+ BaseModelType,
+ Flux2VariantType,
+ ModelFormat,
+ ModelType,
+ Qwen3VariantType,
+ SubModelType,
+)
+from tests.fixtures.model_roles import node_context, text_llm_qwen3_folder
def _make_main_model() -> ModelIdentifierField:
@@ -66,3 +74,44 @@ class TestFlux2KleinSelfContainedSDNQ:
config = SimpleNamespace(format=ModelFormat.SDNQQuantized, submodels=None, name="FLUX.2 single file")
with pytest.raises(ValueError, match="No VAE source"):
invocation.invoke(_make_context(config))
+
+
+class TestQwen3TextLLMServingAsEncoder:
+ """A Qwen3 folder installed as a Text LLM serves as the Klein encoder; the node asks for that role."""
+
+ @staticmethod
+ def _invoke(llm_variant: Qwen3VariantType | None):
+ encoder = ModelIdentifierField(
+ key="llm", hash="h-llm", name="llm folder", base=BaseModelType.Any, type=ModelType.TextLLM
+ )
+ vae = ModelIdentifierField(
+ key="vae", hash="h-vae", name="FLUX.2 VAE", base=BaseModelType.Flux2, type=ModelType.VAE
+ )
+ configs = {
+ "flux2-sdnq-key": SimpleNamespace(
+ name="Klein 4B",
+ type=ModelType.Main,
+ format=ModelFormat.GGUFQuantized,
+ variant=Flux2VariantType.Klein4B,
+ submodels=None,
+ ),
+ "llm": text_llm_qwen3_folder("llm", llm_variant),
+ }
+ invocation = Flux2KleinModelLoaderInvocation(
+ model=_make_main_model(), vae_model=vae, qwen3_encoder_model=encoder
+ )
+ return invocation.invoke(node_context(configs)) # type: ignore[arg-type]
+
+ def test_the_matching_folder_is_emitted_as_a_qwen3_encoder(self):
+ output = self._invoke(Qwen3VariantType.Qwen3_4B)
+
+ for field in (output.qwen3_encoder.text_encoder, output.qwen3_encoder.tokenizer):
+ assert (field.key, field.type) == ("llm", ModelType.Qwen3Encoder)
+
+ def test_a_folder_of_the_wrong_size_is_refused_by_its_role_variant(self):
+ with pytest.raises(ValueError, match="requires qwen3_4b encoder, but qwen3_8b was selected"):
+ self._invoke(Qwen3VariantType.Qwen3_8B)
+
+ def test_a_folder_without_the_role_is_refused_naming_the_selection(self):
+ with pytest.raises(ValueError, match="'llm folder' is not a Qwen3 encoder.*or a Text LLM that serves as one"):
+ self._invoke(None)
diff --git a/tests/app/invocations/test_flux2_model_loader_source_guards.py b/tests/app/invocations/test_flux2_model_loader_source_guards.py
index 82fac315e2..fe271d1953 100644
--- a/tests/app/invocations/test_flux2_model_loader_source_guards.py
+++ b/tests/app/invocations/test_flux2_model_loader_source_guards.py
@@ -71,7 +71,10 @@ def test_klein_loader_extracts_vae_from_a_dev_pipeline() -> None:
name="Klein 4B", format=ModelFormat.GGUFQuantized, variant=Flux2VariantType.Klein4B
),
"qwen3-4b": SimpleNamespace(
- name="Qwen3 4B", format=ModelFormat.Diffusers, variant=Qwen3VariantType.Qwen3_4B
+ type=ModelType.Qwen3Encoder,
+ name="Qwen3 4B",
+ format=ModelFormat.Diffusers,
+ variant=Qwen3VariantType.Qwen3_4B,
),
"flux2-dev-diffusers": SimpleNamespace(
name="FLUX.2 [dev]", format=ModelFormat.Diffusers, variant=Flux2VariantType.Dev
@@ -201,7 +204,10 @@ def test_klein_loader_rejects_a_standalone_encoder_from_the_wrong_family() -> No
name="Klein 4B", format=ModelFormat.GGUFQuantized, variant=Flux2VariantType.Klein4B
),
"qwen3-8b": SimpleNamespace(
- name="Qwen3 8B", format=ModelFormat.Diffusers, variant=Qwen3VariantType.Qwen3_8B
+ type=ModelType.Qwen3Encoder,
+ name="Qwen3 8B",
+ format=ModelFormat.Diffusers,
+ variant=Qwen3VariantType.Qwen3_8B,
),
"klein-diffusers": SimpleNamespace(
name="Klein 4B", format=ModelFormat.Diffusers, variant=Flux2VariantType.Klein4B
@@ -290,7 +296,10 @@ def test_vae_source_must_still_be_diffusers(source_format: ModelFormat) -> None:
name="Klein 4B", format=ModelFormat.GGUFQuantized, variant=Flux2VariantType.Klein4B
),
"qwen3-4b": SimpleNamespace(
- name="Qwen3 4B", format=ModelFormat.Diffusers, variant=Qwen3VariantType.Qwen3_4B
+ type=ModelType.Qwen3Encoder,
+ name="Qwen3 4B",
+ format=ModelFormat.Diffusers,
+ variant=Qwen3VariantType.Qwen3_4B,
),
"not-diffusers": SimpleNamespace(
name="Klein single-file", format=source_format, variant=Flux2VariantType.Klein4B
diff --git a/tests/app/invocations/test_moss_image_model_loader.py b/tests/app/invocations/test_moss_image_model_loader.py
index 4216c17cf4..0cdf9383db 100644
--- a/tests/app/invocations/test_moss_image_model_loader.py
+++ b/tests/app/invocations/test_moss_image_model_loader.py
@@ -16,6 +16,7 @@ from invokeai.backend.model_manager.taxonomy import (
Qwen35VariantType,
SubModelType,
)
+from tests.fixtures.model_roles import node_context, text_llm_file
def _model(key: str, base: BaseModelType, model_type: ModelType) -> ModelIdentifierField:
@@ -110,3 +111,31 @@ def test_a_vae_from_another_latent_space_is_refused() -> None:
def test_a_main_model_of_another_architecture_is_refused() -> None:
with pytest.raises(ValueError, match="'Krea-2' is not a MOSS-Image main model"):
_load("krea2")
+
+
+def _load_with_roles(encoder_key: str) -> MossImageModelLoaderOutput:
+ configs = {
+ **_CONFIGS,
+ "llm-9b": text_llm_file("llm-9b", Qwen35VariantType.Qwen35_9B),
+ "llm-4b": text_llm_file("llm-4b", Qwen35VariantType.Qwen35_4B),
+ "llm-plain": text_llm_file("llm-plain", None),
+ }
+ return MossImageModelLoaderInvocation(
+ model=_model("moss-diffusers", BaseModelType.MossImage, ModelType.Main),
+ # The UI puts the record's own type on the node.
+ qwen3_5_encoder_model=_model(encoder_key, BaseModelType.Any, ModelType.TextLLM),
+ ).invoke(node_context(configs)) # type: ignore[arg-type]
+
+
+def test_a_text_llm_serving_as_the_9b_encoder_is_accepted_and_emitted_as_an_encoder() -> None:
+ output = _load_with_roles("llm-9b")
+
+ for field in (output.qwen3_5_encoder.text_encoder, output.qwen3_5_encoder.tokenizer):
+ assert (field.key, field.type) == ("llm-9b", ModelType.Qwen35Encoder)
+ assert output.qwen3_5_encoder.text_encoder.submodel_type is SubModelType.TextEncoder
+
+
[email protected]("key", ["llm-4b", "llm-plain"])
+def test_a_text_llm_without_the_9b_encoder_role_is_refused_by_name(key: str) -> None:
+ with pytest.raises(ValueError, match=f"'{key} llm' is not a Qwen3.5 9B encoder.*or a Text LLM that serves as one"):
+ _load_with_roles(key)
diff --git a/tests/app/invocations/test_text_llm.py b/tests/app/invocations/test_text_llm.py
index 2f6d664184..3af066aa46 100644
--- a/tests/app/invocations/test_text_llm.py
+++ b/tests/app/invocations/test_text_llm.py
@@ -61,3 +61,31 @@ def test_the_node_takes_its_tokenizer_from_the_model_loader(monkeypatch: pytest.
assert requested == [SubModelType.Tokenizer, None]
assert _RecordingPipeline.received == [tokenizer]
context.models.get_absolute_path.assert_not_called()
+
+
+def test_the_node_asks_for_the_model_as_a_text_llm(monkeypatch: pytest.MonkeyPatch) -> None:
+ # A Qwen3.5 encoder record whose whole-model file serves as a Text LLM is offered in the field with its own type.
+ asked: list[tuple[str, str]] = []
+
+ def load(identifier: ModelIdentifierField, submodel_type: SubModelType | None = None) -> Any:
+ asked.append((identifier.key, identifier.type.value))
+ loaded = MagicMock()
+ if submodel_type is SubModelType.Tokenizer:
+ loaded.model = MagicMock(spec=PreTrainedTokenizerBase)
+ else:
+ loaded.model_on_device.return_value.__enter__.return_value = (None, torch.nn.Linear(1, 1))
+ return loaded
+
+ context = MagicMock()
+ context.models.load.side_effect = load
+ monkeypatch.setattr(text_llm_module, "TextLLMPipeline", _RecordingPipeline)
+ node = TextLLMInvocation(
+ id="text-llm",
+ prompt="a fox",
+ text_llm_model=ModelIdentifierField(key="enc", hash="x", name="enc", base="any", type="qwen3_5_encoder"),
+ seed=1,
+ )
+
+ node.invoke(context)
+
+ assert asked == [("enc", "text_llm"), ("enc", "text_llm")]
diff --git a/tests/app/invocations/test_z_image_model_loader.py b/tests/app/invocations/test_z_image_model_loader.py
index 18ba774d79..58f5be3a1f 100644
--- a/tests/app/invocations/test_z_image_model_loader.py
+++ b/tests/app/invocations/test_z_image_model_loader.py
@@ -21,6 +21,7 @@ from invokeai.backend.model_manager.taxonomy import (
Qwen3VariantType,
SubModelType,
)
+from tests.fixtures.model_roles import node_context, text_llm_qwen3_folder
def _make_main_model() -> ModelIdentifierField:
@@ -211,3 +212,40 @@ class TestQwen3SourceFieldTemplate:
return False
assert not is_filtered_out(sdnq_pipeline_config)
+
+
+class TestQwen3TextLLMServingAsEncoder:
+ """A Qwen3 folder installed as a Text LLM serves as the Qwen3 encoder; the node asks for that role."""
+
+ @staticmethod
+ def _invoke(llm_variant: Qwen3VariantType | None):
+ # The UI puts the record's own type (text_llm) on the node.
+ encoder = ModelIdentifierField(
+ key="llm", hash="h-llm", name="llm folder", base=BaseModelType.Any, type=ModelType.TextLLM
+ )
+ vae = ModelIdentifierField(
+ key="vae", hash="h-vae", name="FLUX VAE", base=BaseModelType.Flux, type=ModelType.VAE
+ )
+ configs = {
+ "z-image-sdnq-key": SimpleNamespace(
+ type=ModelType.Main, format=ModelFormat.GGUFQuantized, submodels=None, name="Z-Image GGUF"
+ ),
+ "llm": text_llm_qwen3_folder("llm", llm_variant),
+ }
+ invocation = ZImageModelLoaderInvocation(model=_make_main_model(), vae_model=vae, qwen3_encoder_model=encoder)
+ return invocation.invoke(node_context(configs)) # type: ignore[arg-type]
+
+ def test_the_4b_folder_is_emitted_as_a_qwen3_encoder(self):
+ output = self._invoke(Qwen3VariantType.Qwen3_4B)
+
+ for field in (output.qwen3_encoder.text_encoder, output.qwen3_encoder.tokenizer):
+ assert (field.key, field.type) == ("llm", ModelType.Qwen3Encoder)
+ assert output.qwen3_encoder.text_encoder.submodel_type is SubModelType.TextEncoder
+
+ def test_a_folder_of_another_size_is_refused_by_its_role_variant(self):
+ with pytest.raises(ValueError, match="'llm folder' is a Qwen3 encoder of variant 'qwen3_8b'"):
+ self._invoke(Qwen3VariantType.Qwen3_8B)
+
+ def test_a_folder_without_the_role_keeps_the_clear_refusal(self):
+ with pytest.raises(ValueError, match="'llm folder' is not a Qwen3 encoder"):
+ self._invoke(None)
diff --git a/tests/app/routers/test_starter_model_is_installed.py b/tests/app/routers/test_starter_model_is_installed.py
index 35a9ff2b06..f60dc7da39 100644
--- a/tests/app/routers/test_starter_model_is_installed.py
+++ b/tests/app/routers/test_starter_model_is_installed.py
@@ -18,6 +18,7 @@ from invokeai.backend.model_manager.starter_models.common import (
)
from invokeai.backend.model_manager.starter_models.types import StarterModel
from invokeai.backend.model_manager.taxonomy import Qwen3VariantType
+from tests.fixtures.model_roles import text_llm_qwen3_folder
FP4_ENCODER_STARTERS = [
(z_image_qwen3_encoder_fp4, Qwen3VariantType.Qwen3_4B, Qwen3VariantType.Qwen3_8B),
@@ -45,6 +46,17 @@ def test_an_fp4_encoder_starter_is_satisfied_by_an_installed_encoder_of_its_size
assert not get_is_installed(starter, [_installed_encoder(other_size)])
+ ("starter", "size", "other_size"), FP4_ENCODER_STARTERS, ids=["z_image_4b", "klein_4b", "klein_8b"]
+)
+def test_a_qwen3_folder_installed_as_a_text_llm_satisfies_the_encoder_starter_of_its_size_only(
+ starter: StarterModel, size: Qwen3VariantType, other_size: Qwen3VariantType
+) -> None:
+ assert get_is_installed(starter, [text_llm_qwen3_folder("llm", size)])
+ assert not get_is_installed(starter, [text_llm_qwen3_folder("llm", other_size)])
+ assert not get_is_installed(starter, [text_llm_qwen3_folder("llm", None)])
+
+
def test_a_renamed_install_from_a_superseded_source_still_counts_as_installed() -> None:
from invokeai.app.api.routers.model_manager import get_is_installed as is_installed
from invokeai.backend.model_manager.configs.main import Main_Checkpoint_Flux3_Config
diff --git a/tests/app/services/model_load/test_model_load_common.py b/tests/app/services/model_load/test_model_load_common.py
index 4884b76277..c7bce7619b 100644
--- a/tests/app/services/model_load/test_model_load_common.py
+++ b/tests/app/services/model_load/test_model_load_common.py
@@ -12,6 +12,9 @@ from types import SimpleNamespace
import pytest
from invokeai.app.services.model_load.model_load_common import load_settings_changed
+from invokeai.backend.model_manager.configs.roles import view_as
+from invokeai.backend.model_manager.taxonomy import ModelType, Qwen35VariantType
+from tests.fixtures.model_roles import text_llm_file
def _config(*, fp8: bool | None = None, cpu_only: bool | None = None, **fields):
@@ -96,3 +99,14 @@ def test_path_made_absolute_by_the_loader_matches_its_stored_record(tmp_path: Pa
assert load_settings_changed(loaded_from, stored, models_path=tmp_path) is False
assert load_settings_changed(loaded_from, _config(path="sd-1/main/other.safetensors"), models_path=tmp_path)
+
+
+def test_a_role_view_differs_from_its_record_but_not_from_the_view_of_an_unchanged_record():
+ record = text_llm_file("llm")
+ view = view_as(record, ModelType.Qwen35Encoder)
+
+ assert load_settings_changed(view, record)
+ assert not load_settings_changed(view, view_as(record, ModelType.Qwen35Encoder))
+ assert load_settings_changed(
+ view, view_as(text_llm_file("llm", Qwen35VariantType.Qwen35_4B), ModelType.Qwen35Encoder)
+ )
diff --git a/tests/app/services/model_load/test_models_interface_roles.py b/tests/app/services/model_load/test_models_interface_roles.py
new file mode 100644
index 0000000000..54850ad4ea
--- /dev/null
+++ b/tests/app/services/model_load/test_models_interface_roles.py
@@ -0,0 +1,67 @@
+"""`ModelsInterface` resolves a `ModelIdentifierField` to the record, or to its view in the role the identifier's type
+names; `get_config` and `load` agree."""
+
+from types import SimpleNamespace
+from unittest.mock import MagicMock
+
+import pytest
+
+from invokeai.app.invocations.model import ModelIdentifierField
+from invokeai.app.services.shared.invocation_context import ModelsInterface
+from invokeai.backend.model_manager.configs.qwen3_5_encoder import Qwen35Encoder_Checkpoint_Config
+from invokeai.backend.model_manager.configs.text_llm import TextLLM_Checkpoint_Config
+from invokeai.backend.model_manager.taxonomy import BaseModelType, ModelType, SubModelType
+from tests.fixtures.model_roles import text_llm_file
+
+
+def _identifier(model_type: ModelType, submodel_type: SubModelType | None = None) -> ModelIdentifierField:
+ return ModelIdentifierField(
+ key="llm", hash="h", name="llm", base=BaseModelType.Any, type=model_type, submodel_type=submodel_type
+ )
+
+
+def models() -> ModelsInterface:
+ records = {"llm": text_llm_file("llm")}
+ services = SimpleNamespace(
+ model_manager=SimpleNamespace(
+ store=SimpleNamespace(get_model=lambda key: records[key]),
+ load=SimpleNamespace(load_model=lambda config, submodel_type=None, user_id=None: (config, submodel_type)),
+ )
+ )
+ data = SimpleNamespace(queue_item=SimpleNamespace(user_id="user"))
+ return ModelsInterface(services, data, MagicMock()) # type: ignore[arg-type]
+
+
+def test_an_identifier_of_the_records_own_type_or_a_key_resolves_to_the_stored_record(models: ModelsInterface) -> None:
+ assert isinstance(models.get_config(_identifier(ModelType.TextLLM)), TextLLM_Checkpoint_Config)
+ assert isinstance(models.get_config("llm"), TextLLM_Checkpoint_Config)
+
+
+def test_an_identifier_of_a_role_the_record_serves_resolves_to_its_view(models: ModelsInterface) -> None:
+ config = models.get_config(_identifier(ModelType.Qwen35Encoder))
+
+ assert isinstance(config, Qwen35Encoder_Checkpoint_Config)
+ assert config.role_of is ModelType.TextLLM
+
+
+def test_an_identifier_of_a_type_the_record_does_not_serve_reaches_the_node_with_the_stored_record(
+ models: ModelsInterface,
+) -> None:
+ config = models.get_config(_identifier(ModelType.Qwen3Encoder))
+
+ assert isinstance(config, TextLLM_Checkpoint_Config)
+ assert config.role_of is None
+
+
+def test_load_loads_the_view_and_keeps_the_identifiers_submodel(models: ModelsInterface) -> None:
+ config, submodel = models.load(_identifier(ModelType.Qwen35Encoder, SubModelType.Tokenizer)) # type: ignore[misc]
+
+ assert isinstance(config, Qwen35Encoder_Checkpoint_Config) and config.role_of is ModelType.TextLLM
+ assert submodel is SubModelType.Tokenizer
+
+
+def test_load_by_key_loads_the_stored_record(models: ModelsInterface) -> None:
+ config, _ = models.load("llm") # type: ignore[misc]
+
+ assert isinstance(config, TextLLM_Checkpoint_Config)
diff --git a/tests/app/services/model_load/test_stale_model_load_fence.py b/tests/app/services/model_load/test_stale_model_load_fence.py
index 694be0da42..0d3bfcaa03 100644
--- a/tests/app/services/model_load/test_stale_model_load_fence.py
+++ b/tests/app/services/model_load/test_stale_model_load_fence.py
@@ -16,6 +16,8 @@ from invokeai.app.services.config import InvokeAIAppConfig
from invokeai.app.services.model_load.model_load_default import ModelLoadService
from invokeai.app.services.model_records import ModelRecordChanges, ModelRecordServiceSQL
from invokeai.backend.model_manager.configs.factory import AnyModelConfig
+from invokeai.backend.model_manager.configs.qwen3_5_encoder import Qwen35Encoder_Checkpoint_Config
+from invokeai.backend.model_manager.configs.roles import view_as
from invokeai.backend.model_manager.configs.siglip import SigLIP_Diffusers_Config
from invokeai.backend.model_manager.load import (
LoadedModel,
@@ -25,8 +27,9 @@ from invokeai.backend.model_manager.load import (
StaleModelConfigError,
)
from invokeai.backend.model_manager.load.model_cache.model_cache import MODEL_LOAD_LOCK
-from invokeai.backend.model_manager.taxonomy import AnyModel, SubModelType
+from invokeai.backend.model_manager.taxonomy import AnyModel, ModelType, SubModelType
from invokeai.backend.util.logging import InvokeAILogger
+from tests.fixtures.model_roles import text_llm_file
from tests.fixtures.sqlite_database import create_mock_sqlite_database
KEY = "siglip-key"
@@ -743,3 +746,36 @@ def test_loader_built_directly_on_the_base_is_refused_before_it_can_cache(harnes
service.load_model(store.get_model(KEY))
assert not _is_cached(cache)
assert events.log == [("started", "siglip"), ("complete", "siglip")]
+
+
+# A role view is compared with the stored record in the same role: its type and class never equal the record's.
+
+ROLE_KEY = "llm-key"
+
+
+def _role_view(store: ModelRecordServiceSQL) -> AnyModelConfig:
+ store.add_model(text_llm_file(ROLE_KEY))
+ return view_as(store.get_model(ROLE_KEY), ModelType.Qwen35Encoder)
+
+
+def test_a_role_view_of_an_unchanged_record_is_current_and_a_moved_one_is_not(harness):
+ service, store, _, _ = harness
+ view = _role_view(store)
+
+ assert service._config_is_current(view)
+ assert service._moved_record(view) is None
+
+ store.update_model(ROLE_KEY, ModelRecordChanges(path="llm/other"))
+
+ assert not service._config_is_current(view)
+ moved = service._moved_record(view)
+ assert isinstance(moved, Qwen35Encoder_Checkpoint_Config) and moved.path == "llm/other"
+
+
+def test_a_role_view_of_a_record_that_lost_the_role_is_not_current_and_has_no_moved_record(harness):
+ service, store, _, _ = harness
+ view = _role_view(store)
+ store.replace_model(ROLE_KEY, text_llm_file(ROLE_KEY, serves_encoder=None))
+
+ assert not service._config_is_current(view)
+ assert service._moved_record(view) is None
diff --git a/tests/app/services/model_manager/test_model_record_changes.py b/tests/app/services/model_manager/test_model_record_changes.py
index c3a4996f3e..daf6a0fe1a 100644
--- a/tests/app/services/model_manager/test_model_record_changes.py
+++ b/tests/app/services/model_manager/test_model_record_changes.py
@@ -3,6 +3,7 @@ instances of the model exactly when the change affects how it loads. The load fe
themselves to is covered by `tests/app/services/model_load/test_stale_model_load_fence.py`."""
import gc
+import json
import re
import threading
import time
@@ -31,17 +32,20 @@ from invokeai.backend.model_manager.configs.factory import AnyModelConfig, Model
from invokeai.backend.model_manager.configs.ip_adapter import IPAdapter_InvokeAI_SD1_Config
from invokeai.backend.model_manager.configs.main import Main_Checkpoint_SD1_Config, Main_Checkpoint_SDXL_Config
from invokeai.backend.model_manager.configs.qwen3_5_encoder import Qwen35Encoder_Checkpoint_Config
+from invokeai.backend.model_manager.configs.roles import ModelRoleError, view_as
from invokeai.backend.model_manager.configs.spandrel import Spandrel_Checkpoint_Config
-from invokeai.backend.model_manager.configs.text_llm import TextLLM_Checkpoint_Config
+from invokeai.backend.model_manager.configs.text_llm import TextLLM_Checkpoint_Config, TextLLM_Diffusers_Config
from invokeai.backend.model_manager.load import LoadedModel, ModelCache, ModelLoader
from invokeai.backend.model_manager.load.model_cache.model_cache import MODEL_LOAD_LOCK
from invokeai.backend.model_manager.starter_models import STARTER_MODELS, StarterModel
from invokeai.backend.model_manager.taxonomy import (
AnyModel,
BaseModelType,
+ ModelFormat,
ModelSourceType,
ModelType,
ModelVariantType,
+ Qwen3VariantType,
Qwen35VariantType,
SubModelType,
)
@@ -59,6 +63,7 @@ from tests.backend.model_manager.load.state_dicts import (
flux3_pup_int8_convrot_keys,
)
from tests.backend.model_manager.load.state_dicts.utils import write_header_only_safetensors
+from tests.fixtures.model_roles import text_llm_file
from tests.fixtures.spandrel_models import write_compact_upscaler
from tests.fixtures.sqlite_database import create_mock_sqlite_database
from tests.fixtures.tiny_autoencoders import (
@@ -435,7 +440,8 @@ def _write_moss_int8_encoder(path: Path) -> Path:
def test_reidentify_keeps_a_local_qwen3_5_encoder_an_encoder(harness: _Harness) -> None:
- """A local copy has no source to tell the encoder from the upsampler, so the type it was installed with stays."""
+ """The weights cannot tell the encoder from the upsampler, so the type it was installed with stays; the file
+ gains the Text LLM role."""
path = _write_moss_int8_encoder(harness.models_path / "encoder.safetensors")
installed = _identify(
path,
@@ -451,9 +457,12 @@ def test_reidentify_keeps_a_local_qwen3_5_encoder_an_encoder(harness: _Harness)
assert isinstance(updated, Qwen35Encoder_Checkpoint_Config)
assert updated.variant is Qwen35VariantType.Qwen35_9B
+ assert [role.type for role in updated.roles] == [ModelType.TextLLM]
-def test_reidentify_repairs_a_text_llm_record_installed_from_comfy_orgs_encoder_url(harness: _Harness) -> None:
+def test_reidentify_keeps_a_text_llm_from_comfy_orgs_encoder_url_a_text_llm_serving_as_the_encoder(
+ harness: _Harness,
+) -> None:
path = _write_moss_int8_encoder(harness.models_path / "encoder.safetensors")
installed = _identify(path, key=KEY, path="encoder.safetensors", name="encoder")
assert isinstance(installed, TextLLM_Checkpoint_Config)
@@ -462,8 +471,60 @@ def test_reidentify_repairs_a_text_llm_record_installed_from_comfy_orgs_encoder_
updated = harness.manager.reidentify_model(KEY)
- assert isinstance(updated, Qwen35Encoder_Checkpoint_Config)
+ assert isinstance(updated, TextLLM_Checkpoint_Config)
assert updated.source == _COMFY_MOSS_INT8_URL
+ assert [(role.type, role.variant) for role in updated.roles] == [
+ (ModelType.Qwen35Encoder, Qwen35VariantType.Qwen35_9B)
+ ]
+
+
+def test_reidentify_gives_a_record_stored_without_roles_the_roles_of_its_files(harness: _Harness) -> None:
+ """Records written before roles existed carry none; Re-identify is how they gain them."""
+ path = _write_moss_int8_encoder(harness.models_path / "encoder.safetensors")
+ llm = _identify(path, key=KEY, path="encoder.safetensors", name="llm")
+ assert isinstance(llm, TextLLM_Checkpoint_Config)
+ llm.roles = []
+ harness.store.add_model(llm)
+
+ updated = harness.manager.reidentify_model(KEY)
+
+ assert [(role.type, role.variant) for role in updated.roles] == [
+ (ModelType.Qwen35Encoder, Qwen35VariantType.Qwen35_9B)
+ ]
+ harness.store.del_model(KEY)
+
+ encoder = _identify(
+ path,
+ {"type": ModelType.Qwen35Encoder, "variant": Qwen35VariantType.Qwen35_9B},
+ key=KEY,
+ path="encoder.safetensors",
+ name="encoder",
+ )
+ encoder.roles = []
+ harness.store.add_model(encoder)
+
+ updated = harness.manager.reidentify_model(KEY)
+
+ assert isinstance(updated, Qwen35Encoder_Checkpoint_Config)
+ assert [role.type for role in updated.roles] == [ModelType.TextLLM]
+
+
+def test_reidentify_gives_a_qwen3_folder_stored_without_roles_its_encoder_role(harness: _Harness) -> None:
+ folder = harness.models_path / "qwen3-4b"
+ folder.mkdir()
+ (folder / "config.json").write_text(json.dumps({"architectures": ["Qwen3ForCausalLM"], "hidden_size": 2560}))
+ (folder / "tokenizer.json").write_text("{}")
+ installed = _identify(folder, key=KEY, path="qwen3-4b", name="Qwen3 4B")
+ assert isinstance(installed, TextLLM_Diffusers_Config)
+ installed.roles = []
+ harness.store.add_model(installed)
+
+ updated = harness.manager.reidentify_model(KEY)
+
+ assert isinstance(updated, TextLLM_Diffusers_Config)
+ assert [(role.type, role.format, role.variant) for role in updated.roles] == [
+ (ModelType.Qwen3Encoder, ModelFormat.Qwen3Encoder, Qwen3VariantType.Qwen3_4B)
+ ]
def test_reidentify_keeps_an_ip_adapter_encoder_override_its_files_leave_blank(harness: _Harness) -> None:
@@ -645,3 +706,82 @@ def test_reidentify_of_files_no_config_accepts_raises_and_keeps_the_record(harne
def test_reidentify_of_an_unknown_model_raises(harness: _Harness) -> None:
with pytest.raises(UnknownModelException):
harness.manager.reidentify_model(KEY)
+
+
+# A record that serves as another type loads through that type's config class and cache entry.
+
+
+def _add_text_llm(harness: _Harness) -> None:
+ """A Text LLM record serving as the Qwen3.5 encoder, with the files the loader checks for."""
+ for name in (KEY, "other.safetensors"):
+ (harness.models_path / "llm").mkdir(exist_ok=True)
+ (harness.models_path / "llm" / name).write_bytes(b"")
+ harness.store.add_model(text_llm_file(KEY))
+
+
+def _cached_entries(harness: _Harness) -> set[str]:
+ return set(harness.caches[0]._cached_models)
+
+
+def test_a_role_view_loads_through_the_role_class_into_its_own_cache_entry(harness: _Harness) -> None:
+ _add_text_llm(harness)
+ record = harness.store.get_model(KEY)
+
+ as_encoder = harness.manager.load.load_model(view_as(record, ModelType.Qwen35Encoder))
+ as_llm = harness.manager.load.load_model(record)
+
+ assert isinstance(as_encoder.config, Qwen35Encoder_Checkpoint_Config)
+ assert isinstance(as_llm.config, TextLLM_Checkpoint_Config)
+ assert _RecordingLoader.built_from == ["Qwen35Encoder_Checkpoint_Config", "TextLLM_Checkpoint_Config"]
+ assert _cached_entries(harness) == {KEY, f"{KEY}:as_qwen3_5_encoder"}
+
+
+def test_a_role_view_of_an_unchanged_record_is_current_and_loads_once(harness: _Harness) -> None:
+ _add_text_llm(harness)
+ view = view_as(harness.store.get_model(KEY), ModelType.Qwen35Encoder)
+
+ first = harness.manager.load.load_model(view)
+ second = harness.manager.load.load_model(view)
+
+ assert first.model is second.model
+ assert _RecordingLoader.built_from == ["Qwen35Encoder_Checkpoint_Config"]
+
+
+def test_a_load_affecting_update_drops_the_primary_and_role_entries(harness: _Harness) -> None:
+ _add_text_llm(harness)
+ record = harness.store.get_model(KEY)
+ for config in (record, view_as(record, ModelType.Qwen35Encoder)):
+ # Used and released, as a node does. A wrapper dropped unused releases its first-use hold on the cache's
+ # worker thread, and an update that runs before that thread only marks the entry stale.
+ with harness.manager.load.load_model(config):
+ pass
+ assert len(_cached_entries(harness)) == 2
+
+ harness.manager.update_model_record(KEY, ModelRecordChanges(path="llm/other.safetensors"))
+
+ assert _cached_entries(harness) == set()
+
+
+def test_a_view_loaded_after_the_record_moved_is_rebuilt_from_the_moved_record_in_its_role(harness: _Harness) -> None:
+ _add_text_llm(harness)
+ stale_view = view_as(harness.store.get_model(KEY), ModelType.Qwen35Encoder)
+ harness.manager.update_model_record(KEY, ModelRecordChanges(path="llm/other.safetensors"))
+
+ loaded = harness.manager.load.load_model(stale_view)
+
+ assert isinstance(loaded.config, Qwen35Encoder_Checkpoint_Config)
+ assert loaded.config.path.endswith("other.safetensors")
+ assert _RecordingLoader.built_from == ["Qwen35Encoder_Checkpoint_Config"]
+
+
+def test_a_record_that_lost_the_role_meanwhile_fails_with_a_role_error_instead_of_loading_as_another_type(
+ harness: _Harness,
+) -> None:
+ _add_text_llm(harness)
+ view = view_as(harness.store.get_model(KEY), ModelType.Qwen35Encoder)
+ harness.store.replace_model(KEY, text_llm_file(KEY, serves_encoder=None))
+
+ with pytest.raises(ModelRoleError):
+ harness.manager.load.load_model(view)
+
+ assert _RecordingLoader.built_from == []
diff --git a/tests/app/services/model_records/test_model_records_sql.py b/tests/app/services/model_records/test_model_records_sql.py
index f044a99ccb..831591f0bb 100644
--- a/tests/app/services/model_records/test_model_records_sql.py
+++ b/tests/app/services/model_records/test_model_records_sql.py
@@ -22,7 +22,7 @@ from invokeai.app.services.shared.database.database import Database
from invokeai.app.services.shared.database.queries.models import MAX_KEY_LENGTH, MAX_PATH_LENGTH, ModelQueries
from invokeai.app.services.shared.database.schema.models import models
from invokeai.app.services.shared.pagination import SQLiteDirection
-from invokeai.backend.model_manager.configs.base import Config_Base
+from invokeai.backend.model_manager.configs.base import Config_Base, ModelRole
from invokeai.backend.model_manager.configs.controlnet import ControlAdapterDefaultSettings
from invokeai.backend.model_manager.configs.lora import LoRA_LyCORIS_SD1_Config, LoRA_LyCORIS_SDXL_Config
from invokeai.backend.model_manager.configs.main import (
@@ -32,6 +32,7 @@ from invokeai.backend.model_manager.configs.main import (
Main_Diffusers_SDXL_Config,
MainModelDefaultSettings,
)
+from invokeai.backend.model_manager.configs.qwen3_5_encoder import Qwen35Encoder_Checkpoint_Config
from invokeai.backend.model_manager.configs.qwen3_encoder import Qwen3Encoder_Qwen3Encoder_Config
from invokeai.backend.model_manager.configs.qwen3_vl_encoder import Qwen3VLEncoder_Checkpoint_MiniMaxH3_Config
from invokeai.backend.model_manager.configs.text_llm import TextLLM_Checkpoint_Config, TextLLM_Diffusers_Config
@@ -46,6 +47,7 @@ from invokeai.backend.model_manager.taxonomy import (
ModelType,
ModelVariantType,
Qwen3VariantType,
+ Qwen35VariantType,
SchedulerPredictionType,
)
from invokeai.backend.util.logging import InvokeAILogger
@@ -868,3 +870,102 @@ def test_a_key_or_path_longer_than_a_record_holds_is_refused(store: ModelRecordS
with pytest.raises(ValueError, match="path"):
store.update_model("key1", ModelRecordChanges(path=too_long_path))
assert store.get_model("key1").path == "/tmp/key1.bin"
+
+
+def _text_llm_serving_as_the_qwen3_5_encoder() -> TextLLM_Checkpoint_Config:
+ return TextLLM_Checkpoint_Config(
+ key="key1",
+ source="test/source/",
+ source_type=ModelSourceType.Path,
+ path="/tmp/qwen3.5_9b.safetensors",
+ file_size=1024,
+ name="Qwen3.5 9B",
+ hash="ABC123",
+ roles=[ModelRole(type=ModelType.Qwen35Encoder, variant=Qwen35VariantType.Qwen35_9B)],
+ )
+
+
+def test_a_manual_type_change_discards_the_roles(store: ModelRecordServiceBase) -> None:
+ """Roles are derived by identification; a type change would leave them describing the old type."""
+ store.add_model(_text_llm_serving_as_the_qwen3_5_encoder())
+
+ encoder = store.update_model(
+ "key1",
+ ModelRecordChanges(type=ModelType.Qwen35Encoder, variant=Qwen35VariantType.Qwen35_9B),
+ allow_class_change=True,
+ )
+ assert isinstance(encoder, Qwen35Encoder_Checkpoint_Config)
+ assert encoder.roles == []
+
+
+def test_a_manual_type_change_back_to_a_text_llm_also_discards_the_roles(store: ModelRecordServiceBase) -> None:
+ store.add_model(
+ Qwen35Encoder_Checkpoint_Config(
+ key="key1",
+ source="test/source/",
+ source_type=ModelSourceType.Path,
+ path="/tmp/qwen3.5_9b.safetensors",
+ file_size=1024,
+ name="Qwen3.5 9B",
+ hash="ABC123",
+ variant=Qwen35VariantType.Qwen35_9B,
+ roles=[ModelRole(type=ModelType.TextLLM)],
+ )
+ )
+
+ text_llm = store.update_model("key1", ModelRecordChanges(type=ModelType.TextLLM), allow_class_change=True)
+
+ assert isinstance(text_llm, TextLLM_Checkpoint_Config)
+ assert text_llm.roles == []
+ assert store.get_model("key1").roles == []
+
+
+def test_a_change_that_keeps_the_type_keeps_the_roles(store: ModelRecordServiceBase) -> None:
+ store.add_model(_text_llm_serving_as_the_qwen3_5_encoder())
+
+ for allow_class_change in (False, True):
+ updated = store.update_model(
+ "key1", ModelRecordChanges(name=f"renamed {allow_class_change}"), allow_class_change=allow_class_change
+ )
+ assert [role.type for role in updated.roles] == [ModelType.Qwen35Encoder]
+ assert [role.type for role in store.get_model("key1").roles] == [ModelType.Qwen35Encoder]
+
+
+def _stored(store: ModelRecordServiceSQL, key: str) -> dict:
+ stored = store._queries.models.get(key)
+ assert stored is not None
+ return json.loads(stored)
+
+
+def test_a_record_without_roles_is_stored_without_a_roles_key(store: ModelRecordServiceSQL) -> None:
+ """A build that predates roles must still read every record this one writes: a config that forbids extra fields
+ would drop one carrying `roles: []`."""
+ store.add_model(example_ti_config("plain"))
+ with_roles = _text_llm_serving_as_the_qwen3_5_encoder()
+ store.add_model(with_roles)
+
+ assert "roles" not in _stored(store, "plain")
+ assert store.get_model("plain").roles == []
+ assert len(_stored(store, "key1")["roles"]) == 1
+ assert [role.type for role in store.get_model("key1").roles] == [ModelType.Qwen35Encoder]
+
+ store.update_model("plain", ModelRecordChanges(name="renamed"))
+ store.replace_model("key1", store.get_model("key1").model_copy(update={"roles": []}))
+ assert "roles" not in _stored(store, "plain")
+ assert "roles" not in _stored(store, "key1")
+
+
+def test_resending_the_same_type_with_base_and_format_keeps_the_roles(store: ModelRecordServiceSQL) -> None:
+ """The edit form posts type, base and format back with every save."""
+ store.add_model(_text_llm_serving_as_the_qwen3_5_encoder())
+
+ updated = store.update_model(
+ "key1",
+ ModelRecordChanges(
+ type=ModelType.TextLLM, base=BaseModelType.Any, format=ModelFormat.Checkpoint, name="renamed"
+ ),
+ allow_class_change=True,
+ )
+
+ assert [role.type for role in updated.roles] == [ModelType.Qwen35Encoder]
+ assert [role.type for role in store.get_model("key1").roles] == [ModelType.Qwen35Encoder]
diff --git a/tests/app/services/working_memory_calibration/test_working_memory_calibration_plan.py b/tests/app/services/working_memory_calibration/test_working_memory_calibration_plan.py
index 5d1ea71bad..840534fc20 100644
--- a/tests/app/services/working_memory_calibration/test_working_memory_calibration_plan.py
+++ b/tests/app/services/working_memory_calibration/test_working_memory_calibration_plan.py
@@ -25,6 +25,7 @@ from invokeai.app.services.working_memory_calibration.working_memory_calibration
build_plan,
case_sides,
)
+from invokeai.backend.model_manager.configs.base import ModelRole
from invokeai.backend.model_manager.load.model_cache.model_cache import ModelCache
from invokeai.backend.model_manager.load.model_loaders.flux import (
Flux2DiffusersModel,
@@ -376,6 +377,22 @@ def test_a_flux2_model_without_a_text_encoder_generate_can_use_cannot_be_calibra
assert "text encoder" in (plan.reason or "") and f"{encoder} encoder" in (plan.reason or "")
+def _text_llm_serving_qwen3(key: str, variant: Qwen3VariantType) -> SimpleNamespace:
+ role = ModelRole(type=ModelType.Qwen3Encoder, format=ModelFormat.Qwen3Encoder, variant=variant)
+ return _model(key, BaseModelType.Any, ModelType.TextLLM, roles=[role])
+
+
+def test_a_text_llm_serving_as_the_klein_qwen3_encoder_is_a_standalone_encoder() -> None:
+ """Generate offers such a folder in the Qwen3 Encoder picker, and the loader node asks for it in that role."""
+ right_size = _text_llm_serving_qwen3("llm-8b", Qwen3VariantType.Qwen3_8B)
+ wrong_size = _text_llm_serving_qwen3("llm-4b", Qwen3VariantType.Qwen3_4B)
+
+ assert _plan(GGUF_KLEIN_9B, [FLUX2_VAE, right_size]).supported
+ plan = _plan(GGUF_KLEIN_9B, [FLUX2_VAE, wrong_size])
+ assert not plan.supported and "Qwen3 8B encoder" in (plan.reason or "")
+ assert not _plan(GGUF_KLEIN_9B, [FLUX2_VAE, _model("llm", BaseModelType.Any, ModelType.TextLLM)]).supported
+
+
def test_a_flux2_vae_is_calibrated_through_a_main_model_whose_graph_compiles() -> None:
"""The GGUF model sorts first but has no encoder; the 4B pipeline brings its own and takes the `vae` pick."""
gguf = _model("a-klein-9b-gguf", BaseModelType.Flux2, format="gguf_quantized", variant=Flux2VariantType.Klein9B)
diff --git a/tests/backend/model_manager/configs/test_model_roles.py b/tests/backend/model_manager/configs/test_model_roles.py
new file mode 100644
index 0000000000..1fd79d4813
--- /dev/null
+++ b/tests/backend/model_manager/configs/test_model_roles.py
@@ -0,0 +1,171 @@
+"""Model roles: `view_as` turns a record into the config of another type its files serve as."""
+
+import json
+
+import pytest
+
+from invokeai.backend.model_manager.configs.base import ModelRole
+from invokeai.backend.model_manager.configs.factory import ModelConfigFactory
+from invokeai.backend.model_manager.configs.qwen3_5_encoder import Qwen35Encoder_Checkpoint_Config
+from invokeai.backend.model_manager.configs.qwen3_encoder import (
+ Qwen3Encoder_Checkpoint_Config,
+ Qwen3Encoder_Qwen3Encoder_Config,
+)
+from invokeai.backend.model_manager.configs.roles import ModelRoleError, role_variant, serves_as, view_as
+from invokeai.backend.model_manager.configs.text_llm import TextLLM_Checkpoint_Config, TextLLM_Diffusers_Config
+from invokeai.backend.model_manager.taxonomy import (
+ ModelFormat,
+ ModelSourceType,
+ ModelType,
+ Qwen3VariantType,
+ Qwen35VariantType,
+)
+
+_COMMON = {
+ "key": "key1",
+ "hash": "blake3:abc",
+ "path": "llm/model",
+ "file_size": 1024,
+ "name": "A model",
+ "source": "test",
+ "source_type": ModelSourceType.Path,
+}
+
+
+def _text_llm_file() -> TextLLM_Checkpoint_Config:
+ return TextLLM_Checkpoint_Config(
+ **_COMMON,
+ cpu_only=True,
+ roles=[ModelRole(type=ModelType.Qwen35Encoder, variant=Qwen35VariantType.Qwen35_9B)],
+ )
+
+
+def _text_llm_folder() -> TextLLM_Diffusers_Config:
+ return TextLLM_Diffusers_Config(
+ **_COMMON,
+ roles=[
+ ModelRole(type=ModelType.Qwen3Encoder, format=ModelFormat.Qwen3Encoder, variant=Qwen3VariantType.Qwen3_4B)
+ ],
+ )
+
+
+def _dumped(roles: list[ModelRole]) -> list[dict]:
+ return [role.model_dump() for role in roles]
+
+
+def test_a_text_llm_file_viewed_as_the_encoder_is_an_encoder_config_of_the_same_files() -> None:
+ record = _text_llm_file()
+
+ view = view_as(record, ModelType.Qwen35Encoder)
+
+ assert isinstance(view, Qwen35Encoder_Checkpoint_Config)
+ assert (view.key, view.path, view.hash, view.name, view.cpu_only) == (
+ "key1",
+ "llm/model",
+ "blake3:abc",
+ "A model",
+ True,
+ )
+ assert view.variant is Qwen35VariantType.Qwen35_9B
+ assert view.role_of is ModelType.TextLLM
+ assert record.role_of is None
+ assert _dumped(view.roles) == _dumped([ModelRole(type=ModelType.TextLLM)])
+
+
+def test_a_folder_viewed_as_the_qwen3_encoder_switches_format_and_remembers_its_own() -> None:
+ view = view_as(_text_llm_folder(), ModelType.Qwen3Encoder)
+
+ assert isinstance(view, Qwen3Encoder_Qwen3Encoder_Config)
+ assert view.format is ModelFormat.Qwen3Encoder
+ assert view.variant is Qwen3VariantType.Qwen3_4B
+ assert _dumped(view.roles) == _dumped([ModelRole(type=ModelType.TextLLM, format=ModelFormat.Diffusers)])
+ back = view_as(view, ModelType.TextLLM)
+ assert isinstance(back, TextLLM_Diffusers_Config)
+ assert back.format is ModelFormat.Diffusers
+
+
+def test_a_roles_variant_wins_over_the_primary_one() -> None:
+ record = Qwen3Encoder_Checkpoint_Config(
+ **_COMMON,
+ variant=Qwen3VariantType.Qwen3_4B,
+ roles=[ModelRole(type=ModelType.Qwen35Encoder, variant=Qwen35VariantType.Qwen35_9B)],
+ )
+
+ view = view_as(record, ModelType.Qwen35Encoder)
+
+ assert isinstance(view, Qwen35Encoder_Checkpoint_Config)
+ assert view.variant is Qwen35VariantType.Qwen35_9B
+
+
+def test_the_primary_variant_is_not_carried_into_a_role_that_names_none(monkeypatch: pytest.MonkeyPatch) -> None:
+ record = Qwen3Encoder_Checkpoint_Config(
+ **_COMMON, variant=Qwen3VariantType.Qwen3_4B, roles=[ModelRole(type=ModelType.TextLLM)]
+ )
+ built: list[dict] = []
+ from_dict = ModelConfigFactory.from_dict
+ monkeypatch.setattr(ModelConfigFactory, "from_dict", lambda fields: built.append(dict(fields)) or from_dict(fields))
+
+ view_as(record, ModelType.TextLLM)
+
+ assert "variant" not in built[0]
+
+
+def test_a_role_without_the_variant_its_class_needs_is_refused() -> None:
+ record = TextLLM_Checkpoint_Config(**_COMMON, roles=[ModelRole(type=ModelType.Qwen35Encoder)])
+
+ with pytest.raises(ModelRoleError):
+ view_as(record, ModelType.Qwen35Encoder)
+
+
+def test_a_record_viewed_as_its_own_type_is_itself() -> None:
+ record = _text_llm_file()
+
+ assert view_as(record, ModelType.TextLLM) is record
+
+
+def test_a_role_the_model_does_not_serve_is_refused_naming_both_types() -> None:
+ with pytest.raises(ModelRoleError, match="A model.*text_llm.*qwen3_encoder"):
+ view_as(_text_llm_file(), ModelType.Qwen3Encoder)
+
+
+def test_serves_as_and_role_variant_cover_the_primary_type_a_role_and_neither() -> None:
+ record = _text_llm_file()
+
+ assert serves_as(record, ModelType.TextLLM) and serves_as(record, ModelType.Qwen35Encoder)
+ assert not serves_as(record, ModelType.Qwen3Encoder)
+ assert role_variant(record, ModelType.Qwen35Encoder) is Qwen35VariantType.Qwen35_9B
+ assert role_variant(record, ModelType.TextLLM) is None
+ assert role_variant(record, ModelType.Qwen3Encoder) is None
+ encoder = view_as(record, ModelType.Qwen35Encoder)
+ assert role_variant(encoder, ModelType.Qwen35Encoder) is Qwen35VariantType.Qwen35_9B
+
+
+def test_roles_survive_the_json_round_trip_of_a_stored_record() -> None:
+ record = _text_llm_folder()
+
+ restored = ModelConfigFactory.from_dict(json.loads(record.model_dump_json()))
+
+ assert isinstance(restored, TextLLM_Diffusers_Config)
+ assert _dumped(restored.roles) == _dumped(record.roles)
+
+
+def test_a_role_view_never_dumps_its_origin() -> None:
+ view = view_as(_text_llm_file(), ModelType.Qwen35Encoder)
+
+ assert "_role_of" not in view.model_dump()
+ assert "role_of" not in json.loads(view.model_dump_json())
+
+
+def test_a_role_this_build_cannot_read_is_dropped_and_the_record_survives() -> None:
+ fields = _text_llm_file().model_dump(mode="json")
+ fields["roles"] = [
+ {"type": "a_future_type"},
+ {"type": "qwen3_5_encoder", "variant": "a_future_size"},
+ {"type": "qwen3_5_encoder", "variant": "qwen3_5_9b", "a_future_field": 1},
+ ]
+
+ restored = ModelConfigFactory.from_dict(fields)
+
+ assert _dumped(restored.roles) == _dumped(
+ [ModelRole(type=ModelType.Qwen35Encoder, variant=Qwen35VariantType.Qwen35_9B)]
+ )
diff --git a/tests/backend/model_manager/configs/test_text_llm_qwen3_5_config.py b/tests/backend/model_manager/configs/test_text_llm_qwen3_5_config.py
index a891a3aef2..ef0264b445 100644
--- a/tests/backend/model_manager/configs/test_text_llm_qwen3_5_config.py
+++ b/tests/backend/model_manager/configs/test_text_llm_qwen3_5_config.py
@@ -14,11 +14,13 @@ from typing import Any
import pytest
import invokeai.backend.qwen3_5 as qwen3_5_package
+from invokeai.backend.model_manager.configs.base import ModelRole
from invokeai.backend.model_manager.configs.factory import ModelClassificationResult, ModelConfigFactory
-from invokeai.backend.model_manager.configs.identification_utils import InvalidMatchError
+from invokeai.backend.model_manager.configs.identification_utils import InvalidMatchError, NotAMatchError
from invokeai.backend.model_manager.configs.qwen3_5_encoder import Qwen35Encoder_Checkpoint_Config
from invokeai.backend.model_manager.configs.qwen3_vl_encoder import Qwen3VLEncoder_Checkpoint_Config
from invokeai.backend.model_manager.configs.text_llm import TextLLM_Checkpoint_Config, TextLLM_Diffusers_Config
+from invokeai.backend.model_manager.model_on_disk import ModelOnDisk
from invokeai.backend.model_manager.starter_models import STARTER_MODELS
from invokeai.backend.model_manager.taxonomy import ModelFormat, ModelSourceType, ModelType, Qwen35VariantType
from tests.backend.model_manager.load.state_dicts import (
@@ -96,6 +98,7 @@ class TestComfyUISingleFiles:
assert isinstance(result.config, TextLLM_Checkpoint_Config)
assert result.config.format is ModelFormat.Checkpoint
assert result.config.supports_images is True
+ assert result.config.roles == [ModelRole(type=ModelType.Qwen35Encoder, variant=Qwen35VariantType.Qwen35_9B)]
@pytest.mark.parametrize(
("keys", "scheme"),
@@ -148,13 +151,36 @@ class TestTheLineBetweenTheUpsamplerAndAQwen3_5Encoder:
assert _matches(result) == [Qwen35Encoder_Checkpoint_Config.__name__]
assert isinstance(result.config, Qwen35Encoder_Checkpoint_Config)
assert result.config.variant is Qwen35VariantType.Qwen35_9B
+ assert result.config.roles == []
- def test_an_explicit_encoder_type_still_installs_the_upsampler_as_one(self, tmp_path: Path) -> None:
+ def test_an_explicit_encoder_type_still_installs_the_upsampler_as_one_serving_as_a_text_llm(
+ self, tmp_path: Path
+ ) -> None:
path = write_header_only_safetensors(tmp_path / "upsampler.safetensors", _BF16)
result = _identify(path, {"type": ModelType.Qwen35Encoder})
assert _matches(result) == [Qwen35Encoder_Checkpoint_Config.__name__]
+ assert isinstance(result.config, Qwen35Encoder_Checkpoint_Config)
+ assert result.config.roles == [ModelRole(type=ModelType.TextLLM)]
+
+ def test_a_whole_model_in_a_pickle_file_is_not_an_encoder_unprompted_and_serves_no_text_llm_role(
+ self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch
+ ) -> None:
+ """The encoder loader reads safetensors only, and the Text LLM config takes only `.safetensors`: a `.pt` copy
+ stays unidentified, and filed as an encoder by hand it does not claim a role no config would accept."""
+ source = write_header_only_safetensors(tmp_path / "upsampler.safetensors", _BF16)
+ state_dict = ModelOnDisk(source).load_state_dict()
+ pickle_file = tmp_path / "upsampler.pt"
+ source.rename(pickle_file)
+ monkeypatch.setattr(ModelOnDisk, "load_state_dict", lambda self, *args, **kwargs: state_dict)
+ mod = ModelOnDisk(pickle_file)
+
+ with pytest.raises(NotAMatchError):
+ Qwen35Encoder_Checkpoint_Config.from_model_on_disk(mod, {})
+ common = {"hash": "blake3:x", "path": "x", "file_size": 1, "name": "x", "source": "x", "source_type": "path"}
+ config = Qwen35Encoder_Checkpoint_Config.from_model_on_disk(mod, {"type": ModelType.Qwen35Encoder} | common)
+ assert config.roles == []
def test_a_size_without_a_vendored_config_stays_a_qwen3_5_encoder(self, tmp_path: Path) -> None:
"""The Text LLM loader builds the 9B only. A 4B with its tower and LM head -- the embedding width decides --
@@ -167,6 +193,7 @@ class TestTheLineBetweenTheUpsamplerAndAQwen3_5Encoder:
assert _matches(result) == [Qwen35Encoder_Checkpoint_Config.__name__]
assert isinstance(result.config, Qwen35Encoder_Checkpoint_Config)
assert result.config.variant is Qwen35VariantType.Qwen35_4B
+ assert result.config.roles == []
def test_a_text_only_export_with_an_lm_head_stays_an_encoder(self, tmp_path: Path) -> None:
"""No vision tower, nothing the Text LLM loader builds: an LM head alone does not take a file from the
@@ -176,6 +203,7 @@ class TestTheLineBetweenTheUpsamplerAndAQwen3_5Encoder:
result = _identify(write_header_only_safetensors(tmp_path / "qwen35_9b_causal_lm.safetensors", keys))
assert _matches(result) == [Qwen35Encoder_Checkpoint_Config.__name__]
+ assert result.config is not None and result.config.roles == []
def test_a_qwen3_vl_export_of_the_same_outer_layout_stays_the_qwen3_vl_encoder(self, tmp_path: Path) -> None:
path = tmp_path / "qwen3vl_4b_bf16.safetensors"
@@ -186,8 +214,8 @@ class TestTheLineBetweenTheUpsamplerAndAQwen3_5Encoder:
class TestQuantizedQwen3_5Encoders:
- """ComfyUI's int8 build of the Qwen3.5-9B text encoder has the key set of the FLUX.3 upsampler's, so only an explicit
- type (the starter model's) tells the two apart; the quantization schemes the encoder loader cannot build are refused
+ """ComfyUI's int8 build of the Qwen3.5-9B text encoder has the key set of the FLUX.3 upsampler's, so the file serves
+ both roles and only an explicit type (the starter model's) files it as the encoder; the quantization schemes the encoder loader cannot build are refused
at install, as the Text LLM config refuses them."""
@staticmethod
@@ -216,27 +244,16 @@ class TestQuantizedQwen3_5Encoders:
assert _matches(result) == [Qwen35Encoder_Checkpoint_Config.__name__]
assert isinstance(result.config, Qwen35Encoder_Checkpoint_Config)
assert result.config.variant is Qwen35VariantType.Qwen35_9B
-
- @pytest.mark.parametrize(
- "source",
- [
- "https://huggingface.co/Comfy-Org/MOSS-Image/resolve/main/text_encoders/qwen3.5_9b_int8_convrot.safetensors",
- "https://huggingface.co/Comfy-Org/MOSS-Image/resolve/2929efe3/text_encoders/qwen3.5_9b_bf16.safetensors?download=true",
- "Comfy-Org/MOSS-Image::text_encoders/qwen3.5_9b_int8_convrot.safetensors",
- ],
- ids=["main", "pinned bf16", "repo id"],
- )
- def test_comfy_orgs_source_alone_makes_its_file_an_encoder_and_never_a_text_llm(
- self, tmp_path: Path, source: str
- ) -> None:
- result = _identify(self._int8_file(tmp_path), {"source": source, "source_type": ModelSourceType.Url})
-
- assert _matches(result) == [Qwen35Encoder_Checkpoint_Config.__name__]
+ assert result.config.roles == [ModelRole(type=ModelType.TextLLM)]
@pytest.mark.parametrize(
("source", "source_type"),
[
- # A local copy and another repository's identical file carry no such evidence.
+ (
+ "https://huggingface.co/Comfy-Org/MOSS-Image/resolve/main/text_encoders/qwen3.5_9b_int8_convrot.safetensors",
+ ModelSourceType.Url,
+ ),
+ ("Comfy-Org/MOSS-Image::text_encoders/qwen3.5_9b_int8_convrot.safetensors", ModelSourceType.Url),
("D:/models/Comfy-Org/MOSS-Image/text_encoders/qwen3.5_9b_int8_convrot.safetensors", ModelSourceType.Path),
(
"https://huggingface.co/black-forest-labs/flux-3-image-klein-comfy/resolve/main/text_encoders/"
@@ -248,14 +265,16 @@ class TestQuantizedQwen3_5Encoders:
ModelSourceType.Url,
),
],
- ids=["local path", "flux3 upsampler", "other folder of the repo"],
+ ids=["comfy url", "comfy repo id", "local path", "flux3 upsampler", "other folder of the repo"],
)
- def test_any_other_source_leaves_the_file_a_text_llm(
+ def test_every_source_gives_a_text_llm_serving_as_the_9b_encoder(
self, tmp_path: Path, source: str, source_type: ModelSourceType
) -> None:
result = _identify(self._int8_file(tmp_path), {"source": source, "source_type": source_type})
assert _matches(result) == [TextLLM_Checkpoint_Config.__name__]
+ assert result.config is not None
+ assert result.config.roles == [ModelRole(type=ModelType.Qwen35Encoder, variant=Qwen35VariantType.Qwen35_9B)]
def test_the_int8_build_without_an_lm_head_is_an_encoder_unprompted(self, tmp_path: Path) -> None:
keys = {key: value for key, value in _INT8.items() if not key.startswith("lm_head.")}
@@ -264,6 +283,7 @@ class TestQuantizedQwen3_5Encoders:
result = _identify(write_header_only_safetensors(tmp_path / "encoder.safetensors", keys, markers))
assert _matches(result) == [Qwen35Encoder_Checkpoint_Config.__name__]
+ assert result.config is not None and result.config.roles == []
@pytest.mark.parametrize(
("keys", "scheme"),
diff --git a/tests/backend/model_manager/configs/test_text_llm_qwen3_folder_role.py b/tests/backend/model_manager/configs/test_text_llm_qwen3_folder_role.py
new file mode 100644
index 0000000000..e2e17a1417
--- /dev/null
+++ b/tests/backend/model_manager/configs/test_text_llm_qwen3_folder_role.py
@@ -0,0 +1,71 @@
+"""A complete Qwen3 causal-LM folder is a Text LLM that also serves as a Qwen3 encoder (`Qwen3EncoderLoader`'s layout)."""
+
+import json
+from pathlib import Path
+from typing import Any
+
+import pytest
+
+from invokeai.backend.model_manager.configs.base import ModelRole
+from invokeai.backend.model_manager.configs.text_llm import TextLLM_Diffusers_Config
+from invokeai.backend.model_manager.model_on_disk import ModelOnDisk
+from invokeai.backend.model_manager.taxonomy import ModelFormat, ModelType, Qwen3VariantType
+
+_FIELDS: dict[str, Any] = {
+ "hash": "blake3:x",
+ "path": "x",
+ "file_size": 1,
+ "name": "x",
+ "source": "x",
+ "source_type": "path",
+ "key": "k",
+}
+
+
+def _folder(
+ root: Path, *, architecture: str = "Qwen3ForCausalLM", hidden_size: int | None = 2560, **extra: Any
+) -> Path:
+ root.mkdir()
+ config: dict[str, Any] = {"architectures": [architecture], **extra}
+ if hidden_size is not None:
+ config["hidden_size"] = hidden_size
+ (root / "config.json").write_text(json.dumps(config))
+ (root / "tokenizer.json").write_text("{}")
+ return root
+
+
+def _identify(root: Path) -> TextLLM_Diffusers_Config:
+ return TextLLM_Diffusers_Config.from_model_on_disk(ModelOnDisk(root), dict(_FIELDS))
+
+
+ ("hidden_size", "variant"),
+ [(1024, Qwen3VariantType.Qwen3_06B), (2560, Qwen3VariantType.Qwen3_4B), (4096, Qwen3VariantType.Qwen3_8B)],
+)
+def test_a_qwen3_causal_lm_serves_as_the_qwen3_encoder_of_its_size(
+ tmp_path: Path, hidden_size: int, variant: Qwen3VariantType
+) -> None:
+ config = _identify(_folder(tmp_path / "m", hidden_size=hidden_size))
+
+ assert config.roles == [ModelRole(type=ModelType.Qwen3Encoder, format=ModelFormat.Qwen3Encoder, variant=variant)]
+
+
+ "folder_args",
+ [
+ {"architecture": "Qwen2ForCausalLM"},
+ {"quantization_config": {"quant_method": "bitsandbytes"}},
+ {"hidden_size": 3072},
+ {"hidden_size": None},
+ ],
+ ids=["qwen2", "quantization_config", "unknown size", "no size"],
+)
+def test_other_folders_stay_plain_text_llms(tmp_path: Path, folder_args: dict[str, Any]) -> None:
+ assert _identify(_folder(tmp_path / "m", **folder_args)).roles == []
+
+
+def test_an_sdnq_folder_stays_a_plain_text_llm(tmp_path: Path) -> None:
+ root = _folder(tmp_path / "m")
+ (root / "quantization_config.json").write_text(json.dumps({"quant_method": "sdnq"}))
+
+ assert _identify(root).roles == []
diff --git a/tests/backend/model_manager/load/test_qwen3_text_llm_folder_as_encoder.py b/tests/backend/model_manager/load/test_qwen3_text_llm_folder_as_encoder.py
new file mode 100644
index 0000000000..45426a8f18
--- /dev/null
+++ b/tests/backend/model_manager/load/test_qwen3_text_llm_folder_as_encoder.py
@@ -0,0 +1,90 @@
+"""A Qwen3 causal-LM folder identified as a Text LLM also loads as the Z-Image / FLUX.2 Klein / Anima Qwen3 encoder:
+its view in that role goes through `Qwen3EncoderLoader` and yields the same language model and tokenizer."""
+
+from pathlib import Path
+
+import pytest
+import torch
+from tokenizers import Tokenizer, models, pre_tokenizers
+from transformers import PreTrainedTokenizerBase, Qwen3Config, Qwen3ForCausalLM
+
+from invokeai.backend.model_manager.configs.qwen3_encoder import Qwen3Encoder_Qwen3Encoder_Config
+from invokeai.backend.model_manager.configs.roles import view_as
+from invokeai.backend.model_manager.configs.text_llm import TextLLM_Diffusers_Config
+from invokeai.backend.model_manager.load.model_loaders import z_image as loader_module
+from invokeai.backend.model_manager.load.model_loaders.z_image import Qwen3EncoderLoader
+from invokeai.backend.model_manager.model_on_disk import ModelOnDisk
+from invokeai.backend.model_manager.taxonomy import ModelType, Qwen3VariantType, SubModelType
+from tests.fixtures.model_roles import text_llm_qwen3_folder
+
+# Identification reads the hidden size off config.json and needs a real Qwen3 width (1024 is the 0.6B); everything
+# else is as small as the architecture allows, so the folder is a few hundred kilobytes.
+_HIDDEN_SIZE = 1024
+
+
+def _qwen3_folder(root: Path) -> Qwen3ForCausalLM:
+ torch.manual_seed(0)
+ model = Qwen3ForCausalLM(
+ Qwen3Config(
+ vocab_size=32,
+ hidden_size=_HIDDEN_SIZE,
+ intermediate_size=64,
+ num_hidden_layers=1,
+ num_attention_heads=2,
+ num_key_value_heads=1,
+ head_dim=16,
+ max_position_embeddings=64,
+ )
+ ).eval()
+ model.save_pretrained(root)
+ vocab = {"<unk>": 0, **{f"w{i}": i for i in range(1, 32)}}
+ tokenizer = Tokenizer(models.WordLevel(vocab, unk_token="<unk>"))
+ tokenizer.pre_tokenizer = pre_tokenizers.Whitespace()
+ tokenizer.save(str(root / "tokenizer.json"))
+ return model
+
+
+def loader(monkeypatch: pytest.MonkeyPatch) -> Qwen3EncoderLoader:
+ monkeypatch.setattr(loader_module.TorchDevice, "choose_torch_device", staticmethod(lambda: torch.device("cpu")))
+ monkeypatch.setattr(
+ loader_module.TorchDevice, "choose_bfloat16_safe_dtype", staticmethod(lambda _device: torch.float32)
+ )
+ return object.__new__(Qwen3EncoderLoader)
+
+
+def test_a_qwen3_folder_identified_as_a_text_llm_loads_as_the_qwen3_encoder_of_its_size(
+ tmp_path: Path, loader: Qwen3EncoderLoader
+) -> None:
+ reference = _qwen3_folder(tmp_path)
+ fields = {
+ "key": "k",
+ "hash": "blake3:x",
+ "path": str(tmp_path),
+ "file_size": 1,
+ "name": "qwen3 folder",
+ "source": "test",
+ "source_type": "path",
+ }
+ record = TextLLM_Diffusers_Config.from_model_on_disk(ModelOnDisk(tmp_path), fields)
+
+ view = view_as(record, ModelType.Qwen3Encoder)
+
+ assert isinstance(view, Qwen3Encoder_Qwen3Encoder_Config)
+ assert view.variant is Qwen3VariantType.Qwen3_06B
+ model = loader._load_model(view, SubModelType.TextEncoder)
+ assert isinstance(model, Qwen3ForCausalLM)
+ for name, tensor in reference.state_dict().items():
+ assert torch.equal(model.state_dict()[name], tensor), name
+ assert isinstance(loader._load_model(view, SubModelType.Tokenizer), PreTrainedTokenizerBase)
+
+
+def test_the_tokenizer_of_a_root_layout_folder_is_not_sized_as_the_whole_folder(
+ tmp_path: Path, loader: Qwen3EncoderLoader
+) -> None:
+ _qwen3_folder(tmp_path)
+ record = text_llm_qwen3_folder("k", Qwen3VariantType.Qwen3_06B).model_copy(update={"path": str(tmp_path)})
+ view = view_as(record, ModelType.Qwen3Encoder)
+
+ assert loader.get_size_fs(view, tmp_path, SubModelType.Tokenizer) == 0
+ assert loader.get_size_fs(view, tmp_path, SubModelType.TextEncoder) > 0
diff --git a/tests/backend/model_manager/load/test_text_llm_loader.py b/tests/backend/model_manager/load/test_text_llm_loader.py
index b41b222481..27008a1ace 100644
--- a/tests/backend/model_manager/load/test_text_llm_loader.py
+++ b/tests/backend/model_manager/load/test_text_llm_loader.py
@@ -26,6 +26,7 @@ from transformers import (
Qwen3_5VisionConfig,
)
+from invokeai.backend.model_manager.configs.roles import view_as
from invokeai.backend.model_manager.configs.text_llm import TextLLM_Checkpoint_Config, TextLLM_Diffusers_Config
from invokeai.backend.model_manager.load.model_loaders import text_llm as loader_module
from invokeai.backend.model_manager.load.model_loaders.text_llm import (
@@ -33,11 +34,12 @@ from invokeai.backend.model_manager.load.model_loaders.text_llm import (
TextLLMModelLoader,
qwen3_5_vl_from_state_dict,
)
-from invokeai.backend.model_manager.taxonomy import SubModelType
+from invokeai.backend.model_manager.taxonomy import ModelType, SubModelType
from invokeai.backend.quantization.int8_convrot import Int8ConvrotLinear
from invokeai.backend.qwen3_5.qwen3_5_encoder import load_bundled_qwen3_5_tokenizer
from tests.backend.model_manager.load.state_dicts import flux3_pup_bf16_keys, flux3_pup_int8_convrot_keys
from tests.fixtures.loader_seams import Seam, prepare
+from tests.fixtures.model_roles import encoder_file
from tests.fixtures.quantized_payloads import comfy_quant_marker, quantize_convrot
Keys = dict[str, tuple[list[int], str]]
@@ -317,6 +319,30 @@ class TestTheCheckpointLoader:
assert run.reserved == []
+class TestAnEncoderRecordServingAsATextLLM:
+ """A whole-model file installed as a Qwen3.5 encoder serves as a Text LLM: its view loads through this loader."""
+
+ @staticmethod
+ def _view(tmp_path: Path):
+ record = encoder_file("enc").model_copy(update={"path": str(_config(tmp_path).path)})
+ return view_as(record, ModelType.TextLLM)
+
+ def test_the_view_loads_the_whole_model_and_serves_its_own_tokenizer(
+ self, monkeypatch: pytest.MonkeyPatch, tmp_path: Path
+ ) -> None:
+ reference = _reference()
+ state_dict = {key: value.detach().clone() for key, value in reference.state_dict().items()}
+ run = prepare(SEAM, monkeypatch, state_dict=state_dict, geometry=_tiny_geometry)
+ view = self._view(tmp_path)
+ assert isinstance(view, TextLLM_Checkpoint_Config)
+
+ model = run.load(view, None)
+ tokenizer = run.load(view, SubModelType.Tokenizer)
+
+ torch.testing.assert_close(_text_logits(model), _text_logits(reference))
+ assert tokenizer is not load_bundled_qwen3_5_tokenizer()
+
+
# -- The text side a single file cannot carry, pinned against the release's own tokenizer and processor. -----------
# `Write the caption.` / an image and `a red fox, 狐狸 🦊`, rendered with `enable_thinking=False`: the ids the release's
diff --git a/tests/backend/qwen3_5/test_qwen3_5_loading.py b/tests/backend/qwen3_5/test_qwen3_5_loading.py
index 86994c8a19..f4e2d7cbdf 100644
--- a/tests/backend/qwen3_5/test_qwen3_5_loading.py
+++ b/tests/backend/qwen3_5/test_qwen3_5_loading.py
@@ -17,14 +17,16 @@ from safetensors.torch import save_file
from transformers.models.qwen3_5.configuration_qwen3_5 import Qwen3_5TextConfig
from invokeai.backend.model_manager.configs.qwen3_5_encoder import Qwen35Encoder_Checkpoint_Config
+from invokeai.backend.model_manager.configs.roles import view_as
from invokeai.backend.model_manager.load.model_loaders import qwen3_5_encoder as loader_module
from invokeai.backend.model_manager.load.model_loaders.qwen3_5_encoder import (
Qwen35EncoderCheckpointLoader,
load_qwen3_5_text_encoder,
)
-from invokeai.backend.model_manager.taxonomy import Qwen35VariantType, SubModelType
+from invokeai.backend.model_manager.taxonomy import ModelType, Qwen35VariantType, SubModelType
from invokeai.backend.quantization.int8_convrot import Int8ConvrotLinear
from invokeai.backend.qwen3_5.qwen3_5_encoder import Qwen35Encoder, qwen3_5_text_config_from_config_json
+from tests.fixtures.model_roles import text_llm_file
from tests.fixtures.quantized_payloads import comfy_quant_marker, quantize_convrot
_LAST = 3
@@ -216,6 +218,27 @@ def test_the_variant_decides_whether_a_single_file_loads_the_final_norm(
assert ("norm.weight" in model.state_dict()) is loads_the_norm
+def test_a_text_llm_record_viewed_as_the_encoder_loads_the_same_language_model_as_an_encoder_record(
+ tmp_path: Path, loader, monkeypatch: pytest.MonkeyPatch
+) -> None:
+ monkeypatch.setattr("invokeai.backend.qwen3_5.qwen3_5_encoder.qwen3_5_text_config", lambda _variant: _config())
+ loader._keep_fp8_weights = lambda _config, _submodel: False
+ loader._apply_fp8_layerwise_casting = lambda model, _config, _submodel: model
+ weights = _reference(final_norm=True).state_dict()
+ path = tmp_path / "whole.safetensors"
+ save_file({f"{_PREFIX}{k}": v for k, v in weights.items()} | _random({"lm_head.weight": [64, 32]}), path)
+ record = text_llm_file("llm").model_copy(update={"path": str(path)})
+ native = Qwen35Encoder_Checkpoint_Config.model_construct(
+ path=str(path), name="encoder", variant=Qwen35VariantType.Qwen35_9B
+ )
+
+ from_view = loader._load_model(view_as(record, ModelType.Qwen35Encoder), SubModelType.TextEncoder)
+ from_native = loader._load_model(native, SubModelType.TextEncoder)
+
+ _assert_loaded(from_view, weights)
+ _assert_loaded(from_native, weights)
+
+
# -- ComfyUI's int8_tensorwise build: the whole vision-language model, of which the encoder reads the language model. --
_PREFIX = "model.language_model."
@@ -348,3 +371,12 @@ def test_a_scaled_fp8_layer_is_refused_before_room_is_reserved(tmp_path: Path, l
with pytest.raises(ValueError, match="quantization side channel"):
load_qwen3_5_text_encoder(loader, [path], _config(), final_norm=True, keep_fp8=False, what="test")
loader._ram_cache.make_room.assert_not_called()
+
+
+def test_the_bundled_tokenizer_is_not_sized_as_the_whole_file(tmp_path: Path, loader) -> None:
+ path = tmp_path / "encoder.safetensors"
+ save_file(_random({"language_model.embed_tokens.weight": [64, 32]}), path)
+ config = Qwen35Encoder_Checkpoint_Config.model_construct(path=str(path), name="encoder")
+
+ assert loader.get_size_fs(config, path, SubModelType.Tokenizer) == 0
+ assert loader.get_size_fs(config, path, SubModelType.TextEncoder) == path.stat().st_size
diff --git a/tests/backend/text_llm/test_text_llm_api_models.py b/tests/backend/text_llm/test_text_llm_api_models.py
index 088c8b7f58..8b3ea4506f 100644
--- a/tests/backend/text_llm/test_text_llm_api_models.py
+++ b/tests/backend/text_llm/test_text_llm_api_models.py
@@ -27,6 +27,7 @@ from invokeai.backend.model_manager.taxonomy import ModelType, SubModelType
from invokeai.backend.util.device_pool import GENERATION_DEVICE_POOL
from invokeai.backend.util.devices import TorchDevice
from tests.fixtures.device_pool import GPU0, GPU1, two_gpu_pool
+from tests.fixtures.model_roles import encoder_file
class TestExpandPromptRequest:
@@ -125,6 +126,40 @@ def test_expand_prompt_uses_fresh_seed() -> None:
assert pipeline_class.return_value.run.call_args.kwargs["seed"] == 456
+def test_expand_prompt_accepts_an_encoder_record_that_serves_as_a_text_llm_and_loads_its_view() -> None:
+ loaded_configs: list[object] = []
+ inner = _loaded(_model(), {SubModelType.Tokenizer: MagicMock(spec=PreTrainedTokenizerBase)})
+
+ def load_model(config: object, submodel_type: SubModelType | None = None, **kwargs: object) -> MagicMock:
+ loaded_configs.append(config)
+ return inner(config, submodel_type)
+
+ services = MagicMock()
+ services.model_manager.store.get_model.return_value = encoder_file("enc")
+ services.model_manager.load.load_model.side_effect = load_model
+
+ with (
+ patch.object(ApiDependencies, "invoker", MagicMock(services=services), create=True),
+ patch("invokeai.app.api.routers.utilities.TextLLMPipeline") as pipeline_class,
+ ):
+ pipeline_class.return_value.run.return_value = "expanded"
+ assert _run_expand_prompt("cat", "enc", 10, None, 1, None, "user") == ("expanded", 1)
+
+ assert loaded_configs and all(
+ c.type is ModelType.TextLLM and c.role_of is ModelType.Qwen35Encoder for c in loaded_configs
+ ) # type: ignore[attr-defined]
+
+
+def test_expand_prompt_refuses_an_encoder_record_without_the_text_llm_role() -> None:
+ services = MagicMock()
+ services.model_manager.store.get_model.return_value = encoder_file("enc", serves_text_llm=False)
+
+ with patch.object(ApiDependencies, "invoker", MagicMock(services=services), create=True):
+ with pytest.raises(ValueError, match="not a TextLLM model"):
+ _run_expand_prompt("cat", "enc", 10, None, 1, None, "user")
+ services.model_manager.load.load_model.assert_not_called()
+
+
def test_expand_prompt_with_an_image_runs_it_through_the_processor() -> None:
"""The stored image reaches the pipeline as RGB, next to the model's processor, whose tokenizer is reused.
diff --git a/tests/fixtures/model_roles.py b/tests/fixtures/model_roles.py
new file mode 100644
index 0000000000..b72586114c
--- /dev/null
+++ b/tests/fixtures/model_roles.py
@@ -0,0 +1,63 @@
+"""Records that serve as another model type (`Config_Base.roles`), and a context that resolves them like the real one."""
+
+from types import SimpleNamespace
+from typing import Mapping
+from unittest.mock import MagicMock
+
+from invokeai.app.services.shared.invocation_context import ModelsInterface
+from invokeai.backend.model_manager.configs.base import ModelRole
+from invokeai.backend.model_manager.configs.factory import AnyModelConfig
+from invokeai.backend.model_manager.configs.qwen3_5_encoder import Qwen35Encoder_Checkpoint_Config
+from invokeai.backend.model_manager.configs.text_llm import TextLLM_Checkpoint_Config, TextLLM_Diffusers_Config
+from invokeai.backend.model_manager.taxonomy import (
+ ModelFormat,
+ ModelSourceType,
+ ModelType,
+ Qwen3VariantType,
+ Qwen35VariantType,
+)
+
+
+def _common(key: str, name: str) -> dict:
+ return {
+ "key": key,
+ "hash": f"blake3:{key}",
+ "path": f"llm/{key}",
+ "file_size": 1024,
+ "name": name,
+ "source": "test",
+ "source_type": ModelSourceType.Path,
+ }
+
+
+def text_llm_file(key: str, serves_encoder: Qwen35VariantType | None = Qwen35VariantType.Qwen35_9B):
+ """A whole Qwen3.5 VLM file filed as a Text LLM; it serves as the Qwen3.5 encoder of `serves_encoder`, if any."""
+ roles = [] if serves_encoder is None else [ModelRole(type=ModelType.Qwen35Encoder, variant=serves_encoder)]
+ return TextLLM_Checkpoint_Config(**_common(key, f"{key} llm"), roles=roles)
+
+
+def encoder_file(key: str, variant: Qwen35VariantType = Qwen35VariantType.Qwen35_9B, serves_text_llm: bool = True):
+ """A Qwen3.5 encoder record; it serves as a Text LLM when the file is a whole model."""
+ roles = [ModelRole(type=ModelType.TextLLM)] if serves_text_llm else []
+ return Qwen35Encoder_Checkpoint_Config(**_common(key, f"{key} encoder"), variant=variant, roles=roles)
+
+
+def text_llm_qwen3_folder(key: str, variant: Qwen3VariantType | None = Qwen3VariantType.Qwen3_4B):
+ """A complete Qwen3 causal-LM folder filed as a Text LLM; it serves as the Qwen3 encoder of `variant`, if any."""
+ roles = (
+ []
+ if variant is None
+ else [ModelRole(type=ModelType.Qwen3Encoder, format=ModelFormat.Qwen3Encoder, variant=variant)]
+ )
+ return TextLLM_Diffusers_Config(**_common(key, f"{key} folder"), roles=roles)
+
+
+def models_interface(configs: Mapping[str, AnyModelConfig]) -> ModelsInterface:
+ """The real `ModelsInterface` over a store holding `configs`, so identifiers resolve as in a running graph."""
+ store = SimpleNamespace(get_model=lambda key: configs[key])
+ services = SimpleNamespace(model_manager=SimpleNamespace(store=store))
+ return ModelsInterface(services, MagicMock(), MagicMock()) # type: ignore[arg-type]
+
+
+def node_context(configs: Mapping[str, AnyModelConfig]) -> SimpleNamespace:
+ return SimpleNamespace(models=models_interface(configs), logger=MagicMock())