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.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
feat(upscale): support MOSS-Image in the Upscale widget (#10257)
Francois Brodeur58b342ef16f2
diff --git a/docs/src/content/docs/Users Guide/04.Image Generation/upscale.mdx b/docs/src/content/docs/Users Guide/04.Image Generation/upscale.mdxindex b7f0339d51..b505092295 100644--- a/docs/src/content/docs/Users Guide/04.Image Generation/upscale.mdx+++ b/docs/src/content/docs/Users Guide/04.Image Generation/upscale.mdx@@ -86,14 +86,14 @@ The panel says what is missing before you can queue, for example "Select a compa## What each model family needs-Refine works with **SD1.5**, **SDXL**, **FLUX.1**, **FLUX.2**, **Z-Image**, **Anima**, **Krea-2** and **Qwen Image** main models.+Refine works with **SD1.5**, **SDXL**, **FLUX.1**, **FLUX.2**, **Z-Image**, **Anima**, **Krea-2**, **Qwen Image** and **MOSS-Image** main models.| Family | Tile ControlNet | Negative prompt | Detail pass || --- | --- | --- | --- || SD1.5, SDXL | Required | Yes | Tile by tile || FLUX.1, FLUX.2 | – | – | Whole image || Z-Image | Optional | When CFG > 1 | Whole image |-| Anima, Krea-2, Qwen Image | – | When CFG > 1 | Whole image |+| Anima, Krea-2, Qwen Image, MOSS-Image | – | When CFG > 1 | Whole image |Where a family has no Tile ControlNet, **Structure** is hidden. Where it ignores the negative prompt, the prompt is hidden and not recorded.@@ -137,12 +137,19 @@ Where a family has no Tile ControlNet, **Structure** is hidden. Where it ignores- **Components**: a **Qwen VL Encoder** and a **VAE** (the Wan 2.1 VAE, installed as a Qwen Image or Anima VAE). A Diffusers install brings its own.- **Not supported**: Qwen Image Edit models. Without a reference image they would carry a blank one the size of the output through every step, for about 2.5 to 3 times the time and nothing gained.</TabItem>+ <TabItem label="MOSS-Image">+ - **Tile ControlNet**: none.+ - **CFG scale**: set when you pick the model: 3.+ - **Steps**: kept as you set it, 30 by default, not the 50 the model uses for a full image. MOSS-Image runs all of **Steps** in the detail pass, so 30 steps really run 30 times, each at the enlarged size and, above CFG 1, as two network passes. Lower it if the pass is slow.+ - **Components**: a **Qwen3.5 Encoder** (9B, not the 4B Anima-3.8B uses) and a FLUX.2 **VAE**. A Diffusers install brings its own.+ - **Not supported**: LoRAs, which MOSS-Image has no loader for.+ </TabItem></Tabs>A value "set when you pick the model" is the model's default setting, which you can change in the Model Manager. Switching from FLUX.2 to another family sets **Steps** back to 30.:::note[Output size]-FLUX.1, FLUX.2, Z-Image, Krea-2 and Qwen Image need sizes that are a multiple of 16. When the enlarged image is not, the panel shrinks it slightly to the nearest fitting size before the detail pass: 2040 px becomes 2032 px. Other families, and Model only, round down to a multiple of 8.+FLUX.1, FLUX.2, Z-Image, Krea-2, Qwen Image and MOSS-Image need sizes that are a multiple of 16. When the enlarged image is not, the panel shrinks it slightly to the nearest fitting size before the detail pass: 2040 px becomes 2032 px. Other families, and Model only, round down to a multiple of 8.:::## Creativity per family@@ -161,6 +168,7 @@ FLUX.1, FLUX.2, Z-Image, Krea-2 and Qwen Image need sizes that are a multiple of| Anima | Euler, DPM++ 2M, DPM++ 2M SDE, ER-SDE | As Z-Image; the last 8 || Krea-2 | Euler only | As Z-Image; the last 7. Turbo and Raw both keep your **Steps**: Turbo, distilled for 8 steps, runs the end of a 30-step schedule || Qwen Image | Euler only | As Z-Image; the last 9 |+| MOSS-Image | Euler only | Starts where FLUX.1 does, then spreads all of **Steps** over the rest of the pass, as FLUX.2 does |Z-Image, Anima, Krea-2 and Qwen Image count the start in steps rather than in noise level, so the panel translates Creativity for them: it starts on the step whose noise level is closest to where FLUX.1 would start. A preset therefore means the same on every family. These families need at least 2 steps.diff --git a/invokeai/frontend/webv2/src/features/generation/settings.ts b/invokeai/frontend/webv2/src/features/generation/settings.tsindex 880f28aeb5..e8d34d42b9 100644--- a/invokeai/frontend/webv2/src/features/generation/settings.ts+++ b/invokeai/frontend/webv2/src/features/generation/settings.ts@@ -116,6 +116,7 @@ export {isDiffusersMainForBase,isFlux2MistralEncoder,isFlux2Qwen3EncoderForModel,+ isMossImageQwen35Encoder,isQwen3Vl4bEncoder,isVaeAcceptedByBase,isVaeCompatibleWithGenerateModel,diff --git a/invokeai/frontend/webv2/src/features/upscale/core/__snapshots__/upscaleGraphNodeTypes.json b/invokeai/frontend/webv2/src/features/upscale/core/__snapshots__/upscaleGraphNodeTypes.jsonindex 6c8e897c36..85281f3857 100644--- a/invokeai/frontend/webv2/src/features/upscale/core/__snapshots__/upscaleGraphNodeTypes.json+++ b/invokeai/frontend/webv2/src/features/upscale/core/__snapshots__/upscaleGraphNodeTypes.json@@ -58,6 +58,7 @@"flux2_klein_model_loader vae flux2_vae_encode vae","flux2_klein_text_encoder conditioning collect item","flux2_vae_encode latents flux2_denoise latents",+ "flux2_vae_encode latents moss_image_denoise latents","flux_denoise latents flux_vae_decode latents","flux_lora_collection_loader clip flux_text_encoder clip","flux_lora_collection_loader t5_encoder flux_text_encoder t5_encoder",@@ -84,6 +85,7 @@"integer value flux2_denoise seed","integer value flux_denoise seed","integer value krea2_denoise seed",+ "integer value moss_image_denoise seed","integer value noise seed","integer value qwen_image_denoise seed","integer value z_image_denoise seed",@@ -102,6 +104,14 @@"main_model_loader unet lora_collection_loader unet","main_model_loader vae i2l vae","main_model_loader vae l2i vae",+ "moss_image_denoise latents flux2_vae_decode latents",+ "moss_image_model_loader qwen3_5_encoder moss_image_text_encoder qwen3_5_encoder",+ "moss_image_model_loader transformer moss_image_denoise transformer",+ "moss_image_model_loader vae flux2_vae_decode vae",+ "moss_image_model_loader vae flux2_vae_encode vae",+ "moss_image_model_loader vae moss_image_denoise vae",+ "moss_image_text_encoder conditioning moss_image_denoise negative_conditioning",+ "moss_image_text_encoder conditioning moss_image_denoise positive_conditioning","noise noise tiled_multi_diffusion_denoise_latents noise","qwen_image_denoise latents qwen_image_l2i latents","qwen_image_i2l latents krea2_denoise latents",@@ -133,6 +143,7 @@"string value flux2_klein_text_encoder prompt","string value flux_text_encoder prompt","string value krea2_text_encoder prompt",+ "string value moss_image_text_encoder prompt","string value qwen_image_text_encoder prompt","string value sdxl_compel_prompt prompt","string value sdxl_compel_prompt style",@@ -292,6 +303,21 @@"unsharp_mask"]},+ "moss-image": {+ "nodeTypes": [+ "core_metadata",+ "flux2_vae_decode",+ "flux2_vae_encode",+ "img_resize",+ "integer",+ "moss_image_denoise",+ "moss_image_model_loader",+ "moss_image_text_encoder",+ "spandrel_image_to_image_autoscale",+ "string",+ "unsharp_mask"+ ]+ },"qwen-image": {"nodeTypes": ["collect",@@ -550,6 +576,7 @@"cfg_scale": [1,2,+ 3,4,4.5,5.5,@@ -1201,6 +1228,82 @@"vae"]},+ "moss_image_denoise": {+ "inputs": [+ "latents",+ "negative_conditioning",+ "positive_conditioning",+ "seed",+ "transformer",+ "vae"+ ],+ "literalInputs": {+ "cfg_scale": [+ 1,+ 3+ ],+ "denoising_end": [+ 1+ ],+ "denoising_start": [+ 0.49900000000000005+ ],+ "height": [+ 400+ ],+ "is_intermediate": [+ true+ ],+ "steps": [+ 30+ ],+ "use_cache": [+ true+ ],+ "width": [+ 800+ ]+ },+ "outputs": [+ "latents"+ ]+ },+ "moss_image_model_loader": {+ "inputs": [],+ "literalInputs": {+ "is_intermediate": [+ true+ ],+ "model": [],+ "qwen3_5_encoder_model": [],+ "use_cache": [+ true+ ],+ "vae_model": []+ },+ "outputs": [+ "qwen3_5_encoder",+ "transformer",+ "vae"+ ]+ },+ "moss_image_text_encoder": {+ "inputs": [+ "prompt",+ "qwen3_5_encoder"+ ],+ "literalInputs": {+ "is_intermediate": [+ true+ ],+ "use_cache": [+ true+ ]+ },+ "outputs": [+ "conditioning"+ ]+ },"noise": {"inputs": ["height",diff --git a/invokeai/frontend/webv2/src/features/upscale/core/graph.ts b/invokeai/frontend/webv2/src/features/upscale/core/graph.tsindex 846df7bcd8..f9f9b3f376 100644--- a/invokeai/frontend/webv2/src/features/upscale/core/graph.ts+++ b/invokeai/frontend/webv2/src/features/upscale/core/graph.ts@@ -907,9 +907,9 @@ const buildQwenImageUpscalePath: UpscalePathBuilder = ({};/**- * Z-Image's, Anima's, Krea-2's and Qwen Image's text encoders take their encoders on named fields. All but Qwen- * Image's hand the denoise a collected list; its denoise takes the one conditioning. The negative branch exists- * only where the caller decided it is read.+ * Z-Image's, Anima's, Krea-2's, Qwen Image's and MOSS-Image's text encoders take their encoders on named fields.+ * All but Qwen Image's and MOSS-Image's hand the denoise a collected list; theirs take the one conditioning. The+ * negative branch exists only where the caller decided it is read.*/const addPromptConditioning = (graph: BackendGraphContract,@@ -953,6 +953,81 @@ const addPromptConditioning = (}};+/**+ * MOSS-Image runs the pass whole like FLUX.2, whose VAE it shares: `moss_image_denoise` takes and returns the FLUX.2+ * VAE's raw latent layout, so the FLUX.2 encode and decode nodes, tiled at both ends, work on either side of it. It+ * clips by sigma value like FLUX. It has no LoRA loader and no tile ControlNet, so the pass is anchored only by where+ * it starts. Generate's layout prompt is left out: it only turns a layout draft or canvas regions into the prompt.+ */+const buildMossImageUpscalePath: UpscalePathBuilder = ({+ graph,+ settings,+ model,+ components,+ destination,+ positivePrompt,+ negativePrompt,+ seed,+ frame,+ denoiseSize,+ denoisingStart,+}) => {+ const modelLoader = addNode(graph, {+ id: 'model_loader',+ model: toModelIdentifier(model),+ qwen3_5_encoder_model: components.qwen35EncoderModel ? toModelIdentifier(components.qwen35EncoderModel) : undefined,+ type: 'moss_image_model_loader',+ vae_model: settings.vae ? toModelIdentifier(settings.vae) : undefined,+ });+ const imageToLatents = addNode(graph, {+ id: 'i2l',+ tile_size: settings.tileSize,+ tiled: true,+ type: 'flux2_vae_encode',+ });+ const denoise = addNode(graph, {+ cfg_scale: settings.cfgScale,+ denoising_end: 1,+ denoising_start: denoisingStart,+ height: denoiseSize.height,+ id: 'denoise_latents',+ steps: settings.steps,+ type: 'moss_image_denoise',+ width: denoiseSize.width,+ });+ const output = addNode(graph, {+ id: 'upscale_output',+ is_intermediate: destination === 'canvas',+ tile_size: settings.tileSize,+ tiled: true,+ type: 'flux2_vae_decode',+ use_cache: false,+ });++ addPromptConditioning(graph, {+ // The denoise takes the one conditioning, not a collected list.+ collect: false,+ denoise,+ encoderFields: [{ field: 'qwen3_5_encoder', source: modelLoader }],+ encoderType: 'moss_image_text_encoder',+ negativePrompt: wiresUpscaleNegativePrompt(model, settings.cfgScale) ? negativePrompt : null,+ positivePrompt,+ });+ addEdge(graph, modelLoader, 'transformer', denoise, 'transformer');+ addEdge(graph, seed, 'value', denoise, 'seed');+ const fitted = fitFrameToDenoiseSize(graph, frame, denoiseSize);++ addEdge(graph, fitted, 'image', imageToLatents, 'image');+ addEdge(graph, modelLoader, 'vae', imageToLatents, 'vae');+ addEdge(graph, imageToLatents, 'latents', denoise, 'latents');+ // The denoise reads this VAE's BatchNorm statistics, which define the latent space it works in.+ addEdge(graph, modelLoader, 'vae', denoise, 'vae');+ addEdge(graph, denoise, 'latents', output, 'latents');+ addEdge(graph, modelLoader, 'vae', output, 'vae');++ return { frame: fitted, output, title: `${model.name} upscale` };+};+/*** Keyed by the same bases as `UPSCALE_ARCHITECTURES`, and `satisfies` makes that a compile error to* break: declaring an architecture supported without giving it a builder will not type-check.@@ -962,6 +1037,7 @@ const UPSCALE_PATH_BUILDERS = {flux: buildFluxUpscalePath,flux2: buildFlux2UpscalePath,'krea-2': buildKrea2UpscalePath,+ 'moss-image': buildMossImageUpscalePath,'qwen-image': buildQwenImageUpscalePath,'sd-1': buildSdUpscalePath,sdxl: buildSdUpscalePath,diff --git a/invokeai/frontend/webv2/src/features/upscale/core/settings.ts b/invokeai/frontend/webv2/src/features/upscale/core/settings.tsindex b390737ce9..845276187b 100644--- a/invokeai/frontend/webv2/src/features/upscale/core/settings.ts+++ b/invokeai/frontend/webv2/src/features/upscale/core/settings.ts@@ -25,6 +25,7 @@ import {isLoraCompatibleWithModel,isLoraModelConfig,isMainModelConfig,+ isMossImageQwen35Encoder,isModelIdentifierConfig,isQwen3Vl4bEncoder,isVaeCompatibleWithGenerateModel,@@ -189,6 +190,12 @@ const ANIMA_QWEN35_SLOT: UpscaleComponentSlot = {field: 'qwen35EncoderModel',label: 'Qwen3.5 encoder',};+// MOSS-Image reads the Qwen3.5 9B; the 4B Anima-3.8B uses is the same model type and its hidden size does not fit.+const MOSS_IMAGE_QWEN35_SLOT: UpscaleComponentSlot = {+ accepts: isMossImageQwen35Encoder,+ field: 'qwen35EncoderModel',+ label: 'Qwen3.5 9B encoder',+};// Krea-2 reads the 4B; Ideogram 4's 8B is the same model type and `krea2_model_loader` refuses it.const KREA2_QWEN3_VL_SLOT: UpscaleComponentSlot = {accepts: isQwen3Vl4bEncoder,@@ -319,8 +326,9 @@ export interface UpscaleArchitecture {* Whether a new main model sets CFG to that model's served default. Z-Image Turbo and Krea-2 Turbo are* distilled for CFG 1, and anything above runs a second, unconditional pass per step at upscale* resolution; Z-Image Base, Anima, Krea-2 Raw and Qwen Image want 4 to 6, and FLUX.2 [dev] a guidance of- * 3.5 (Klein reads none). SD and FLUX.1 keep the user's CFG -- SD's multi-diffusion pass is tuned to the- * widget's 2 -- and get that 2 back when the user comes from one of the others.+ * 3.5 (Klein reads none); MOSS-Image takes its served 3. SD and FLUX.1 keep the user's CFG -- SD's+ * multi-diffusion pass is tuned to the widget's 2 -- and get that 2 back when the user comes from one of the+ * others.*/readonly takesModelGuidance: boolean;/**@@ -441,6 +449,23 @@ export const UPSCALE_ARCHITECTURES = {takesModelSteps: false,tileControlNet: null,},+ 'moss-image': {+ // `moss_image_model_loader` takes a Diffusers install's own Qwen3.5 and VAE; any other format needs both.+ components: (model) =>+ model.format === 'diffusers' ? NO_COMPONENTS : { slots: [MOSS_IMAGE_QWEN35_SLOT], vae: true },+ denoiseGrid: 16,+ // `moss_image_denoise` clips by sigma value like FLUX, then re-spaces the window to the requested steps.+ indexClipping: null,+ label: 'MOSS-Image',+ negativePrompt: 'cfg-gated',+ // `moss_image_denoise` has no scheduler input: it steps its own shifted Euler schedule.+ schedulers: ['euler'],+ takesModelGuidance: true,+ // Not distilled: the served 50 is a full-schedule txt2img default, and the re-spaced window would run all of it+ // at upscale resolution, two transformer passes each at CFG 3.+ takesModelSteps: false,+ tileControlNet: null,+ },'qwen-image': {// `qwen_image_model_loader` takes a Diffusers install's own encoder and VAE; the widget sends no component// source, so any other format needs both.diff --git a/invokeai/frontend/webv2/src/features/upscale/core/upscaleGraphCoverage.testing.ts b/invokeai/frontend/webv2/src/features/upscale/core/upscaleGraphCoverage.testing.tsindex aa2f56e8d8..9eae10037b 100644--- a/invokeai/frontend/webv2/src/features/upscale/core/upscaleGraphCoverage.testing.ts+++ b/invokeai/frontend/webv2/src/features/upscale/core/upscaleGraphCoverage.testing.ts@@ -30,6 +30,7 @@ export const INSTALLED = [model('qwen3-8b', 'qwen3_encoder', 'any', { variant: 'qwen3_8b' }),model('qwen3-06b', 'qwen3_encoder', 'any', { variant: 'qwen3_06b' }),model('qwen35', 'qwen3_5_encoder', 'any', { variant: 'qwen3_5_4b' }),+ model('qwen35-9b', 'qwen3_5_encoder', 'any', { variant: 'qwen3_5_9b' }),model('qwen3vl-4b', 'qwen3_vl_encoder', 'any', { variant: 'qwen3_vl_4b' }),model('qwen-vl', 'qwen_vl_encoder', 'any'),model('mistral', 'mistral_encoder', 'any', { variant: 'mistral3_24b' }),@@ -43,7 +44,7 @@ export const INSTALLED = [/*** One case per path a builder can take: CFG above 1 where the negative branch is CFG-gated, the- * optional Z-Image ControlNet, a bundled Z-Image, Krea-2, FLUX.2 or Qwen Image install, Anima-3.8B's+ * optional Z-Image ControlNet, a bundled Z-Image, Krea-2, FLUX.2, MOSS-Image or Qwen Image install, Anima-3.8B's* second encoder, and FLUX.2 Klein at either encoder size and [dev] with its own loaders.*/export const CASES: { label: string; main: ModelConfig; patch?: Partial<UpscaleWidgetValues> }[] = [@@ -90,6 +91,12 @@ export const CASES: { label: string; main: ModelConfig; patch?: Partial<UpscaleWlabel: 'flux2-diffusers',main: model('klein-diffusers', 'main', 'flux2', { format: 'diffusers', variant: 'klein_9b' }),},+ { label: 'moss-image', main: model('moss', 'main', 'moss-image', { format: 'gguf_quantized' }) },+ {+ label: 'moss-image-diffusers',+ main: model('moss-diffusers', 'main', 'moss-image', { format: 'diffusers' }),+ patch: { cfgScale: 1 },+ },{label: 'qwen-image',main: model('qwen', 'main', 'qwen-image', { format: 'gguf_quantized', variant: 'generate' }),diff --git a/invokeai/frontend/webv2/src/workbench/invocation.test.ts b/invokeai/frontend/webv2/src/workbench/invocation.test.tsindex b46d0ace96..a9ddc39723 100644--- a/invokeai/frontend/webv2/src/workbench/invocation.test.ts+++ b/invokeai/frontend/webv2/src/workbench/invocation.test.ts@@ -309,7 +309,7 @@ describe('resolveInvocationRoute — upscale source', () => {expect(result.sourceValid).toBe(false);expect(result.validationReasons.map(reasonText)).toContain(- 'Upscale supports only SD1.5, SDXL, FLUX.1, FLUX.2, Z-Image, Anima, Krea-2 or Qwen Image main models.'+ 'Upscale supports only SD1.5, SDXL, FLUX.1, FLUX.2, Z-Image, Anima, Krea-2, MOSS-Image or Qwen Image main models.');});diff --git a/tests/app/invocations/test_frontend_graph_node_types.py b/tests/app/invocations/test_frontend_graph_node_types.pyindex e87c8e1187..f96081b6c9 100644--- a/tests/app/invocations/test_frontend_graph_node_types.py+++ b/tests/app/invocations/test_frontend_graph_node_types.py@@ -103,15 +103,15 @@ def test_every_connection_the_panel_compiles_is_one_the_queue_will_accept(contra# The number of architectures each panel supports. A contract that silently stopped being# regenerated would make every assertion below vacuous, so the count is pinned: a new architecture# updates this number and the fixture in the same commit.-SUPPORTED_BASE_COUNTS = {"generate": 17, "video": 3, "upscale": 8}+SUPPORTED_BASE_COUNTS = {"generate": 17, "video": 3, "upscale": 9}# Floors separating "the fixture records literals" from "it records a fraction of them". Set just# under the current numbers (generate: 83 node types carrying 400 scalar values; video: 25 carrying-# 142; upscale: 58 carrying 236) rather than far below them: a recording bug that dropped most of the+# 142; upscale: 62 carrying 258) rather than far below them: a recording bug that dropped most of the# values while keeping the names would otherwise leave every annotation check below passing over a# short list. They are not per-architecture expectations, so removing an architecture means lowering# them deliberately.-LITERAL_FLOORS = {"generate": (80, 385), "video": (23, 135), "upscale": (56, 225)}+LITERAL_FLOORS = {"generate": (80, 385), "video": (23, 135), "upscale": (60, 245)}@pytest.mark.parametrize("contract", sorted(CONTRACTS), ids=lambda contract: contract)