mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-04-23 03:00:31 -04:00
CLIP Skip zod schema created
This commit is contained in:
committed by
psychedelicious
parent
8329533848
commit
6e32c7993c
@@ -4,6 +4,8 @@ import { buildZodTypeGuard } from 'common/util/zodUtils';
|
||||
import { zModelIdentifierField, zSchedulerField } from 'features/nodes/types/common';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { CLIP_SKIP_MAP } from './constants';
|
||||
|
||||
/**
|
||||
* Schemas, types and type guards for parameters.
|
||||
*
|
||||
@@ -193,3 +195,21 @@ export type ParameterCanvasCoherenceMode = z.infer<typeof zParameterCanvasCohere
|
||||
export const [zLoRAWeight, isParameterLoRAWeight] = buildParameter(z.number());
|
||||
export type ParameterLoRAWeight = z.infer<typeof zLoRAWeight>;
|
||||
// #endregion
|
||||
|
||||
// #region Max. CLIP
|
||||
export const [zParameterMaxCLIP, isParameterMaxCLIP] = buildParameter(
|
||||
z.union([
|
||||
z.discriminatedUnion('model', [
|
||||
z.object({ model: z.literal('sd-1'), maxClip: z.number().min(0).max(CLIP_SKIP_MAP['sd-1'].maxClip) }),
|
||||
z.object({ model: z.literal('sd-2'), maxClip: z.number().min(0).max(CLIP_SKIP_MAP['sd-2'].maxClip) }),
|
||||
z.object({ model: z.literal('sdxl'), maxClip: z.number().min(0).max(CLIP_SKIP_MAP['sdxl'].maxClip) }),
|
||||
z.object({
|
||||
model: z.literal('sdxl-refiner'),
|
||||
maxClip: z.number().min(0).max(CLIP_SKIP_MAP['sdxl-refiner'].maxClip),
|
||||
}),
|
||||
]),
|
||||
z.object({ model: z.string(), maxClip: z.number().min(0).max(0) }),
|
||||
])
|
||||
);
|
||||
export type ParameterMaxCLIP = z.infer<typeof zParameterMaxCLIP>;
|
||||
// #endregion
|
||||
|
||||
Reference in New Issue
Block a user