diff --git a/invokeai/frontend/web/src/features/controlAdapters/store/controlAdaptersSlice.ts b/invokeai/frontend/web/src/features/controlAdapters/store/controlAdaptersSlice.ts index 8cbd9978ae..a3645fad9d 100644 --- a/invokeai/frontend/web/src/features/controlAdapters/store/controlAdaptersSlice.ts +++ b/invokeai/frontend/web/src/features/controlAdapters/store/controlAdaptersSlice.ts @@ -3,6 +3,7 @@ import { Update, createEntityAdapter, createSlice, + isAnyOf, } from '@reduxjs/toolkit'; import { ControlNetModelParam, @@ -544,3 +545,9 @@ export const { } = controlAdaptersSlice.actions; export default controlAdaptersSlice.reducer; + +export const isAnyControlAdapterAdded = isAnyOf( + controlAdapterAdded, + controlAdapterAddedFromImage, + controlAdapterRecalled +); diff --git a/invokeai/frontend/web/src/features/parameters/store/generationSlice.ts b/invokeai/frontend/web/src/features/parameters/store/generationSlice.ts index ea6aaf28ca..84d26b6476 100644 --- a/invokeai/frontend/web/src/features/parameters/store/generationSlice.ts +++ b/invokeai/frontend/web/src/features/parameters/store/generationSlice.ts @@ -5,6 +5,7 @@ import { configChanged } from 'features/system/store/configSlice'; import { clamp } from 'lodash-es'; import { ImageDTO } from 'services/api/types'; +import { isAnyControlAdapterAdded } from 'features/controlAdapters/store/controlAdaptersSlice'; import { clipSkipMap } from '../types/constants'; import { CanvasCoherenceModeParam, @@ -302,6 +303,15 @@ export const generationSlice = createSlice({ } } }); + + // TODO: This is a temp fix to reduce issues with T2I adapter having a different downscaling + // factor than the UNet. Hopefully we get an upstream fix in diffusers. + builder.addMatcher(isAnyControlAdapterAdded, (state, action) => { + if (action.payload.type === 't2i_adapter') { + state.width = roundToMultiple(state.width, 64); + state.height = roundToMultiple(state.height, 64); + } + }); }, });