Skip to content

AI media harness for planning, generating, and editing locally

TypeScript

Prevent Krea from inheriting H3 adapters

Bittif4272683cc0b
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index b941166..7cacd95 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -42,6 +42,7 @@ Changes since 0.3.2.
## Fixes and improvements
+- Krea 2 and other generators without LoRA support no longer inherit adapters from the default generator when their own adapter list is omitted.
- Single Shot without Context video applies Tone once across the assembled main clip and ending, avoiding separate grading of its temporary ending. Retained Previous video frames are preserved. Requires updated workers.
- Shot speech language keeps the existing choices and also accepts custom language names.
- Empty shot cards use their Video's resolution and aspect ratio while waiting for a preview or generated video.
diff --git a/src/lib/loras.test.ts b/src/lib/loras.test.ts
index 68e5a7f..30a42ae 100644
--- a/src/lib/loras.test.ts
+++ b/src/lib/loras.test.ts
@@ -2,7 +2,7 @@
import { installH3TestDependencies } from "./h3TestUtils";
import { beforeEach, expect, it } from "vitest";
import { PIKA_FL2VA_LORA, PIKA_REF2VA_LORA, DMAD_LORA, downloadableTemplateLoras, LIGHTX2V_TURBO_LORA, loadLoras, saveLoras, TAOMATE_LORA, TURBO_LORA, VIGGLE_ANIMATE_LORA } from "./loras";
-import { createGeneratorTemplate, engineProviderSetting, generationSigmaShifts, generationStepsWithLoras, loadGeneratorTemplateSettings, saveGeneratorTemplateSettings, withEngineSettings } from "./settings";
+import { createGeneratorTemplate, engineProviderSetting, generationSigmaShifts, generationStepsWithLoras, kreaImageTemplates, loadGeneratorTemplateSettings, saveGeneratorTemplateSettings, withEngineSettings } from "./settings";
import { createProjectConfig } from "./project";
import { effectiveLoras, moveLibraryLora, selectionConflict, loraSnapshot } from "./loras";
import { generationStepsForTemplate, templateNeedsDownload } from "./settings";
@@ -12,6 +12,20 @@ import { sceneInput, duplicateScene } from "./sceneHistory";
beforeEach(() => { localStorage.clear(); installH3TestDependencies(); });
+it("does not inherit default-generator or global adapters when Krea omits its LoRA list", () => {
+ saveLoras([{ ...DMAD_LORA, path: "D:/dmad.safetensors", globallyEnabled: true }]);
+ const defaults = createGeneratorTemplate();
+ defaults.loras = [{ loraId: DMAD_LORA.id, enabled: true, strength: 1 }];
+ saveGeneratorTemplateSettings({ templates: [defaults], defaultTemplateId: defaults.id, catalogVersion: 20 });
+ for (const template of kreaImageTemplates()) {
+ const options = engineProviderSetting(template.paths, undefined, template.attention, undefined, "prompt", [], false, template.sources,
+ { ...template, sampler: "er_sde", scheduler: "beta" }).options;
+ expect(options).toMatchObject({ modelType: "krea2", sampler: "er_sde", scheduler: "beta" });
+ for (const key of ["loras", "samplingPreset", "stepOverride", "videoSigmaShiftOverride", "audioSigmaShiftOverride"]) expect(options).not.toHaveProperty(key);
+ expect(effectiveLoras(defaults.loras, defaults.loras, template.modelType)).toEqual([]);
+ }
+});
+
it("merges global, template and scene LoRAs once in library order and keeps globals active", () => {
saveLoras([{ id: "style", name: "Style", path: "D:/style", globallyEnabled: true, globalStrength: 0.7 },
{ id: "template", name: "Template", path: "D:/template", stepOverride: 12 },
diff --git a/src/lib/loras.ts b/src/lib/loras.ts
index 83461cc..3c47ca8 100644
--- a/src/lib/loras.ts
+++ b/src/lib/loras.ts
@@ -1,5 +1,6 @@
import { isSigmaShift, type SigmaShifts } from "./sampling";
import { MAX_GENERATION_STEPS } from "./project";
+import { generatorModel } from "./generatorModels";
/** Machine-local adapter library; paths never belong in portable projects. */
export interface Lora {
@@ -160,6 +161,7 @@ export function resolveTemplateLoras(selection: TemplateLora[] = [], worker = fa
/** Scene choices override templates; global adapters are always applied last.
* The library order is the execution order, independent of the selection source. */
export function effectiveLoras(selection: TemplateLora[] = [], overrides: TemplateLora[] = [], modelType = "minimax-h3", library = loadLoras()): TemplateLora[] {
+ if (!generatorModel(modelType).loras) return [];
const chosen = new Map(selection.map((entry) => [entry.loraId, entry]));
for (const entry of overrides) chosen.set(entry.loraId, entry);
if (modelType === "minimax-h3") for (const lora of library) {