feat(nodes): update LoRAMetadataItem model

LoRA model now at under `model` not `lora.
This commit is contained in:
psychedelicious 2024-02-26 22:25:22 +11:00
parent a253047d8e
commit 80697a71de
5 changed files with 9 additions and 58 deletions

View File

@ -33,7 +33,7 @@ class MetadataItemField(BaseModel):
class LoRAMetadataField(BaseModel): class LoRAMetadataField(BaseModel):
"""LoRA Metadata Field""" """LoRA Metadata Field"""
lora: LoRAModelField = Field(description=FieldDescriptions.lora_model) model: LoRAModelField = Field(description=FieldDescriptions.lora_model)
weight: float = Field(description=FieldDescriptions.lora_weight) weight: float = Field(description=FieldDescriptions.lora_weight)
@ -114,7 +114,7 @@ GENERATION_MODES = Literal[
] ]
@invocation("core_metadata", title="Core Metadata", tags=["metadata"], category="metadata", version="1.0.1") @invocation("core_metadata", title="Core Metadata", tags=["metadata"], category="metadata", version="1.1.1")
class CoreMetadataInvocation(BaseInvocation): class CoreMetadataInvocation(BaseInvocation):
"""Collects core generation metadata into a MetadataField""" """Collects core generation metadata into a MetadataField"""

View File

@ -26,45 +26,3 @@ export type ModelMetadataItem = z.infer<typeof zModelMetadataItem>;
export type VAEModelMetadataItem = z.infer<typeof zVAEModelMetadataItem>; export type VAEModelMetadataItem = z.infer<typeof zVAEModelMetadataItem>;
// #endregion // #endregion
// #region CoreMetadata
export const zCoreMetadata = z
.object({
app_version: z.string().nullish().catch(null),
generation_mode: z.string().nullish().catch(null),
created_by: z.string().nullish().catch(null),
positive_prompt: z.string().nullish().catch(null),
negative_prompt: z.string().nullish().catch(null),
width: z.number().int().nullish().catch(null),
height: z.number().int().nullish().catch(null),
seed: z.number().int().nullish().catch(null),
rand_device: z.string().nullish().catch(null),
cfg_scale: z.number().nullish().catch(null),
cfg_rescale_multiplier: z.number().nullish().catch(null),
steps: z.number().int().nullish().catch(null),
scheduler: z.string().nullish().catch(null),
clip_skip: z.number().int().nullish().catch(null),
model: zModelMetadataItem.nullish().catch(null),
controlnets: z.array(zControlNetMetadataItem).nullish().catch(null),
ipAdapters: z.array(zIPAdapterMetadataItem).nullish().catch(null),
t2iAdapters: z.array(zT2IAdapterMetadataItem).nullish().catch(null),
loras: z.array(zLoRAMetadataItem).nullish().catch(null),
vae: zVAEModelMetadataItem.nullish().catch(null),
strength: z.number().nullish().catch(null),
hrf_enabled: z.boolean().nullish().catch(null),
hrf_strength: z.number().nullish().catch(null),
hrf_method: z.string().nullish().catch(null),
init_image: z.string().nullish().catch(null),
positive_style_prompt: z.string().nullish().catch(null),
negative_style_prompt: z.string().nullish().catch(null),
refiner_model: zSDXLRefinerModelMetadataItem.nullish().catch(null),
refiner_cfg_scale: z.number().nullish().catch(null),
refiner_steps: z.number().int().nullish().catch(null),
refiner_scheduler: z.string().nullish().catch(null),
refiner_positive_aesthetic_score: z.number().nullish().catch(null),
refiner_negative_aesthetic_score: z.number().nullish().catch(null),
refiner_start: z.number().nullish().catch(null),
})
.passthrough();
export type CoreMetadata = z.infer<typeof zCoreMetadata>;
// #endregion

View File

@ -53,7 +53,7 @@ export const addLoRAsToGraph = (
}; };
loraMetadata.push({ loraMetadata.push({
lora: { key }, model: { key },
weight, weight,
}); });

View File

@ -1,8 +1,6 @@
import type { RootState } from 'app/store/store'; import type { RootState } from 'app/store/store';
import type { LoRAMetadataItem } from 'features/nodes/types/metadata';
import { zLoRAMetadataItem } from 'features/nodes/types/metadata';
import { filter, size } from 'lodash-es'; import { filter, size } from 'lodash-es';
import type { NonNullableGraph, SDXLLoraLoaderInvocation } from 'services/api/types'; import type { CoreMetadataInvocation, NonNullableGraph, SDXLLoraLoaderInvocation } from 'services/api/types';
import { import {
LORA_LOADER, LORA_LOADER,
@ -36,7 +34,7 @@ export const addSDXLLoRAsToGraph = (
return; return;
} }
const loraMetadata: LoRAMetadataItem[] = []; const loraMetadata: CoreMetadataInvocation['loras'] = [];
// Handle Seamless Plugs // Handle Seamless Plugs
const unetLoaderId = modelLoaderNodeId; const unetLoaderId = modelLoaderNodeId;
@ -70,12 +68,7 @@ export const addSDXLLoRAsToGraph = (
weight, weight,
}; };
loraMetadata.push( loraMetadata.push({ model: { key }, weight });
zLoRAMetadataItem.parse({
lora: { key },
weight,
})
);
// add to graph // add to graph
graph.nodes[currentLoraNodeId] = loraLoaderNode; graph.nodes[currentLoraNodeId] = loraLoaderNode;

File diff suppressed because one or more lines are too long