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(webv2): restore parity after upstream sync
joshistoastea7295f9807c
diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/useGalleryUploadAction.browser.test.tsx b/invokeai/frontend/webv2/src/features/gallery/ui/useGalleryUploadAction.browser.test.tsxindex 5adb0cff09..244d9a536b 100644--- a/invokeai/frontend/webv2/src/features/gallery/ui/useGalleryUploadAction.browser.test.tsx+++ b/invokeai/frontend/webv2/src/features/gallery/ui/useGalleryUploadAction.browser.test.tsx@@ -2,6 +2,7 @@ import type { GalleryUiAdapter } from '@features/gallery/react';import { GalleryUiProvider } from '@features/gallery/react';import { accountLifecycle } from '@platform/state/accountLifecycle';+import { ApiError } from '@platform/transport/http';import { QueryClient, QueryClientProvider } from '@tanstack/react-query';import { act, createRef, type Ref, type ReactNode, useCallback, useImperativeHandle, useRef } from 'react';import { createRoot, type Root } from 'react-dom/client';@@ -354,4 +355,19 @@ describe('focused gallery upload action', () => {expect.objectContaining({ message: '1 images and 0 videos uploaded to Uncategorized. 0 failed.' }));});++ it('surfaces the first actionable API detail when every upload fails', async () => {+ mocks.uploadGalleryImage.mockRejectedValue(new ApiError('{"detail":"Image storage maintenance is active"}', 409));++ await act(async () => {+ await uploadFilesRef.current?.([new File(['image'], 'photo.png', { type: 'image/png' })]);+ });++ expect(mocks.notificationsReportError).toHaveBeenCalledWith({+ area: 'gallery-upload',+ message: 'Image storage maintenance is active',+ namespace: 'gallery',+ });+ expect(mocks.notificationsAdd).not.toHaveBeenCalled();+ });});diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/useGalleryUploadAction.ts b/invokeai/frontend/webv2/src/features/gallery/ui/useGalleryUploadAction.tsindex 43b869cfd1..436866a149 100644--- a/invokeai/frontend/webv2/src/features/gallery/ui/useGalleryUploadAction.ts+++ b/invokeai/frontend/webv2/src/features/gallery/ui/useGalleryUploadAction.ts@@ -15,6 +15,7 @@ import {captureAccountScope,isAccountScopeCurrent,} from '@platform/state/accountLifecycle';+import { getApiErrorMessage } from '@platform/transport/http';import { useQueryClient } from '@tanstack/react-query';import { useCallback } from 'react';import { useTranslation } from 'react-i18next';@@ -116,9 +117,12 @@ export const useGalleryUploadAction = ({const failedCount = files.length - uploadedItems.length;if (uploadedItems.length === 0) {+ const fallback = t('widgets.gallery.uploadFailed', { failed: failedCount });+ const firstFailure = [...imageResults, ...videoResults].find((result) => result.status === 'rejected');+notifications.reportError({area: 'gallery-upload',- message: t('widgets.gallery.uploadFailed', { failed: failedCount }),+ message: firstFailure ? getApiErrorMessage(firstFailure.reason, fallback) : fallback,namespace: 'gallery',});return;diff --git a/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.test.ts b/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.test.tsindex 76d9855b31..651dca37f9 100644--- a/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.test.ts+++ b/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.test.ts@@ -286,6 +286,33 @@ describe('component policies', () => {).toEqual(['Generate needs a T5 Encoder for FLUX models.', 'Generate needs a CLIP Embed model for FLUX models.']);});+ it('requires standalone components for partial SDNQ folders but not complete pipelines', () => {+ const completePipeline = { text_encoder: {}, tokenizer: {}, transformer: {}, vae: {} };+ const completeFlux1Pipeline = { ...completePipeline, text_encoder_2: {}, tokenizer_2: {} };++ for (const model of [+ createModel('flux', { format: 'sdnq_quantized', submodels: completeFlux1Pipeline }),+ createModel('flux2', { format: 'sdnq_quantized', submodels: completePipeline, variant: 'klein_9b' }),+ createModel('z-image', { format: 'sdnq_quantized', submodels: completePipeline }),+ ]) {+ expect(getGenerationValidationReasons(model, createSettings(model))).toEqual([]);+ }++ expect(+ getGenerationValidationReasons(+ createModel('flux', { format: 'sdnq_quantized', submodels: { transformer: {} } }),+ createSettings(createModel('flux', { format: 'sdnq_quantized', submodels: { transformer: {} } }))+ )+ ).toContain('Generate needs a T5 Encoder for FLUX models.');++ for (const model of [+ createModel('flux2', { format: 'sdnq_quantized', submodels: { transformer: {} }, variant: 'klein_9b' }),+ createModel('z-image', { format: 'sdnq_quantized', submodels: { transformer: {} } }),+ ]) {+ expect(getGenerationValidationReasons(model, createSettings(model))).not.toEqual([]);+ }+ });+it('rejects unsupported FLUX dev_fill variant', () => {const model = createModel('flux', { variant: 'dev_fill' });@@ -401,6 +428,25 @@ describe('component policies', () => {).toEqual([]);});+ it('offers complete SDNQ Z-Image pipelines as component sources but rejects partial folders', () => {+ const model = createModel('z-image', { format: 'checkpoint' });+ const settings = createSettings(model);+ const sourceFilter = getComponentSectionPolicy(model, settings).slots.find(+ (slot) => slot.key === 'componentSourceModel'+ )?.filter;+ const complete = createModel('z-image', {+ format: 'sdnq_quantized',+ submodels: { text_encoder: {}, tokenizer: {}, transformer: {}, vae: {} },+ });+ const partial = createModel('z-image', {+ format: 'sdnq_quantized',+ submodels: { transformer: {} },+ });++ expect(sourceFilter?.(complete, { model, selectedComponents: { ...settings }, settings })).toBe(true);+ expect(sourceFilter?.(partial, { model, selectedComponents: { ...settings }, settings })).toBe(false);+ });+it('validates Anima Qwen3 and allowed VAE bases', () => {const model = createModel('anima');diff --git a/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts b/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.tsindex ee618827c9..f7155cd1c4 100644--- a/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts+++ b/invokeai/frontend/webv2/src/features/generation/core/baseGenerationPolicies.ts@@ -18,6 +18,7 @@ import type {import {getCompatibleDiffusersComponentSource,+ isBundledMainForBase,isAnimaQwen3Encoder,isAnimaVae,isKrea2Vae,@@ -27,6 +28,8 @@ import {isFlux2MistralEncoder,isFlux2Qwen3EncoderForModel,isNonAnimaQwen3Encoder,+ isSelfContainedSDNQFlux1Pipeline,+ isSelfContainedSDNQPipeline,isVaeForBases,type GenerateComponentFilter,} from './componentCompatibility';@@ -939,15 +942,15 @@ type ComponentSourceCandidate = {};const isFlux2DiffusersSource = (source: ComponentSourceCandidate | null | undefined): source is MainModelConfig =>- Boolean(source && source.type === 'main' && source.base === 'flux2' && source.format === 'diffusers');+ Boolean(source && isBundledMainForBase('flux2')(source));const hasFlux2DiffusersVaeSource = (ctx: ComponentPolicyContext): boolean =>ctx.model.type !== 'external_image_generator' &&- (ctx.model.format === 'diffusers' || isFlux2DiffusersSource(ctx.settings.componentSourceModel));+ (isBundledMainForBase('flux2')(ctx.model) || isFlux2DiffusersSource(ctx.settings.componentSourceModel));const hasFlux2DiffusersEncoderSource = (ctx: ComponentPolicyContext): boolean =>ctx.model.type !== 'external_image_generator' &&- (ctx.model.format === 'diffusers' ||+ (isBundledMainForBase('flux2')(ctx.model) ||Boolean(ctx.settings.componentSourceModel && isFlux2DiffusersSourceForModel(ctx.model)(ctx.settings.componentSourceModel)));@@ -982,7 +985,7 @@ export const getAutoFlux2ComponentSourceModel = (const encoderModel = model.variant === 'dev' ? settings.mistralEncoderModel : settings.qwen3EncoderModel;- if (model.format === 'diffusers' || (encoderModel && settings.vae)) {+ if (isBundledMainForBase('flux2')(model) || (encoderModel && settings.vae)) {return null;}@@ -999,7 +1002,7 @@ export const getAutoFlux2ComponentSourceModel = (// Split/quantized families can satisfy required encoder/VAE slots from a bundled Diffusers source.const isBundledOrDiffusersSourceSatisfied = (ctx: ComponentPolicyContext): boolean =>ctx.model.type !== 'external_image_generator' &&- (ctx.model.format === 'diffusers' || hasCompatibleComponentSource(ctx));+ (isBundledMainForBase(ctx.model.base)(ctx.model) || hasCompatibleComponentSource(ctx));// Slot validation is shared by invocation readiness and graph preflight so picker requirements cannot drift.const validateSlots = (policy: Pick<ComponentSectionPolicy, 'slots'>, ctx: ComponentPolicyContext): string[] =>@@ -1033,20 +1036,20 @@ const getBaseComponentSectionPolicy = (switch (model.base) {case 'flux':return {- ...createPolicy(false, [+ ...createPolicy(!isSelfContainedSDNQFlux1Pipeline(model), [{...t5EncoderSlot('Required for FLUX.1 models.'),- required: () => true,+ required: (ctx) => !isSelfContainedSDNQFlux1Pipeline(ctx.model),missingMessage: 'Generate needs a T5 Encoder for FLUX models.',},{...clipEmbedSlot('Required for FLUX.1 models.'),- required: () => true,+ required: (ctx) => !isSelfContainedSDNQFlux1Pipeline(ctx.model),missingMessage: 'Generate needs a CLIP Embed model for FLUX models.',},{...vaeSlot('Required for FLUX.1 models.', isVaeForBases(['flux'])),- required: () => true,+ required: (ctx) => !isSelfContainedSDNQFlux1Pipeline(ctx.model),missingMessage: 'Generate needs a VAE for FLUX models.',},]),@@ -1077,7 +1080,7 @@ const getBaseComponentSectionPolicy = (missingMessage: 'Generate needs a Qwen3 Encoder for non-Diffusers FLUX.2 models.',};- return createPolicy(model.format !== 'diffusers', [+ return createPolicy(!isSelfContainedSDNQPipeline(model) && model.format !== 'diffusers', [encoderSlot,{...vaeSlot(@@ -1117,10 +1120,10 @@ const getBaseComponentSectionPolicy = (},]);case 'z-image':- return createPolicy(model.format !== 'diffusers', [+ return createPolicy(!isBundledMainForBase('z-image')(model), [componentSourceSlot(- (candidate) => isDiffusersMainForBase('z-image')(candidate),- 'Select a Diffusers Z-Image model to provide VAE and Qwen3 components.'+ (candidate) => isBundledMainForBase('z-image')(candidate),+ 'Select a bundled Z-Image pipeline to provide VAE and Qwen3 components.'),{...qwen3EncoderSlot('Required unless a Diffusers component source is available.', isNonAnimaQwen3Encoder),diff --git a/invokeai/frontend/webv2/src/features/generation/core/canvas/compileCanvasGraph.ts b/invokeai/frontend/webv2/src/features/generation/core/canvas/compileCanvasGraph.tsindex 5744bedc18..020c15bdda 100644--- a/invokeai/frontend/webv2/src/features/generation/core/canvas/compileCanvasGraph.ts+++ b/invokeai/frontend/webv2/src/features/generation/core/canvas/compileCanvasGraph.ts@@ -523,7 +523,11 @@ export const compileCanvasGraph = (input: CompileCanvasGraphInput): CompiledCanv// Mirror compileGenerateGraph: only a `canvas` destination stages an// intermediate output; `gallery` produces a durable image.const outputIsIntermediate = destination === 'canvas';- const backendGraph = builder(settings, model, outputIsIntermediate, projectSettings);+ const runtimeProjectSettings = {+ ...projectSettings,+ randDevice: input.randDevice ?? (projectSettings.useCpuNoise ? 'cpu' : 'cuda'),+ };+ const backendGraph = builder(settings, model, outputIsIntermediate, runtimeProjectSettings);const compositing = input.compositing ?? DEFAULT_CANVAS_COMPOSITING;// Validation above guarantees the composite/mask images required per mode.diff --git a/invokeai/frontend/webv2/src/features/generation/core/canvas/types.ts b/invokeai/frontend/webv2/src/features/generation/core/canvas/types.tsindex dbe9462dfc..316acb2b94 100644--- a/invokeai/frontend/webv2/src/features/generation/core/canvas/types.ts+++ b/invokeai/frontend/webv2/src/features/generation/core/canvas/types.ts@@ -57,6 +57,8 @@ export interface CompileCanvasGraphInput {settings: GenerateSettings;model: GenerateModelConfig;projectSettings: GenerationProjectSettings;+ /** Runtime-derived random-device metadata; defaults to the legacy CPU/CUDA value for direct callers. */+ randDevice?: string;/** The resolved canvas mode (from `canvasMode.ts`). */mode: CanvasCompileMode;/**diff --git a/invokeai/frontend/webv2/src/features/generation/core/componentCompatibility.test.ts b/invokeai/frontend/webv2/src/features/generation/core/componentCompatibility.test.tsindex d4abdac056..632a300db2 100644--- a/invokeai/frontend/webv2/src/features/generation/core/componentCompatibility.test.ts+++ b/invokeai/frontend/webv2/src/features/generation/core/componentCompatibility.test.ts@@ -10,6 +10,8 @@ import {isFlux2MistralEncoder,isFlux2Qwen3EncoderForModel,isNonAnimaQwen3Encoder,+ isSelfContainedSDNQFlux1Pipeline,+ isSelfContainedSDNQPipeline,isVaeCompatibleWithGenerateModel,isVaeForBases,type GenerateComponentCandidate,@@ -30,6 +32,41 @@ const candidate = (overrides: Partial<GenerateComponentCandidate>): GenerateComp});describe('Generate component compatibility', () => {+ it('only treats SDNQ folders with every required pipeline component as self-contained', () => {+ const complete = candidate({+ format: 'sdnq_quantized',+ submodels: { text_encoder: {}, tokenizer: {}, transformer: {}, vae: {} },+ });+ const partial = candidate({+ format: 'sdnq_quantized',+ submodels: { transformer: {} },+ });++ expect(isSelfContainedSDNQPipeline(complete)).toBe(true);+ expect(isSelfContainedSDNQPipeline(partial)).toBe(false);+ });++ it('requires both text-encoder pairs before a FLUX.1 SDNQ folder is self-contained', () => {+ const complete = candidate({+ format: 'sdnq_quantized',+ submodels: {+ text_encoder: {},+ text_encoder_2: {},+ tokenizer: {},+ tokenizer_2: {},+ transformer: {},+ vae: {},+ },+ });+ const missingT5Pair = candidate({+ format: 'sdnq_quantized',+ submodels: { text_encoder: {}, tokenizer: {}, transformer: {}, vae: {} },+ });++ expect(isSelfContainedSDNQFlux1Pipeline(complete)).toBe(true);+ expect(isSelfContainedSDNQFlux1Pipeline(missingT5Pair)).toBe(false);+ });+it('separates Anima Qwen3 0.6B encoders from other Qwen3 encoders', () => {const qwen06b = candidate({ variant: 'qwen3_06b' });const qwen4b = candidate({ variant: 'qwen3_4b' });diff --git a/invokeai/frontend/webv2/src/features/generation/core/componentCompatibility.ts b/invokeai/frontend/webv2/src/features/generation/core/componentCompatibility.tsindex 02c88f862a..25bd4c30ea 100644--- a/invokeai/frontend/webv2/src/features/generation/core/componentCompatibility.ts+++ b/invokeai/frontend/webv2/src/features/generation/core/componentCompatibility.ts@@ -4,6 +4,7 @@ export type GenerateComponentCandidate = {base: string;format?: string;key?: string;+ submodels?: Record<string, unknown> | null;type: string;variant?: unknown;};@@ -17,6 +18,38 @@ export const KLEIN_TO_QWEN3_VARIANT: Record<string, string> = {klein_9b_base: 'qwen3_8b',};+const SDNQ_PIPELINE_COMPONENTS = ['transformer', 'vae', 'text_encoder', 'tokenizer'] as const;+const SDNQ_FLUX1_COMPONENTS = [...SDNQ_PIPELINE_COMPONENTS, 'text_encoder_2', 'tokenizer_2'] as const;++const hasSubmodels = (model: GenerateComponentCandidate, required: readonly string[]): boolean => {+ if (model.format !== 'sdnq_quantized' || !model.submodels) {+ return false;+ }++ return required.every((submodel) => Boolean(model.submodels?.[submodel]));+};++export const isSelfContainedSDNQPipeline = (model: GenerateComponentCandidate): boolean =>+ hasSubmodels(model, SDNQ_PIPELINE_COMPONENTS);++export const isSelfContainedSDNQFlux1Pipeline = (model: GenerateComponentCandidate): boolean =>+ hasSubmodels(model, SDNQ_FLUX1_COMPONENTS);++export const isBundledMainForBase =+ (base: string): GenerateComponentFilter =>+ (model) => {+ if (model.type !== 'main' || model.base !== base) {+ return false;+ }+ if (model.format === 'diffusers') {+ return true;+ }+ if (base === 'flux') {+ return isSelfContainedSDNQFlux1Pipeline(model);+ }+ return (base === 'flux2' || base === 'z-image') && isSelfContainedSDNQPipeline(model);+ };+export const getCompatibleSelectedComponentKey = (value: ComponentModelConfig | null,filter?: GenerateComponentFilter@@ -67,7 +100,7 @@ export const isFlux2DiffusersSourceForModel = (selectedModel: GenerateModelConficonst requiredVariant = selectedVariant ? KLEIN_TO_QWEN3_VARIANT[selectedVariant] : null;return (model) => {- if (!isDiffusersMainForBase('flux2')(model)) {+ if (!isBundledMainForBase('flux2')(model)) {return false;}@@ -97,7 +130,7 @@ export const isCompatibleDiffusersComponentSourceForModel = (return isFlux2DiffusersSourceForModel(selectedModel)(source);}- return isDiffusersMainForBase(selectedModel.base)(source);+ return isBundledMainForBase(selectedModel.base)(source);};export const getCompatibleDiffusersComponentSource = <T extends GenerateComponentCandidate>(diff --git a/invokeai/frontend/webv2/src/features/generation/core/graph.test.ts b/invokeai/frontend/webv2/src/features/generation/core/graph.test.tsindex 529d4deb61..31df4cc692 100644--- a/invokeai/frontend/webv2/src/features/generation/core/graph.test.ts+++ b/invokeai/frontend/webv2/src/features/generation/core/graph.test.ts@@ -32,6 +32,8 @@ const flux2Klein9bModel: MainModelConfig = {type: 'main',variant: 'klein_9b',};+const completeSdnqPipeline = { text_encoder: {}, tokenizer: {}, transformer: {}, vae: {} };+const completeFlux1SdnqPipeline = { ...completeSdnqPipeline, text_encoder_2: {}, tokenizer_2: {} };const flux2DevModel: MainModelConfig = {base: 'flux2',format: 'diffusers',@@ -185,6 +187,18 @@ describe('compileGenerateGraph', () => {expect(graph.nodes.canvas_output?.color_compensation).toBe('None');});+ it('records the accelerator supplied by the orchestration boundary in metadata', () => {+ const graph = compileGenerateGraph(+ createSettings(sd1Model),+ sd1Model,+ 'gallery',+ { useCpuNoise: false },+ 'xpu'+ ).backendGraph;++ expect(getNodeByType(graph, 'core_metadata')?.rand_device).toBe('xpu');+ });+it('passes SDXL color compensation to the VAE decode node when enabled', () => {const graph = compile(sdxlModel, { colorCompensation: true });@@ -379,6 +393,32 @@ describe('compileGenerateGraph', () => {expect(compile(zImageModel).nodes.model_loader?.type).toBe('z_image_model_loader');});+ it('builds complete SDNQ pipeline graphs without standalone component overrides', () => {+ const flux = compile({+ ...fluxModel,+ format: 'sdnq_quantized',+ submodels: completeFlux1SdnqPipeline,+ });+ const flux2 = compile({+ ...flux2Klein9bModel,+ format: 'sdnq_quantized',+ submodels: completeSdnqPipeline,+ });+ const zImage = compile({+ ...zImageModel,+ format: 'sdnq_quantized',+ submodels: completeSdnqPipeline,+ });++ expect(flux.nodes.model_loader).toMatchObject({+ clip_embed_model: undefined,+ t5_encoder_model: undefined,+ vae_model: undefined,+ });+ expect(flux2.nodes.model_loader).toMatchObject({ qwen3_encoder_model: undefined, vae_model: undefined });+ expect(zImage.nodes.model_loader).toMatchObject({ qwen3_encoder_model: undefined, vae_model: undefined });+ });+it('builds FLUX.2 [dev] graphs with standalone components and dev LoRAs', () => {const graph = compile(flux2DevGgufModel, {loras: [{ isEnabled: true, model: flux2DevLora, weight: 0.75 }],diff --git a/invokeai/frontend/webv2/src/features/generation/core/graph.ts b/invokeai/frontend/webv2/src/features/generation/core/graph.tsindex 0c32d4e395..35e9980e8c 100644--- a/invokeai/frontend/webv2/src/features/generation/core/graph.ts+++ b/invokeai/frontend/webv2/src/features/generation/core/graph.ts@@ -29,9 +29,11 @@ import {getCompatibleDiffusersComponentSource,isAnimaQwen3Encoder,isAnimaVae,+ isBundledMainForBase,isFlux2MistralEncoder,isFlux2Qwen3EncoderForModel,isNonAnimaQwen3Encoder,+ isSelfContainedSDNQFlux1Pipeline,isKrea2Vae,isVaeForBases,} from './componentCompatibility';@@ -221,7 +223,7 @@ const addFluxKontextReferenceImages = (};const getDiffusersSource = (settings: GenerateSettings, model: MainModelConfig): MainModelConfig | undefined =>- getCompatibleComponentSource(settings, model) ?? (model.format === 'diffusers' ? model : undefined);+ getCompatibleComponentSource(settings, model) ?? (isBundledMainForBase(model.base)(model) ? model : undefined);const requireComponent = <T extends ComponentModelConfig | null>(value: T, label: string): NonNullable<T> => {if (!value) {@@ -608,18 +610,19 @@ const buildFluxGraph = (const graph: BackendGraphContract = { edges: [], id: createId('flux_graph'), nodes: {} };const { positivePrompt, seed } = addPromptAndSeedNodes(graph);- const t5EncoderModel = requireComponent(settings.t5EncoderModel, 'T5 Encoder');- const clipEmbedModel = requireComponent(settings.clipEmbedModel, 'CLIP Embed');- const vaeModel = requireComponent(getCompatibleVae(settings, ['flux']), 'FLUX VAE');+ const hasBundledComponents = isSelfContainedSDNQFlux1Pipeline(model);+ const t5EncoderModel = hasBundledComponents ? null : requireComponent(settings.t5EncoderModel, 'T5 Encoder');+ const clipEmbedModel = hasBundledComponents ? null : requireComponent(settings.clipEmbedModel, 'CLIP Embed');+ const vaeModel = hasBundledComponents ? null : requireComponent(getCompatibleVae(settings, ['flux']), 'FLUX VAE');const scheduler = coerceSchedulerForGraph(model, settings.scheduler);const activeLoras = getActiveCompatibleLoras(settings, model);const modelLoader = addNode(graph, {- clip_embed_model: clipEmbedModel,+ clip_embed_model: clipEmbedModel ?? undefined,id: 'model_loader',model,- t5_encoder_model: t5EncoderModel,+ t5_encoder_model: t5EncoderModel ?? undefined,type: 'flux_model_loader',- vae_model: vaeModel,+ vae_model: vaeModel ?? undefined,});const loraSource = activeLoras.length? addTransformerLoraCollectionLoader(graph, activeLoras, 'flux_lora_collection_loader', modelLoader, [@@ -669,11 +672,11 @@ const buildFluxGraph = (addIPAdapterReferenceImages(graph, settings, model, denoise);addFluxReduxReferenceImages(graph, settings, model, denoise);addMetadata(graph, output, settings, model, 'flux_txt2img', projectSettings, {- clip_embed_model: clipEmbedModel,+ clip_embed_model: clipEmbedModel ?? undefined,guidance: settings.cfgScale,scheduler,- t5_encoder: t5EncoderModel,- vae: vaeModel,+ t5_encoder: t5EncoderModel ?? undefined,+ vae: vaeModel ?? undefined,...(shouldUsePidDecode(settings, model.base) ? getPidMetadata(settings) : {}),});addReferenceImageMetadata(graph, output, settings);@@ -689,7 +692,7 @@ const buildFlux2Graph = (): BackendGraphContract => {const isDev = model.variant === 'dev';const sourceModel = getFlux2DiffusersComponentSource(model, settings);- const hasBundledComponents = model.format === 'diffusers' || sourceModel;+ const hasBundledComponents = isBundledMainForBase('flux2')(model) || sourceModel;const mistralEncoderModel =settings.mistralEncoderModel && isFlux2MistralEncoder(settings.mistralEncoderModel)? settings.mistralEncoderModel@@ -1417,7 +1420,8 @@ export const compileGenerateGraph = (settings: GenerateSettings,model: GenerateModelConfig,destination: ResultDestination,- projectSettings: GenerationProjectSettings+ projectSettings: GenerationProjectSettings,+ randDevice = projectSettings.useCpuNoise ? 'cpu' : 'cuda'): CompiledGenerateGraph => {const validationReasons = getGenerationValidationReasons(model, settings);@@ -1426,9 +1430,10 @@ export const compileGenerateGraph = (}const outputIsIntermediate = destination === 'canvas';+ const runtimeProjectSettings = { ...projectSettings, randDevice };const backendGraph = (() => {if (model.type === 'external_image_generator') {- return buildExternalGraph(settings, model, outputIsIntermediate, projectSettings);+ return buildExternalGraph(settings, model, outputIsIntermediate, runtimeProjectSettings);}const builder = GRAPH_BUILDERS[model.base as SupportedGenerateBase];@@ -1439,7 +1444,7 @@ export const compileGenerateGraph = (throw new Error(`${model.name} dimensions must be multiples of ${dimensionGrid}.`);}- return builder(settings, model, outputIsIntermediate, projectSettings);+ return builder(settings, model, outputIsIntermediate, runtimeProjectSettings);})();return {diff --git a/invokeai/frontend/webv2/src/features/generation/core/graphBuilder.ts b/invokeai/frontend/webv2/src/features/generation/core/graphBuilder.tsindex c66a596266..2d3a6d531e 100644--- a/invokeai/frontend/webv2/src/features/generation/core/graphBuilder.ts+++ b/invokeai/frontend/webv2/src/features/generation/core/graphBuilder.ts@@ -63,7 +63,7 @@ export const addMetadata = (settings: GenerateSettings,model: GenerateModelConfig,generationMode: string | null,- projectSettings: GenerationProjectSettings,+ projectSettings: GenerationProjectSettings & { randDevice?: string },extras: Record<string, unknown> = {}) => {const activeLoras = getActiveCompatibleLoras(settings, model);@@ -75,7 +75,7 @@ export const addMetadata = (height: settings.height,id: createId('core_metadata'),model,- rand_device: projectSettings.useCpuNoise ? 'cpu' : 'cuda',+ rand_device: projectSettings.randDevice ?? (projectSettings.useCpuNoise ? 'cpu' : 'cuda'),scheduler,seamless_x: settings.seamlessXAxis,seamless_y: settings.seamlessYAxis,diff --git a/invokeai/frontend/webv2/src/features/generation/data/promptUtilities.test.ts b/invokeai/frontend/webv2/src/features/generation/data/promptUtilities.test.tsnew file mode 100644index 0000000000..e28a17a460--- /dev/null+++ b/invokeai/frontend/webv2/src/features/generation/data/promptUtilities.test.ts@@ -0,0 +1,20 @@+import { describe, expectTypeOf, it } from 'vitest';++import type { ExpandPromptRequest, ExpandPromptResponse } from './promptUtilities';++describe('prompt utility transport contracts', () => {+ it('accepts an optional nullable expansion seed', () => {+ const request = {+ model_key: 'text-model',+ prompt: 'Expand this',+ seed: null,+ task_id: 'task-1',+ } satisfies ExpandPromptRequest;++ expectTypeOf(request.seed).toEqualTypeOf<null>();+ });++ it('requires the backend-selected expansion seed in responses', () => {+ expectTypeOf<ExpandPromptResponse['seed']>().toEqualTypeOf<number>();+ });+});diff --git a/invokeai/frontend/webv2/src/features/generation/data/promptUtilities.ts b/invokeai/frontend/webv2/src/features/generation/data/promptUtilities.tsindex d27559dc9d..64cef8fb89 100644--- a/invokeai/frontend/webv2/src/features/generation/data/promptUtilities.ts+++ b/invokeai/frontend/webv2/src/features/generation/data/promptUtilities.ts@@ -5,11 +5,13 @@ export interface ExpandPromptRequest {model_key: string;task_id: string;max_tokens?: number;+ seed?: number | null;system_prompt?: string | null;}export interface ExpandPromptResponse {expanded_prompt: string;+ seed: number;error?: string | null;}diff --git a/invokeai/frontend/webv2/src/features/models/core/taxonomy.test.ts b/invokeai/frontend/webv2/src/features/models/core/taxonomy.test.tsindex bde2922ed6..cf8e3aa9a2 100644--- a/invokeai/frontend/webv2/src/features/models/core/taxonomy.test.ts+++ b/invokeai/frontend/webv2/src/features/models/core/taxonomy.test.ts@@ -39,6 +39,7 @@ describe('label fallbacks', () => {expect(getModelTypeLabel('gemma2_encoder')).toBe('Gemma 2 Encoder');expect(getModelTypeLabel('pid_decoder')).toBe('PiD Decoder');expect(getModelFormatLabel('gguf_quantized')).toBe('GGUF');+ expect(getModelFormatLabel('sdnq_quantized')).toBe('SDNQ');});});diff --git a/invokeai/frontend/webv2/src/features/models/core/taxonomy.ts b/invokeai/frontend/webv2/src/features/models/core/taxonomy.tsindex 7b68878122..120131e3f6 100644--- a/invokeai/frontend/webv2/src/features/models/core/taxonomy.ts+++ b/invokeai/frontend/webv2/src/features/models/core/taxonomy.ts@@ -76,6 +76,7 @@ const FORMAT_LABELS: Record<string, string> = {onnx: 'ONNX',qwen3_encoder: 'Qwen3 Encoder',qwen_vl_encoder: 'Qwen VL Encoder',+ sdnq_quantized: 'SDNQ',t5_encoder: 'T5 Encoder',unknown: 'Unknown',};diff --git a/invokeai/frontend/webv2/src/features/models/core/types.ts b/invokeai/frontend/webv2/src/features/models/core/types.tsindex 260d8cbfe8..ded0992f27 100644--- a/invokeai/frontend/webv2/src/features/models/core/types.ts+++ b/invokeai/frontend/webv2/src/features/models/core/types.ts@@ -77,6 +77,7 @@ export type ModelFileFormat =| 'bnb_quantized_int8b'| 'bnb_quantized_nf4b'| 'gguf_quantized'+ | 'sdnq_quantized'| 'external_api'| 'unknown'| (string & {});diff --git a/invokeai/frontend/webv2/src/features/queue/core/deviceLabels.test.ts b/invokeai/frontend/webv2/src/features/queue/core/deviceLabels.test.tsindex e883bb836a..ee280c5b17 100644--- a/invokeai/frontend/webv2/src/features/queue/core/deviceLabels.test.ts+++ b/invokeai/frontend/webv2/src/features/queue/core/deviceLabels.test.ts@@ -1,6 +1,6 @@import { describe, expect, it } from 'vitest';-import { getCudaDeviceIndex, getDeviceLabel, getDeviceNameLabels } from './deviceLabels';+import { getCudaDeviceIndex, getDeviceLabel, getDeviceNameLabels, resolveRandDeviceMetadata } from './deviceLabels';describe('getCudaDeviceIndex', () => {it('parses the index from a cuda device', () => {@@ -9,6 +9,11 @@ describe('getCudaDeviceIndex', () => {expect(getCudaDeviceIndex('cuda:12')).toBe(12);});+ it('parses the index from an xpu device', () => {+ expect(getCudaDeviceIndex('xpu:0')).toBe(0);+ expect(getCudaDeviceIndex('xpu:7')).toBe(7);+ });+it('returns null for non-cuda and missing devices', () => {expect(getCudaDeviceIndex('cpu')).toBeNull();expect(getCudaDeviceIndex('mps')).toBeNull();@@ -24,6 +29,27 @@ describe('getCudaDeviceIndex', () => {});});+describe('resolveRandDeviceMetadata', () => {+ it('always reports CPU when CPU noise is enabled', () => {+ expect(resolveRandDeviceMetadata(true, [{ device: 'xpu:0', name: 'Arc' }])).toBe('cpu');+ });++ it('reports the single available accelerator family', () => {+ expect(resolveRandDeviceMetadata(false, [{ device: 'cuda:0', name: 'RTX' }])).toBe('cuda');+ expect(resolveRandDeviceMetadata(false, [{ device: 'xpu:0', name: 'Arc' }])).toBe('xpu');+ });++ it('keeps the legacy CUDA fallback when device data is missing or mixed', () => {+ expect(resolveRandDeviceMetadata(false, [])).toBe('cuda');+ expect(+ resolveRandDeviceMetadata(false, [+ { device: 'cuda:0', name: 'RTX' },+ { device: 'xpu:0', name: 'Arc' },+ ])+ ).toBe('cuda');+ });+});+describe('getDeviceNameLabels', () => {it('leaves a uniquely-named device unsuffixed', () => {expect(getDeviceNameLabels([{ device: 'cuda:0', name: 'RTX 5090' }])).toEqual({ 'cuda:0': 'RTX 5090' });diff --git a/invokeai/frontend/webv2/src/features/queue/core/deviceLabels.ts b/invokeai/frontend/webv2/src/features/queue/core/deviceLabels.tsindex be3d346875..ad84e05b2a 100644--- a/invokeai/frontend/webv2/src/features/queue/core/deviceLabels.ts+++ b/invokeai/frontend/webv2/src/features/queue/core/deviceLabels.ts@@ -1,35 +1,46 @@/**- * Labels for the GPU a queue item ran on.+ * Labels for the accelerator a queue item ran on.*- * With `generation_devices` (default `auto`) the backend runs one session per GPU+ * With `generation_devices` (default `auto`) the backend runs one session per accelerator* concurrently, and tags each queue item and progress event with the device that* processed it. These helpers turn `"cuda:1"` into something a person can read.*//** One device the backend offers for generation, from `GET /api/v1/app/generation_device_options`. */export interface GenerationDeviceOption {- /** Device identifier, e.g. `cuda:0`, `mps`, `cpu`. */+ /** Device identifier, e.g. `cuda:0`, `xpu:0`, `mps`, `cpu`. */device: string;/** Human-readable device name, e.g. `NVIDIA GeForce RTX 5090`. */name: string;}/**- * Parse the CUDA index out of a device string (`"cuda:1"` → `1`).+ * Parse the accelerator index out of a device string (`"cuda:1"` / `"xpu:1"` → `1`).*- * Returns null for a missing device or a non-CUDA one (`"cpu"`, `"mps"`), both of- * which mean there is no GPU number worth showing.+ * Returns null for a missing or unindexed device (`"cpu"`, `"mps"`).*/export const getCudaDeviceIndex = (device: string | null | undefined): number | null => {if (!device) {return null;}- const match = /^cuda:(\d+)$/.exec(device);+ const match = /^(?:cuda|xpu):(\d+)$/.exec(device);return match ? Number(match[1]) : null;};+/** Resolve descriptive random-device metadata without leaking the device store into graph compilers. */+export const resolveRandDeviceMetadata = (useCpuNoise: boolean, options: readonly GenerationDeviceOption[]): string => {+ if (useCpuNoise) {+ return 'cpu';+ }++ const types = new Set(options.map(({ device }) => device.split(':')[0]).filter((type) => type !== 'cpu'));+ const [deviceType] = types;++ return types.size === 1 && deviceType ? deviceType : 'cuda';+};+/*** Map device id → display label, disambiguating identically-named GPUs with a* 1-based `#N` suffix. A uniquely-named device gets no suffix.@@ -60,7 +71,7 @@ export const getDeviceNameLabels = (options: readonly GenerationDeviceOption[]):};export interface DeviceLabel {- /** CUDA index, for the compact badge (e.g. `0`). */+ /** Accelerator index, for the compact badge (e.g. `0`). */index: number;/** Full name with disambiguating ordinal, for the tooltip (e.g. `NVIDIA GeForce RTX 5090 #1`). */name: string;@@ -70,7 +81,7 @@ export interface DeviceLabel {* Resolve a device string to the badge + tooltip pair, or null when there is* nothing worth showing.*- * Null covers three cases: the device is not a CUDA GPU, only one GPU exists (no+ * Null covers three cases: the device is not an indexed accelerator, only one accelerator exists (no* ambiguity to resolve, so a badge would be noise), or the device is absent from* the reported options.*/diff --git a/invokeai/frontend/webv2/src/features/queue/core/types.ts b/invokeai/frontend/webv2/src/features/queue/core/types.tsindex df693acde3..b0d761742f 100644--- a/invokeai/frontend/webv2/src/features/queue/core/types.ts+++ b/invokeai/frontend/webv2/src/features/queue/core/types.ts@@ -133,7 +133,7 @@ export interface QueueItemReadModel {completedAt?: string | null;createdAt: string;destination?: string | null;- /** The GPU that processed this item, e.g. `cuda:1`. Null on non-CUDA and single-device installs. */+ /** The accelerator that processed this item, e.g. `cuda:1` or `xpu:1`. Null on unindexed and single-device installs. */device?: string | null;errorMessage?: string | null;errorTraceback?: string | null;diff --git a/invokeai/frontend/webv2/src/features/queue/data/events.ts b/invokeai/frontend/webv2/src/features/queue/data/events.tsindex a90c2167e0..9e5711d251 100644--- a/invokeai/frontend/webv2/src/features/queue/data/events.ts+++ b/invokeai/frontend/webv2/src/features/queue/data/events.ts@@ -95,9 +95,9 @@ export interface InvocationProgressEvent extends InvocationEventBase {/** Intermittent denoising preview, when the invocation produces one. */image?: { width: number; height: number; dataURL: string } | null;/**- * The GPU running this session, e.g. `cuda:1` — null on CPU/MPS and in+ * The accelerator running this session, e.g. `cuda:1` or `xpu:1` — null on CPU/MPS and in* single-device mode. With `generation_devices` set (default `auto`) several- * sessions run at once, one per GPU, so progress must be attributable.+ * sessions run at once, one per accelerator, so progress must be attributable.*/device?: string | null;}diff --git a/invokeai/frontend/webv2/src/features/queue/data/generationDevicesStore.ts b/invokeai/frontend/webv2/src/features/queue/data/generationDevicesStore.tsindex a36bdd5747..a829034f06 100644--- a/invokeai/frontend/webv2/src/features/queue/data/generationDevicesStore.ts+++ b/invokeai/frontend/webv2/src/features/queue/data/generationDevicesStore.ts@@ -10,7 +10,7 @@ import { createExternalStore } from '@platform/state/externalStore';import { apiFetchJson, getApiErrorMessage } from '@platform/transport/http';/**- * The GPUs available for generation, and which of them the server is configured to+ * The accelerators available for generation, and which of them the server is configured to* use. Pull-based like `modelCacheStore`: there are no socket events for app config.** `generation_devices` is server-wide app config (admin-only, `PATCH@@ -18,11 +18,11 @@ import { apiFetchJson, getApiErrorMessage } from '@platform/transport/http';* deliberately not treated as live state — nothing here re-reads on a timer.*/-/** `auto` uses every available GPU; an explicit list pins generation to those devices. */+/** `auto` uses every available accelerator; an explicit list pins generation to those devices. */export type GenerationDevicesSetting = 'auto' | string[];export interface GenerationDevicesSnapshot {- /** Every installed device, in CUDA-index order. Empty until loaded. */+ /** Every installed generation device, in backend order. Empty until loaded. */options: GenerationDeviceOption[];/** The configured setting, or null while unknown. */setting: GenerationDevicesSetting | null;diff --git a/invokeai/frontend/webv2/src/features/queue/data/itemProgressStore.ts b/invokeai/frontend/webv2/src/features/queue/data/itemProgressStore.tsindex 12d38be1b6..ea4d203b78 100644--- a/invokeai/frontend/webv2/src/features/queue/data/itemProgressStore.ts+++ b/invokeai/frontend/webv2/src/features/queue/data/itemProgressStore.ts@@ -19,7 +19,7 @@ export interface ItemProgress {/** 0..1, or null while indeterminate. */percentage: number | null;image?: QueueProgressImage | null;- /** The GPU running this session, e.g. `cuda:1`. Null on non-CUDA and single-device installs. */+ /** The accelerator running this session, e.g. `cuda:1` or `xpu:1`. Null on unindexed and single-device installs. */device?: string | null;}diff --git a/invokeai/frontend/webv2/src/features/queue/data/realtimeRuntime.ts b/invokeai/frontend/webv2/src/features/queue/data/realtimeRuntime.tsindex df13c956ce..0abbc11d12 100644--- a/invokeai/frontend/webv2/src/features/queue/data/realtimeRuntime.ts+++ b/invokeai/frontend/webv2/src/features/queue/data/realtimeRuntime.ts@@ -14,7 +14,7 @@ export interface QueueItemProgressPort {set(itemId: number,progress: {- /** The GPU running this session, e.g. `cuda:1`; null on non-CUDA and single-device installs. */+ /** The accelerator running this session, e.g. `cuda:1` or `xpu:1`; null on unindexed and single-device installs. */device?: string | null;image?: { dataUrl: string; height: number; width: number };message: string;diff --git a/invokeai/frontend/webv2/src/features/queue/data/serverTypes.ts b/invokeai/frontend/webv2/src/features/queue/data/serverTypes.tsindex b13a8bac14..0bec27b6ea 100644--- a/invokeai/frontend/webv2/src/features/queue/data/serverTypes.ts+++ b/invokeai/frontend/webv2/src/features/queue/data/serverTypes.ts@@ -12,7 +12,7 @@ export interface QueueServerItemDTO {completed_at?: string | null;created_at: string;destination?: string | null;- /** The GPU that processed this item, e.g. `cuda:1`. Null for pre-multi-GPU rows and non-CUDA. */+ /** The accelerator that processed this item, e.g. `cuda:1` or `xpu:1`. Null for older or unindexed rows. */device?: string | null;error_message?: string | null;error_traceback?: string | null;diff --git a/invokeai/frontend/webv2/src/features/queue/devices.ts b/invokeai/frontend/webv2/src/features/queue/devices.tsindex c23a3f365f..8315fafc2b 100644--- a/invokeai/frontend/webv2/src/features/queue/devices.ts+++ b/invokeai/frontend/webv2/src/features/queue/devices.ts@@ -9,12 +9,14 @@export {getDeviceLabel,getDeviceNameLabels,+ resolveRandDeviceMetadata,type DeviceLabel,type GenerationDeviceOption,} from './core/deviceLabels';export {type GenerationDevicesSetting,type GenerationDevicesSnapshot,+ getGenerationDevicesSnapshot,refreshGenerationDevices,updateGenerationDevices,useGenerationDevices,diff --git a/invokeai/frontend/webv2/src/features/upscale/core/graph.test.ts b/invokeai/frontend/webv2/src/features/upscale/core/graph.test.tsindex b588604cb1..317801eb7d 100644--- a/invokeai/frontend/webv2/src/features/upscale/core/graph.test.ts+++ b/invokeai/frontend/webv2/src/features/upscale/core/graph.test.ts@@ -114,4 +114,10 @@ describe('compileUpscaleGraph', () => {compileUpscaleGraph(createValues('sd-1'), 'canvas', { useCpuNoise: false }).backendGraph.nodes.upscale_output).toMatchObject({ is_intermediate: true, use_cache: false });});++ it('records the accelerator supplied by the orchestration boundary in metadata', () => {+ const graph = compileUpscaleGraph(createValues('sd-1'), 'gallery', { useCpuNoise: false }, 'xpu').backendGraph;++ expect(graph.nodes.core_metadata?.rand_device).toBe('xpu');+ });});diff --git a/invokeai/frontend/webv2/src/features/upscale/core/graph.ts b/invokeai/frontend/webv2/src/features/upscale/core/graph.tsindex 4b1d02fc33..79c56abc97 100644--- a/invokeai/frontend/webv2/src/features/upscale/core/graph.ts+++ b/invokeai/frontend/webv2/src/features/upscale/core/graph.ts@@ -42,7 +42,8 @@ const addUpscaleMetadata = (graph: BackendGraphContract,output: BackendInvocationContract,settings: UpscaleWidgetValues,- projectSettings: GenerationProjectSettings+ projectSettings: GenerationProjectSettings,+ randDevice: string): void => {if (!settings.model || !settings.upscaleModel || !settings.inputImage) {return;@@ -57,7 +58,7 @@ const addUpscaleMetadata = (id: 'core_metadata',loras: activeLoras.map((lora) => ({ model: toModelIdentifier(lora.model), weight: lora.weight })),model: toModelIdentifier(settings.model),- rand_device: projectSettings.useCpuNoise ? 'cpu' : 'cuda',+ rand_device: randDevice,scheduler: coerceSchedulerForGraph(settings.model, settings.scheduler),steps: settings.steps,structure: settings.structure,@@ -85,7 +86,8 @@ const addUpscaleMetadata = (export const compileUpscaleGraph = (settings: UpscaleWidgetValues,destination: ResultDestination,- projectSettings: GenerationProjectSettings+ projectSettings: GenerationProjectSettings,+ randDevice = projectSettings.useCpuNoise ? 'cpu' : 'cuda'): CompiledUpscaleGraph => {const reasons = getUpscaleValidationReasons(settings);@@ -239,7 +241,7 @@ export const compileUpscaleGraph = (addEdge(graph, controlNet1, 'control', controlNetCollector, 'item');addEdge(graph, controlNet2, 'control', controlNetCollector, 'item');addEdge(graph, controlNetCollector, 'collection', denoise, 'control');- addUpscaleMetadata(graph, output, settings, projectSettings);+ addUpscaleMetadata(graph, output, settings, projectSettings, randDevice);return {backendGraph: graph,diff --git a/invokeai/frontend/webv2/src/workbench/settings/GenerationDevicesSettings.browser.test.tsx b/invokeai/frontend/webv2/src/workbench/settings/GenerationDevicesSettings.browser.test.tsxindex 92d60daa9e..1ae64d82c2 100644--- a/invokeai/frontend/webv2/src/workbench/settings/GenerationDevicesSettings.browser.test.tsx+++ b/invokeai/frontend/webv2/src/workbench/settings/GenerationDevicesSettings.browser.test.tsx@@ -76,26 +76,26 @@ afterEach(async () => {});describe('GenerationDevicesSettings', () => {- it('explains that parallel generation needs more than one GPU on a single-GPU box', async () => {+ it('explains that parallel generation needs more than one accelerator on a single-device box', async () => {await render({ options: [{ device: 'cuda:0', name: 'RTX 5090' }] });// This machine's real configuration: one GPU, `auto`. No switches should appear,// because there is nothing to choose between.expect(host?.textContent).toContain('RTX 5090');- expect(host?.textContent).toContain('needs more than one GPU');+ expect(host?.textContent).toContain('needs more than one accelerator');expect(host?.querySelectorAll('input[type="checkbox"]')).toHaveLength(0);});- it('says so when no CUDA GPU is present', async () => {+ it('says so when no accelerator is present', async () => {await render({ options: [] });- expect(host?.textContent).toContain('No CUDA GPUs were detected');+ expect(host?.textContent).toContain('No accelerators were detected');});it('offers the auto switch with two GPUs and hides per-device switches while auto is on', async () => {await render({ options: TWO_GPUS, setting: 'auto' });- expect(host?.textContent).toContain('Use every available GPU');+ expect(host?.textContent).toContain('Use every available accelerator');// Auto only shows its own switch; the per-device list stays collapsed.expect(host?.querySelectorAll('input[type="checkbox"]')).toHaveLength(1);});@@ -137,7 +137,7 @@ describe('GenerationDevicesSettings', () => {await userEvent.click(switchControls()[2]!);expect(mocks.updateGenerationDevices).not.toHaveBeenCalled();- expect(host?.textContent).toContain('Select at least one GPU.');+ expect(host?.textContent).toContain('Select at least one generation device.');});it('shows a read-only summary to a non-admin', async () => {@@ -145,7 +145,7 @@ describe('GenerationDevicesSettings', () => {await render({ options: TWO_GPUS, setting: ['cuda:1'] });expect(host?.textContent).toContain('RTX 4090');- expect(host?.textContent).toContain('Only an administrator can change which GPUs are used.');+ expect(host?.textContent).toContain('Only an administrator can change which accelerators are used.');expect(host?.querySelectorAll('input[type="checkbox"]')).toHaveLength(0);});diff --git a/invokeai/frontend/webv2/src/workbench/settings/GenerationDevicesSettings.tsx b/invokeai/frontend/webv2/src/workbench/settings/GenerationDevicesSettings.tsxindex 1331c6d218..10ee31fb0a 100644--- a/invokeai/frontend/webv2/src/workbench/settings/GenerationDevicesSettings.tsx+++ b/invokeai/frontend/webv2/src/workbench/settings/GenerationDevicesSettings.tsx@@ -12,7 +12,7 @@ import { useMountEffect } from '@platform/react/useMountEffect';import { useCallback, useMemo, useState } from 'react';/**- * Which GPUs the server uses for generation (`generation_devices`).+ * Which accelerators the server uses for generation (`generation_devices`).** Server-wide app config rather than a user preference, so it is admin-only and only* takes effect after a restart — both of which the copy states plainly instead of@@ -48,7 +48,7 @@ export const GenerationDevicesSettings = () => {const toggleAuto = useCallback((checked: boolean) => {// Leaving auto starts from the devices in effect right now, so turning the- // switch off is not itself a change in which GPUs are used.+ // switch off is not itself a change in which accelerators are used.void save(checked ? 'auto' : selectedDevices);},[save, selectedDevices]@@ -65,7 +65,7 @@ export const GenerationDevicesSettings = () => {// The backend rejects an empty list, and a config with no devices would fail on// the next startup — so refuse locally rather than surfacing a 422.if (next.length === 0) {- setSaveError('Select at least one GPU.');+ setSaveError('Select at least one generation device.');return;}@@ -90,8 +90,8 @@ export const GenerationDevicesSettings = () => {return (<Text color="fg.subtle" fontSize="xs">{options.length === 1- ? `Generation runs on ${labels[options[0].device] ?? options[0].device}. Parallel generation needs more than one GPU.`- : 'No CUDA GPUs were detected, so generation runs on a single device.'}+ ? `Generation runs on ${labels[options[0].device] ?? options[0].device}. Parallel generation needs more than one accelerator.`+ : 'No accelerators were detected, so generation runs on a single device.'}</Text>);}@@ -101,11 +101,11 @@ export const GenerationDevicesSettings = () => {<Stack gap="1"><Text color="fg" fontSize="xs">{isAuto- ? 'Every available GPU is used for generation.'+ ? 'Every available accelerator is used for generation.': selectedDevices.map((device) => labels[device] ?? device).join(', ')}</Text><Text color="fg.subtle" fontSize="xs">- Only an administrator can change which GPUs are used.+ Only an administrator can change which accelerators are used.</Text></Stack>);@@ -115,8 +115,8 @@ export const GenerationDevicesSettings = () => {<Stack gap="3"><DeviceSwitchchecked={isAuto}- description="New GPUs are picked up automatically."- label="Use every available GPU"+ description="New accelerators are picked up automatically."+ label="Use every available accelerator"onChange={toggleAuto}/>{isAuto ? null : (diff --git a/invokeai/frontend/webv2/src/workbench/settings/SettingsDialog.tsx b/invokeai/frontend/webv2/src/workbench/settings/SettingsDialog.tsxindex 3844e14adb..9d1f1bd9b1 100644--- a/invokeai/frontend/webv2/src/workbench/settings/SettingsDialog.tsx+++ b/invokeai/frontend/webv2/src/workbench/settings/SettingsDialog.tsx@@ -587,7 +587,7 @@ const QueueSection = () => {/></SettingsSection><SettingsSection- description="GPUs used for generation. With more than one selected, InvokeAI runs a session on each at the same time. This is a server-wide setting."+ description="Accelerators used for generation. With more than one selected, InvokeAI runs a session on each at the same time. This is a server-wide setting."title="Generation Devices"><GenerationDevicesSettings />diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/invoke/prepareCanvasInvocation.ts b/invokeai/frontend/webv2/src/workbench/widgets/canvas/invoke/prepareCanvasInvocation.tsindex 819b0166c5..c51b099bb7 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/invoke/prepareCanvasInvocation.ts+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/invoke/prepareCanvasInvocation.ts@@ -57,6 +57,7 @@ import {resolveGenerateSeed,} from '@features/generation/graph';import { normalizeGenerateWidgetValues, syncGenerateWidgetValuesWithModels } from '@features/generation/settings';+import { getGenerationDevicesSnapshot, resolveRandDeviceMetadata } from '@features/queue/devices';import {captureAccountScope,isAccountScopeCurrent,@@ -114,6 +115,8 @@ export interface RunCanvasInvocationDeps {models?: readonly ModelConfig[];/** Project settings (only `useCpuNoise` is consulted by the compiler). */projectSettings: Pick<ProjectSettings, 'useCpuNoise'>;+ /** Runtime-derived accelerator family recorded in generation metadata. */+ randDevice?: string;/** Persisted denoising strength (already defaulted + clamped). Used for every image mode. */strength: number;/** Persisted compositing settings (infill / coherence / mask blur), defaulted + clamped. */@@ -387,6 +390,7 @@ export const runCanvasInvocation = async (deps: RunCanvasInvocationDeps): Promismodel,noiseMaskImageName: composites.noiseMaskImageName,projectSettings: deps.projectSettings,+ randDevice: deps.randDevice,regionalGuidance: regions.toGraphInputs(composites.regionalMaskImages),settings,strength: deps.strength,@@ -489,6 +493,7 @@ export const prepareCanvasInvocation = async (args: PrepareCanvasInvocationArgs)models: args.models,projectId: args.projectId,projectSettings: args.projectSettings,+ randDevice: resolveRandDeviceMetadata(args.projectSettings.useCpuNoise, getGenerationDevicesSnapshot().options),signal,strength: args.strength,});diff --git a/invokeai/frontend/webv2/src/workbench/workbenchState.ts b/invokeai/frontend/webv2/src/workbench/workbenchState.tsindex acb43c5a2d..24396c24f8 100644--- a/invokeai/frontend/webv2/src/workbench/workbenchState.ts+++ b/invokeai/frontend/webv2/src/workbench/workbenchState.ts@@ -103,6 +103,7 @@ import {sanitizeBatchCount,syncGenerateWidgetValuesWithModels,} from '@features/generation/settings';+import { getGenerationDevicesSnapshot, resolveRandDeviceMetadata } from '@features/queue/devices';import {clearDeletedUpscaleInput,cloneUpscaleWidgetValues,@@ -2233,6 +2234,7 @@ const compileInvocationSnapshot = (models?: readonly ModelConfig[]): { graph: GraphContract; widgetStates: WidgetStateMap } | null => {const widgetStates = getWidgetStatesSnapshot(project.widgetInstances);+ const randDevice = resolveRandDeviceMetadata(project.settings.useCpuNoise, getGenerationDevicesSnapshot().options);if (route.sourceId === 'workflow') {// Compiles the workflow document into an immutable snapshot. Templates are@@ -2264,7 +2266,7 @@ const compileInvocationSnapshot = (}const resolvedValues: UpscaleWidgetValues = { ...currentValues, seed: resolveUpscaleSeed(currentValues) };- const compiledGraph = compileUpscaleGraph(resolvedValues, route.destination, project.settings).graph;+ const compiledGraph = compileUpscaleGraph(resolvedValues, route.destination, project.settings, randDevice).graph;widgetStates.upscale = {...widgetStates.upscale,@@ -2304,7 +2306,8 @@ const compileInvocationSnapshot = (resolvedSettings,resolvedSettings.model,route.destination,- project.settings+ project.settings,+ randDevice).graph;widgetStates.generate = {