mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix: Clamp clipskip value when model changes
This commit is contained in:
parent
a4dec53b4d
commit
53cb200f85
@ -5,7 +5,7 @@ import { setClipSkip } from 'features/parameters/store/generationSlice';
|
||||
import { useCallback } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
const clipSkipMap = {
|
||||
export const clipSkipMap = {
|
||||
'sd-1': {
|
||||
maxClip: 12,
|
||||
markers: [0, 1, 2, 3, 4, 8, 12],
|
||||
|
@ -5,6 +5,7 @@ import { configChanged } from 'features/system/store/configSlice';
|
||||
import { setShouldShowAdvancedOptions } from 'features/ui/store/uiSlice';
|
||||
import { clamp } from 'lodash-es';
|
||||
import { ImageDTO } from 'services/api/types';
|
||||
import { clipSkipMap } from '../components/Parameters/Advanced/ParamClipSkip';
|
||||
import {
|
||||
CfgScaleParam,
|
||||
HeightParam,
|
||||
@ -216,6 +217,12 @@ export const generationSlice = createSlice({
|
||||
},
|
||||
modelSelected: (state, action: PayloadAction<string>) => {
|
||||
state.model = action.payload;
|
||||
|
||||
// Clamp ClipSkip Based On Selected Model
|
||||
const clipSkipMax =
|
||||
clipSkipMap[action.payload.split('/')[0] as keyof typeof clipSkipMap]
|
||||
.maxClip;
|
||||
state.clipSkip = clamp(state.clipSkip, 0, clipSkipMax);
|
||||
},
|
||||
vaeSelected: (state, action: PayloadAction<string>) => {
|
||||
state.vae = action.payload;
|
||||
|
Loading…
Reference in New Issue
Block a user