mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(nodes): update LoRAMetadataItem model
LoRA model now at under `model` not `lora.
This commit is contained in:
parent
a253047d8e
commit
80697a71de
@ -33,7 +33,7 @@ class MetadataItemField(BaseModel):
|
||||
class LoRAMetadataField(BaseModel):
|
||||
"""LoRA Metadata Field"""
|
||||
|
||||
lora: LoRAModelField = Field(description=FieldDescriptions.lora_model)
|
||||
model: LoRAModelField = Field(description=FieldDescriptions.lora_model)
|
||||
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):
|
||||
"""Collects core generation metadata into a MetadataField"""
|
||||
|
||||
|
@ -26,45 +26,3 @@ export type ModelMetadataItem = z.infer<typeof zModelMetadataItem>;
|
||||
export type VAEModelMetadataItem = z.infer<typeof zVAEModelMetadataItem>;
|
||||
// #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
|
||||
|
@ -53,7 +53,7 @@ export const addLoRAsToGraph = (
|
||||
};
|
||||
|
||||
loraMetadata.push({
|
||||
lora: { key },
|
||||
model: { key },
|
||||
weight,
|
||||
});
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
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 type { NonNullableGraph, SDXLLoraLoaderInvocation } from 'services/api/types';
|
||||
import type { CoreMetadataInvocation, NonNullableGraph, SDXLLoraLoaderInvocation } from 'services/api/types';
|
||||
|
||||
import {
|
||||
LORA_LOADER,
|
||||
@ -36,7 +34,7 @@ export const addSDXLLoRAsToGraph = (
|
||||
return;
|
||||
}
|
||||
|
||||
const loraMetadata: LoRAMetadataItem[] = [];
|
||||
const loraMetadata: CoreMetadataInvocation['loras'] = [];
|
||||
|
||||
// Handle Seamless Plugs
|
||||
const unetLoaderId = modelLoaderNodeId;
|
||||
@ -70,12 +68,7 @@ export const addSDXLLoRAsToGraph = (
|
||||
weight,
|
||||
};
|
||||
|
||||
loraMetadata.push(
|
||||
zLoRAMetadataItem.parse({
|
||||
lora: { key },
|
||||
weight,
|
||||
})
|
||||
);
|
||||
loraMetadata.push({ model: { key }, weight });
|
||||
|
||||
// add to graph
|
||||
graph.nodes[currentLoraNodeId] = loraLoaderNode;
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user