Skip to content

Commit 4beccea

Browse files
psychedelicioushipsterusername
authored andcommitted
fix(ui): do not run HRO if using an initial image
1 parent 68d1458 commit 4beccea

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

invokeai/frontend/web/src/features/nodes/util/graph/addInitialImageToLinearGraph.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@ import { assert } from 'tsafe';
66

77
import { IMAGE_TO_LATENTS, NOISE, RESIZE } from './constants';
88

9+
/**
10+
* Returns true if an initial image was added, false if not.
11+
*/
912
export const addInitialImageToLinearGraph = (
1013
state: RootState,
1114
graph: NonNullableGraph,
1215
denoiseNodeId: string
13-
): void => {
16+
): boolean => {
1417
// Remove Existing UNet Connections
1518
const { img2imgStrength, vaePrecision, model } = state.generation;
1619
const { refinerModel, refinerStart } = state.sdxl;
@@ -19,7 +22,7 @@ export const addInitialImageToLinearGraph = (
1922
const initialImage = initialImageLayer?.isEnabled ? initialImageLayer?.image : null;
2023

2124
if (!initialImage) {
22-
return;
25+
return false;
2326
}
2427

2528
const isSDXL = model?.base === 'sdxl';
@@ -122,4 +125,6 @@ export const addInitialImageToLinearGraph = (
122125
strength: img2imgStrength,
123126
init_image: initialImage.imageName,
124127
});
128+
129+
return true;
125130
};

invokeai/frontend/web/src/features/nodes/util/graph/buildGenerationTabGraph.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ export const buildGenerationTabGraph = async (state: RootState): Promise<NonNull
232232
LATENTS_TO_IMAGE
233233
);
234234

235-
addInitialImageToLinearGraph(state, graph, DENOISE_LATENTS);
235+
const didAddInitialImage = addInitialImageToLinearGraph(state, graph, DENOISE_LATENTS);
236236

237237
// Add Seamless To Graph
238238
if (seamlessXAxis || seamlessYAxis) {
@@ -249,7 +249,7 @@ export const buildGenerationTabGraph = async (state: RootState): Promise<NonNull
249249
await addControlLayersToGraph(state, graph, DENOISE_LATENTS);
250250

251251
// High resolution fix.
252-
if (state.hrf.hrfEnabled) {
252+
if (state.hrf.hrfEnabled && !didAddInitialImage) {
253253
addHrfToGraph(state, graph);
254254
}
255255

0 commit comments

Comments
 (0)