feat(ui): add cpu noise to linear graphs

This commit is contained in:
psychedelicious 2023-07-08 14:52:19 +10:00
parent 0138f52220
commit a73206c105
4 changed files with 32 additions and 6 deletions

View File

@ -1,6 +1,7 @@
import { log } from 'app/logging/useLogger'; import { log } from 'app/logging/useLogger';
import { RootState } from 'app/store/store'; import { RootState } from 'app/store/store';
import { NonNullableGraph } from 'features/nodes/types/types'; import { NonNullableGraph } from 'features/nodes/types/types';
import { initialGenerationState } from 'features/parameters/store/generationSlice';
import { import {
ImageDTO, ImageDTO,
ImageResizeInvocation, ImageResizeInvocation,
@ -42,9 +43,8 @@ export const buildCanvasImageToImageGraph = (
steps, steps,
img2imgStrength: strength, img2imgStrength: strength,
clipSkip, clipSkip,
iterations, shouldUseCpuNoise,
seed, shouldUseNoiseSettings,
shouldRandomizeSeed,
} = state.generation; } = state.generation;
// The bounding box determines width and height, not the width and height params // The bounding box determines width and height, not the width and height params
@ -52,6 +52,10 @@ export const buildCanvasImageToImageGraph = (
const model = modelIdToMainModelField(currentModel?.id || ''); const model = modelIdToMainModelField(currentModel?.id || '');
const use_cpu = shouldUseNoiseSettings
? shouldUseCpuNoise
: initialGenerationState.shouldUseCpuNoise;
/** /**
* The easiest way to build linear graphs is to do it in the node editor, then copy and paste the * The easiest way to build linear graphs is to do it in the node editor, then copy and paste the
* full graph here as a template. Then use the parameters from app state and set friendlier node * full graph here as a template. Then use the parameters from app state and set friendlier node
@ -78,6 +82,7 @@ export const buildCanvasImageToImageGraph = (
[NOISE]: { [NOISE]: {
type: 'noise', type: 'noise',
id: NOISE, id: NOISE,
use_cpu,
}, },
[MAIN_MODEL_LOADER]: { [MAIN_MODEL_LOADER]: {
type: 'main_model_loader', type: 'main_model_loader',

View File

@ -1,5 +1,6 @@
import { RootState } from 'app/store/store'; import { RootState } from 'app/store/store';
import { NonNullableGraph } from 'features/nodes/types/types'; import { NonNullableGraph } from 'features/nodes/types/types';
import { initialGenerationState } from 'features/parameters/store/generationSlice';
import { addControlNetToLinearGraph } from '../addControlNetToLinearGraph'; import { addControlNetToLinearGraph } from '../addControlNetToLinearGraph';
import { modelIdToMainModelField } from '../modelIdToMainModelField'; import { modelIdToMainModelField } from '../modelIdToMainModelField';
import { addDynamicPromptsToGraph } from './addDynamicPromptsToGraph'; import { addDynamicPromptsToGraph } from './addDynamicPromptsToGraph';
@ -30,9 +31,8 @@ export const buildCanvasTextToImageGraph = (
scheduler, scheduler,
steps, steps,
clipSkip, clipSkip,
iterations, shouldUseCpuNoise,
seed, shouldUseNoiseSettings,
shouldRandomizeSeed,
} = state.generation; } = state.generation;
// The bounding box determines width and height, not the width and height params // The bounding box determines width and height, not the width and height params
@ -40,6 +40,10 @@ export const buildCanvasTextToImageGraph = (
const model = modelIdToMainModelField(currentModel?.id || ''); const model = modelIdToMainModelField(currentModel?.id || '');
const use_cpu = shouldUseNoiseSettings
? shouldUseCpuNoise
: initialGenerationState.shouldUseCpuNoise;
/** /**
* The easiest way to build linear graphs is to do it in the node editor, then copy and paste the * The easiest way to build linear graphs is to do it in the node editor, then copy and paste the
* full graph here as a template. Then use the parameters from app state and set friendlier node * full graph here as a template. Then use the parameters from app state and set friendlier node
@ -68,6 +72,7 @@ export const buildCanvasTextToImageGraph = (
id: NOISE, id: NOISE,
width, width,
height, height,
use_cpu,
}, },
[TEXT_TO_LATENTS]: { [TEXT_TO_LATENTS]: {
type: 't2l', type: 't2l',

View File

@ -1,6 +1,7 @@
import { log } from 'app/logging/useLogger'; import { log } from 'app/logging/useLogger';
import { RootState } from 'app/store/store'; import { RootState } from 'app/store/store';
import { NonNullableGraph } from 'features/nodes/types/types'; import { NonNullableGraph } from 'features/nodes/types/types';
import { initialGenerationState } from 'features/parameters/store/generationSlice';
import { import {
ImageCollectionInvocation, ImageCollectionInvocation,
ImageResizeInvocation, ImageResizeInvocation,
@ -48,6 +49,8 @@ export const buildLinearImageToImageGraph = (
width, width,
height, height,
clipSkip, clipSkip,
shouldUseCpuNoise,
shouldUseNoiseSettings,
} = state.generation; } = state.generation;
const { const {
@ -75,6 +78,10 @@ export const buildLinearImageToImageGraph = (
const model = modelIdToMainModelField(currentModel?.id || ''); const model = modelIdToMainModelField(currentModel?.id || '');
const use_cpu = shouldUseNoiseSettings
? shouldUseCpuNoise
: initialGenerationState.shouldUseCpuNoise;
// copy-pasted graph from node editor, filled in with state values & friendly node ids // copy-pasted graph from node editor, filled in with state values & friendly node ids
const graph: NonNullableGraph = { const graph: NonNullableGraph = {
id: IMAGE_TO_IMAGE_GRAPH, id: IMAGE_TO_IMAGE_GRAPH,
@ -102,6 +109,7 @@ export const buildLinearImageToImageGraph = (
[NOISE]: { [NOISE]: {
type: 'noise', type: 'noise',
id: NOISE, id: NOISE,
use_cpu,
}, },
[LATENTS_TO_IMAGE]: { [LATENTS_TO_IMAGE]: {
type: 'l2i', type: 'l2i',

View File

@ -1,5 +1,6 @@
import { RootState } from 'app/store/store'; import { RootState } from 'app/store/store';
import { NonNullableGraph } from 'features/nodes/types/types'; import { NonNullableGraph } from 'features/nodes/types/types';
import { initialGenerationState } from 'features/parameters/store/generationSlice';
import { addControlNetToLinearGraph } from '../addControlNetToLinearGraph'; import { addControlNetToLinearGraph } from '../addControlNetToLinearGraph';
import { modelIdToMainModelField } from '../modelIdToMainModelField'; import { modelIdToMainModelField } from '../modelIdToMainModelField';
import { addDynamicPromptsToGraph } from './addDynamicPromptsToGraph'; import { addDynamicPromptsToGraph } from './addDynamicPromptsToGraph';
@ -29,10 +30,16 @@ export const buildLinearTextToImageGraph = (
width, width,
height, height,
clipSkip, clipSkip,
shouldUseCpuNoise,
shouldUseNoiseSettings,
} = state.generation; } = state.generation;
const model = modelIdToMainModelField(currentModel?.id || ''); const model = modelIdToMainModelField(currentModel?.id || '');
const use_cpu = shouldUseNoiseSettings
? shouldUseCpuNoise
: initialGenerationState.shouldUseCpuNoise;
/** /**
* The easiest way to build linear graphs is to do it in the node editor, then copy and paste the * The easiest way to build linear graphs is to do it in the node editor, then copy and paste the
* full graph here as a template. Then use the parameters from app state and set friendlier node * full graph here as a template. Then use the parameters from app state and set friendlier node
@ -71,6 +78,7 @@ export const buildLinearTextToImageGraph = (
id: NOISE, id: NOISE,
width, width,
height, height,
use_cpu,
}, },
[TEXT_TO_LATENTS]: { [TEXT_TO_LATENTS]: {
type: 't2l', type: 't2l',