Skip to content

AI media harness for planning, generating, and editing locally

TypeScript

Add Pika H3 Flex LoRAs and sampling recipe

Bitti1fdd01696d07
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index 866197e..e7cbcf9 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -4,6 +4,8 @@ Changes since 0.3.2.
## What's new
+- **Pika H3 Flex.** Added FL2VA and Ref2VA LoRA downloads with Pika's fixed six-step re-noising recipe and video/audio sigma shifts of 12/3.
+
- **MiniMax H3 dependencies.** Added named Video and Audio VAE templates, including Sol H3 VAE, and a shared default Text Encoder. Generators link to VAEs and automatically download missing dependencies; existing custom paths and downloads are preserved.
- **Scene upscaling.** Generate's dropdown offers 1.5x, 2x and 4x latent upscaling as new Takes. Upscaled Takes can be enlarged again; scene references always use original latents.
diff --git a/src-tauri/core/src/slopfab/config.rs b/src-tauri/core/src/slopfab/config.rs
index 437df69..7d94f43 100644
--- a/src-tauri/core/src/slopfab/config.rs
+++ b/src-tauri/core/src/slopfab/config.rs
@@ -12,6 +12,7 @@ pub(super) struct LoraAdapter {
#[derive(Debug, Clone, Copy, PartialEq)]
pub(super) enum SamplingPreset {
Dmad4Step,
+ Pika6Step,
}
#[derive(Clone, Debug, Default)]
@@ -117,6 +118,7 @@ impl Configuration {
sampling_preset: match slopfab.and_then(|setting| setting.options.get("samplingPreset")) {
None => Ok(None),
Some(ProviderOption::String(value)) if value == "dmad-4step" => Ok(Some(SamplingPreset::Dmad4Step)),
+ Some(ProviderOption::String(value)) if value == "pika-6step" => Ok(Some(SamplingPreset::Pika6Step)),
_ => Err("Unsupported LoRA sampling recipe.".into()),
},
}
@@ -245,6 +247,9 @@ impl Configuration {
if self.sampling_preset.clone()? == Some(SamplingPreset::Dmad4Step) {
return Ok(4);
}
+ if self.sampling_preset.clone()? == Some(SamplingPreset::Pika6Step) {
+ return Ok(6);
+ }
self.step_override
.clone()
.map(|steps| steps.unwrap_or(fallback))
diff --git a/src-tauri/core/src/slopfab/ffi/mod.rs b/src-tauri/core/src/slopfab/ffi/mod.rs
index c31a3a7..da7006e 100644
--- a/src-tauri/core/src/slopfab/ffi/mod.rs
+++ b/src-tauri/core/src/slopfab/ffi/mod.rs
@@ -215,6 +215,10 @@ impl Api {
self.check(r)?;
self.inner.set_dmad_sampling(r.pointer.as_ptr())
}
+ pub fn set_pika_sampling(&self, r: &RequestHandle) -> Result<(), String> {
+ self.check(r)?;
+ self.inner.set_pika_sampling(r.pointer.as_ptr())
+ }
pub fn set_verbose(&self, r: &RequestHandle, v: bool) -> Result<(), String> {
self.check(r)?;
self.inner.set_verbose(r.pointer.as_ptr(), v)
diff --git a/src-tauri/core/src/slopfab/ffi/raw/mod.rs b/src-tauri/core/src/slopfab/ffi/raw/mod.rs
index 9a7471c..9213509 100644
--- a/src-tauri/core/src/slopfab/ffi/raw/mod.rs
+++ b/src-tauri/core/src/slopfab/ffi/raw/mod.rs
@@ -403,6 +403,16 @@ impl Api {
let settings = CString::new(r#"{"version":1,"sampler":"renoise","video_sigma_shift":12,"audio_sigma_shift":2,"base_sigmas":[1,0.75,0.5,0.25,0]}"#).unwrap();
self.error(unsafe { set(r, settings.as_ptr()) })
}
+ pub fn set_pika_sampling(&self, r: *mut Request) -> Result<(), String> {
+ const UPGRADE: &str = "Pika H3 Flex requires slopfab.dll API 1.16 or later. Update the runtime.";
+ if unsafe { (self.capi_version)() } < ((1 << 24) | (16 << 12)) {
+ return Err(UPGRADE.into());
+ }
+ let set = self.set_sampling_settings.ok_or(UPGRADE)?;
+ // https://github.com/Pika-Labs/Pika-H3-Flex#reproducibility
+ let settings = CString::new(r#"{"version":1,"sampler":"renoise","video_sigma_shift":12,"audio_sigma_shift":3,"base_sigmas":[1,0.75,0.5,0.25,0.1,0.04,0]}"#).unwrap();
+ self.error(unsafe { set(r, settings.as_ptr()) })
+ }
pub fn set_sigma_shifts(&self, r: *mut Request, video: Option<f32>, audio: Option<f32>) -> Result<(), String> {
let Some(set) = self.set_sampling_settings else {
return if video.is_none() && audio.is_none() { Ok(()) }
diff --git a/src-tauri/core/src/slopfab/h3.rs b/src-tauri/core/src/slopfab/h3.rs
index 0709371..faa3fe6 100644
--- a/src-tauri/core/src/slopfab/h3.rs
+++ b/src-tauri/core/src/slopfab/h3.rs
@@ -69,9 +69,12 @@ pub(super) fn configure_request(
}
let video_steps = configuration.generation_steps(request.steps)?;
api.set_steps(handle, video_steps)?;
- let dmad = configuration.sampling_preset.as_ref().map_err(Clone::clone)? == &Some(SamplingPreset::Dmad4Step);
- if dmad {
- api.set_dmad_sampling(handle)?;
+ let preset = configuration.sampling_preset.as_ref().map_err(Clone::clone)?;
+ if let Some(preset) = preset {
+ match preset {
+ SamplingPreset::Dmad4Step => api.set_dmad_sampling(handle)?,
+ SamplingPreset::Pika6Step => api.set_pika_sampling(handle)?,
+ }
} else {
let shifts = configuration.sigma_shifts.as_ref().map_err(Clone::clone)?;
api.set_sigma_shifts(handle, shifts.video_override.or(request.video_sigma_shift).or(shifts.video),
@@ -140,7 +143,7 @@ pub(super) fn configure_request(
let lock_overlap = request.continuation_path.is_some() && request.continuation_lock_overlap;
let independent_audio = request.audio_steps.is_some_and(|steps| steps != video_steps);
// Overlap locking and different audio/video step counts require full evaluations.
- api.set_motion_cache(handle, configuration.motion_cache && !dmad && request.image_edit.is_none() && !lock_overlap && !independent_audio && request.latent_bridge.is_none() && request.single_shot.is_none() && source_noise.is_none())?;
+ api.set_motion_cache(handle, configuration.motion_cache && preset.is_none() && request.image_edit.is_none() && !lock_overlap && !independent_audio && request.latent_bridge.is_none() && request.single_shot.is_none() && source_noise.is_none())?;
if let Some(bridge) = &request.latent_bridge {
api.set_latent_bridge_files(handle,
request.bridge_left_path.as_deref().ok_or("Missing left Long Shot archive.")?,
diff --git a/src-tauri/core/src/slopfab/tests.rs b/src-tauri/core/src/slopfab/tests.rs
index a918042..16b5556 100644
--- a/src-tauri/core/src/slopfab/tests.rs
+++ b/src-tauri/core/src/slopfab/tests.rs
@@ -152,6 +152,47 @@ fn dmad_recipe_reaches_preview_and_execution_on_both_backends() {
assert_ne!(configuration.timing_profile("1.16.0", ComputePlatform::Vulkan), ordinary.timing_profile("1.16.0", ComputePlatform::Vulkan));
}
+#[test]
+fn pika_recipe_reaches_preview_and_execution_on_both_backends() {
+ let root = tempfile::tempdir().unwrap();
+ let adapter = root.path().join("renamed-adapter.safetensors");
+ metadata_checkpoint(&adapter, serde_json::json!({}));
+ let settings = BTreeMap::from([("slopfab".into(), ProviderSetting {
+ enabled: true, model: None,
+ options: BTreeMap::from([
+ ("samplingPreset".into(), ProviderOption::String("pika-6step".into())),
+ ("motionCache".into(), ProviderOption::Boolean(true)),
+ ("stepOverride".into(), ProviderOption::Number(12.0)),
+ ("loras".into(), ProviderOption::String(serde_json::json!([
+ { "path": adapter, "strength": 1.0 }
+ ]).to_string())),
+ ]),
+ })]);
+ let configuration = Configuration::from_settings(&settings);
+ assert_eq!(configuration.generation_steps(30).unwrap(), 6);
+ let api = ffi::Api::load(&configuration.dll_path).unwrap();
+ let request = GenerationRequest {
+ prompt: "A polar bear plays the violin in the snow.".into(),
+ frames: 124, steps: 30, seed: 42, canvas_width: 1344, canvas_height: 768,
+ video_sigma_shift: Some(7.0), audio_sigma_shift: Some(4.0),
+ ..Default::default()
+ };
+ for platform in [ComputePlatform::Cuda13, ComputePlatform::Vulkan] {
+ for purpose in [RequestPurpose::Plan, RequestPurpose::Generate] {
+ let handle = RequestHandle::new(&api).unwrap();
+ configure_request(&api, &handle, &request, &configuration, platform, purpose, &ReferenceVideos::default()).unwrap();
+ let plan = api.resolve(&handle).unwrap();
+ assert_eq!(plan.num_model_evaluations, 6);
+ let description = api.describe(&handle).unwrap();
+ assert!(description.contains("renoise"), "{description}");
+ assert!(description.contains("shift 12"), "{description}");
+ assert!(description.contains("shift 3"), "{description}");
+ }
+ }
+ let ordinary = Configuration::from_settings(&BTreeMap::new());
+ assert_ne!(configuration.timing_profile("1.16.0", ComputePlatform::Vulkan), ordinary.timing_profile("1.16.0", ComputePlatform::Vulkan));
+}
+
#[test]
fn image_edit_recipe_disables_motion_cache_and_keeps_source_geometry() {
let references = ReferenceVideos::default();
diff --git a/src/components/LoraSettings.tsx b/src/components/LoraSettings.tsx
index 80e653a..1e4493d 100644
--- a/src/components/LoraSettings.tsx
+++ b/src/components/LoraSettings.tsx
@@ -110,9 +110,11 @@ export function LoraEditor({ loraId, modelType, onDone }: { loraId: string; mode
<label>Local file<span className="lora-manual__path"><input className="text-field" aria-label="LoRA path" value={path} spellCheck={false} onChange={(event) => setPath(event.target.value)} placeholder="Absolute path to a .safetensors file" />
<button className="secondary-button" type="button" disabled={!isTauri()} onClick={() => void browse()}>Browse…</button></span></label>
<label>Sampling recipe<ComboBox aria-label="LoRA sampling recipe" value={samplingPreset ?? "default"}
- onChange={(value) => setSamplingPreset(value === "dmad-4step" ? value : undefined)}
- options={[{ value: "default", label: "Default" }, { value: "dmad-4step", label: "DMAD 4-Step" }]} /></label>
- {samplingPreset && <InfoBar severity="informational" message="DMAD uses four re-noising evaluations with video/audio shifts of 12/2. Its fixed schedule overrides step counts and turns off MotionCache." />}
+ onChange={(value) => setSamplingPreset(value === "dmad-4step" || value === "pika-6step" ? value : undefined)}
+ options={[{ value: "default", label: "Default" }, { value: "dmad-4step", label: "DMAD 4-Step" }, { value: "pika-6step", label: "Pika H3 Flex 6-Step" }]} /></label>
+ {samplingPreset && <InfoBar severity="informational" message={samplingPreset === "pika-6step"
+ ? "Pika H3 Flex uses six re-noising evaluations with video/audio shifts of 12/3. Its fixed schedule overrides step counts and turns off MotionCache. Use FL2VA with First/Last Frame generators and Ref2VA with References generators."
+ : "DMAD uses four re-noising evaluations with video/audio shifts of 12/2. Its fixed schedule overrides step counts and turns off MotionCache."} />}
{!samplingPreset && <Checkbox aria-label="Override step count" checked={override} onChange={setOverride} label="Override step count"
description="The highest override among active LoRAs replaces the scene's step count." />}
{!samplingPreset && override && <label>Step count<input className="text-field" aria-label="LoRA step override" type="number" min={2} max={MAX_GENERATION_STEPS} step={1} value={steps} onChange={(event) => setSteps(event.target.value)} /></label>}
@@ -132,6 +134,7 @@ export function TemplateLorasEditor({ modelType, value, onChange }: { modelType:
const library = useLoras();
const active = value.filter((entry) => entry.enabled && entry.strength !== 0);
const dmad = active.some((entry) => library.find(({ id }) => id === entry.loraId)?.samplingPreset === "dmad-4step");
+ const pika = active.some((entry) => library.find(({ id }) => id === entry.loraId)?.samplingPreset === "pika-6step");
const stepOverride = highestLoraStepOverride(active
.flatMap((entry) => library.filter(({ id }) => id === entry.loraId)));
const shifts = loraSigmaShiftOverrides(active.flatMap((entry) => library.filter(({ id }) => id === entry.loraId)));
@@ -162,7 +165,9 @@ export function TemplateLorasEditor({ modelType, value, onChange }: { modelType:
options={available.map((lora) => ({ value: lora.id, label: lora.name }))} />
</SettingsCard>
{(shifts.videoSigmaShift !== undefined || shifts.audioSigmaShift !== undefined) && <InfoBar severity="informational" message={`Active LoRA sigma shifts: ${[shifts.videoSigmaShift !== undefined ? `video ${shifts.videoSigmaShift}` : "", shifts.audioSigmaShift !== undefined ? `audio ${shifts.audioSigmaShift}` : ""].filter(Boolean).join(", ")}.`} />}
- {dmad ? <InfoBar severity="informational" message="DMAD fixes generation to four re-noising evaluations and turns off MotionCache." />
+ {dmad && pika ? <InfoBar severity="error" message="Choose either DMAD or Pika H3 Flex: their sampling recipes cannot be combined." />
+ : pika ? <InfoBar severity="informational" message="Pika H3 Flex fixes generation to six re-noising evaluations and turns off MotionCache. Use FL2VA with First/Last Frame generators and Ref2VA with References generators." />
+ : dmad ? <InfoBar severity="informational" message="DMAD fixes generation to four re-noising evaluations and turns off MotionCache." />
: stepOverride !== undefined && <InfoBar severity="informational" message={`Active LoRAs set the scene's step count to ${stepOverride}, the highest selected override.`} />}
</SettingsGroup>;
}
diff --git a/src/components/SettingsView.downloads.test.tsx b/src/components/SettingsView.downloads.test.tsx
index 2ac4ab4..0b91d0a 100644
--- a/src/components/SettingsView.downloads.test.tsx
+++ b/src/components/SettingsView.downloads.test.tsx
@@ -9,7 +9,7 @@ import { loadGeneratorTemplateSettings, minimaxSingularityTemplate } from "../li
import { getWeightDownloadState } from "../lib/weightDownloads";
import { WorkQueuePanel } from "./WorkQueuePanel";
import { WorkQueue } from "../lib/workQueue";
-import { DMAD_LORA, loadLoras, saveLoras, TAOMATE_LORA, TURBO_LORA } from "../lib/loras";
+import { DMAD_LORA, PIKA_FL2VA_LORA, PIKA_REF2VA_LORA, loadLoras, saveLoras, TAOMATE_LORA, TURBO_LORA } from "../lib/loras";
vi.mock("@tauri-apps/api/core", () => ({ invoke: vi.fn() }));
vi.mock("@tauri-apps/api/event", () => ({ listen: vi.fn(async () => () => undefined) }));
@@ -20,6 +20,25 @@ const pick = (name: string, option: string) => {
};
const card = (openLabel: string) => screen.getByRole("button", { name: openLabel }).closest(".settings-open-card") as HTMLElement;
+it.each([PIKA_FL2VA_LORA, PIKA_REF2VA_LORA])("offers $name, preserves its recipe, and downloads it with a generator", async (lora) => {
+ render(<SettingsView onClose={() => undefined} />);
+ fireEvent.click(screen.getByRole("button", { name: "MiniMax H3" }));
+ expect(screen.getByRole("button", { name: `Download LoRA ${lora.name}` })).toBeEnabled();
+ fireEvent.click(screen.getByRole("button", { name: `Edit ${lora.name} LoRA` }));
+ expect(screen.getByRole("combobox", { name: "LoRA sampling recipe" })).toHaveTextContent("Pika H3 Flex 6-Step");
+ expect(screen.getByText(/video\/audio shifts of 12\/3/)).toBeInTheDocument();
+ fireEvent.click(screen.getByRole("button", { name: "Save" }));
+ await waitFor(() => expect(screen.queryByRole("dialog")).not.toBeInTheDocument());
+ const generator = lora.id === PIKA_FL2VA_LORA.id ? "First/Last Frame" : "References";
+ fireEvent.click(screen.getByRole("button", { name: `Edit ${generator} generator` }));
+ pick("Add LoRA to generator", lora.name);
+ expect(screen.getByText(/Pika H3 Flex fixes generation to six/)).toBeInTheDocument();
+ fireEvent.click(screen.getByRole("button", { name: "Download weights" }));
+ await waitFor(() => expect(getWeightDownloadState()).toMatchObject({ active: false, completed: 5, error: null }));
+ expect(invoke).toHaveBeenCalledWith("download_weight", expect.objectContaining({ url: lora.url }));
+ expect(loadLoras().find(({ id }) => id === lora.id)).toMatchObject({ samplingPreset: "pika-6step", path: expect.stringContaining("pika_h3_flex") });
+});
+
it("downloads DMAD, preserves its sampling recipe when edited, and explains its fixed grid", async () => {
render(<SettingsView onClose={() => undefined} />);
fireEvent.click(screen.getByRole("button", { name: "MiniMax H3" }));
diff --git a/src/lib/loras.test.ts b/src/lib/loras.test.ts
index 0c1b98b..87f6da9 100644
--- a/src/lib/loras.test.ts
+++ b/src/lib/loras.test.ts
@@ -1,7 +1,7 @@
// @vitest-environment jsdom
import { installH3TestDependencies } from "./h3TestUtils";
import { beforeEach, expect, it } from "vitest";
-import { DMAD_LORA, downloadableTemplateLoras, LIGHTX2V_TURBO_LORA, loadLoras, saveLoras, TAOMATE_LORA, TURBO_LORA, VIGGLE_ANIMATE_LORA } from "./loras";
+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 { createProjectConfig } from "./project";
@@ -67,9 +67,9 @@ it.each([0, 1, -3, 2.5, NaN, Infinity, 2147483648])("rejects invalid step overri
});
it("starts with the bundled adapters and preserves the local library", () => {
- expect(loadLoras()).toEqual([TAOMATE_LORA, TURBO_LORA, VIGGLE_ANIMATE_LORA, LIGHTX2V_TURBO_LORA, DMAD_LORA]);
+ expect(loadLoras()).toEqual([TAOMATE_LORA, TURBO_LORA, VIGGLE_ANIMATE_LORA, LIGHTX2V_TURBO_LORA, DMAD_LORA, PIKA_FL2VA_LORA, PIKA_REF2VA_LORA]);
saveLoras([{ ...TAOMATE_LORA, path: "C:/weights/TaoMate.safetensors" }, { id: "style", name: "Style", path: "D:/style.safetensors" }]);
- expect(loadLoras().map(({ name }) => name)).toEqual(["TaoMate 3-Step", "Style", "Turbo", "Viggle Animate Distillation", "LightX2V Turbo", "DMAD 4-Step"]);
+ expect(loadLoras().map(({ name }) => name)).toEqual(["TaoMate 3-Step", "Style", "Turbo", "Viggle Animate Distillation", "LightX2V Turbo", "DMAD 4-Step", "Pika H3 Flex FL2VA", "Pika H3 Flex Ref2VA"]);
});
it("preserves DMAD's recipe and local path and gives its fixed grid priority over step overrides", () => {
@@ -91,6 +91,26 @@ it("preserves DMAD's recipe and local path and gives its fixed grid priority ove
}
});
+it.each([PIKA_FL2VA_LORA, PIKA_REF2VA_LORA])("preserves $name edits and applies its fixed six-step recipe", (lora) => {
+ saveLoras([{ ...lora, name: "My Pika adapter", path: "D:/pika.safetensors" }]);
+ expect(loadLoras().filter(({ id }) => id === lora.id)).toEqual([{ ...lora, name: "My Pika adapter", path: "D:/pika.safetensors" }]);
+ const selection = [{ loraId: lora.id, enabled: true, strength: 1 }];
+ const provider = engineProviderSetting(createGeneratorTemplate().paths, undefined, "sage2", selection, "prompt", [], true);
+ expect(provider.options).toMatchObject({ samplingPreset: "pika-6step", stepOverride: 6, videoSigmaShiftOverride: 12, audioSigmaShiftOverride: 3 });
+ expect(provider.options).not.toHaveProperty("motionCache");
+ expect(generationSigmaShifts({ videoSigmaShift: 8, audioSigmaShift: 2 }, { ...createGeneratorTemplate(), loras: selection })).toEqual({ videoSigmaShift: 12, audioSigmaShift: 3 });
+ for (const inactive of [{ enabled: false, strength: 1 }, { enabled: true, strength: 0 }]) {
+ expect(engineProviderSetting(createGeneratorTemplate().paths, provider, "sage2", [{ ...selection[0], ...inactive }]).options).not.toHaveProperty("samplingPreset");
+ }
+});
+
+it("rejects conflicting fixed LoRA recipes before generation", () => {
+ saveLoras([{ ...PIKA_REF2VA_LORA, path: "D:/pika.safetensors" }, { ...DMAD_LORA, path: "D:/dmad.safetensors" }]);
+ expect(() => engineProviderSetting(createGeneratorTemplate().paths, undefined, "sage2", [
+ { loraId: PIKA_REF2VA_LORA.id, enabled: true, strength: 1 }, { loraId: DMAD_LORA.id, enabled: true, strength: 1 },
+ ])).toThrow("different sampling recipes");
+});
+
it("round-trips template order, enabled flags and strengths, and sends only active adapters", () => {
saveLoras([{ ...TAOMATE_LORA, path: "C:/weights/TaoMate.safetensors" }, { id: "style", name: "Style", path: "D:/style.safetensors" }, { id: "off", name: "Off", path: "" }]);
const template = { ...createGeneratorTemplate(), loras: [
diff --git a/src/lib/loras.ts b/src/lib/loras.ts
index 79636c0..7a8b2c8 100644
--- a/src/lib/loras.ts
+++ b/src/lib/loras.ts
@@ -12,7 +12,7 @@ export interface Lora {
stepOverride?: number;
videoSigmaShiftOverride?: number;
audioSigmaShiftOverride?: number;
- samplingPreset?: "dmad-4step";
+ samplingPreset?: "dmad-4step" | "pika-6step";
needsPreparation?: boolean;
}
export interface TemplateLora { loraId: string; enabled: boolean; strength: number }
@@ -41,6 +41,17 @@ export const DMAD_LORA: Lora = {
url: "https://huggingface.co/ZhengmingYu/DMAD/resolve/main/minimax_h3/dmad_minimax_h3_4step_full_critic.safetensors",
samplingPreset: "dmad-4step",
};
+export const PIKA_FL2VA_LORA: Lora = {
+ id: "pika-h3-flex-fl2va", name: "Pika H3 Flex FL2VA", modelType: "minimax-h3", path: "",
+ url: "https://huggingface.co/Comfy-Org/MiniMax-H3/resolve/main/loras/pika_h3_flex_fl2va_v1_bf16.safetensors",
+ samplingPreset: "pika-6step",
+};
+export const PIKA_REF2VA_LORA: Lora = {
+ id: "pika-h3-flex-ref2va", name: "Pika H3 Flex Ref2VA", modelType: "minimax-h3", path: "",
+ url: "https://huggingface.co/Comfy-Org/MiniMax-H3/resolve/main/loras/pika_h3_flex_ref2va_v1_bf16.safetensors",
+ samplingPreset: "pika-6step",
+};
+const BUNDLED_LORAS = [TAOMATE_LORA, TURBO_LORA, VIGGLE_ANIMATE_LORA, LIGHTX2V_TURBO_LORA, DMAD_LORA, PIKA_FL2VA_LORA, PIKA_REF2VA_LORA];
const KEY = "slopus.loras.v1";
const EVENT = "slopus:loras-changed";
export function loadLoras(): Lora[] {
@@ -53,7 +64,7 @@ export function loadLoras(): Lora[] {
ids.add(entry.id);
return [{ id: entry.id, name: entry.name, path: entry.path,
...(typeof entry.modelType === "string" && entry.modelType.trim() ? { modelType: entry.modelType.trim() } : {}),
- ...(entry.samplingPreset === "dmad-4step" ? { samplingPreset: "dmad-4step" as const } : {}),
+ ...(entry.samplingPreset === "dmad-4step" || entry.samplingPreset === "pika-6step" ? { samplingPreset: entry.samplingPreset as Lora["samplingPreset"] } : {}),
...(isSigmaShift(entry.videoSigmaShiftOverride) ? { videoSigmaShiftOverride: entry.videoSigmaShiftOverride } : {}),
...(isSigmaShift(entry.audioSigmaShiftOverride) ? { audioSigmaShiftOverride: entry.audioSigmaShiftOverride } : {}),
...(entry.needsPreparation === true ? { needsPreparation: true } : {}),
@@ -61,13 +72,12 @@ export function loadLoras(): Lora[] {
...(isLoraStepOverride(entry.stepOverride) ? { stepOverride: entry.stepOverride }
: entry.stepOverride === undefined && entry.schedule === "taomate-3step" ? { stepOverride: 3 } : {}) }];
}) : [];
- if (!ids.has(TAOMATE_LORA.id)) entries.unshift({ ...TAOMATE_LORA });
- if (!ids.has(TURBO_LORA.id)) entries.push({ ...TURBO_LORA });
- if (!ids.has(VIGGLE_ANIMATE_LORA.id)) entries.push({ ...VIGGLE_ANIMATE_LORA });
- if (!ids.has(LIGHTX2V_TURBO_LORA.id)) entries.push({ ...LIGHTX2V_TURBO_LORA });
- if (!ids.has(DMAD_LORA.id)) entries.push({ ...DMAD_LORA });
+ for (const lora of BUNDLED_LORAS) if (!ids.has(lora.id)) {
+ if (lora.id === TAOMATE_LORA.id) entries.unshift({ ...lora });
+ else entries.push({ ...lora });
+ }
return entries;
- } catch { return [{ ...TAOMATE_LORA }, { ...TURBO_LORA }, { ...VIGGLE_ANIMATE_LORA }, { ...LIGHTX2V_TURBO_LORA }, { ...DMAD_LORA }]; }
+ } catch { return BUNDLED_LORAS.map((lora) => ({ ...lora })); }
}
export function saveLoras(loras: Lora[]): void {
if (loras.some((lora) => lora.stepOverride !== undefined && !isLoraStepOverride(lora.stepOverride))) {
@@ -141,12 +151,14 @@ export function highestLoraStepOverride(loras: { stepOverride?: number }[]): num
/** Fixed sampling schedules take priority over editable LoRA step overrides. */
export function loraStepOverride(loras: Pick<Lora, "stepOverride" | "samplingPreset">[]): number | undefined {
- return loras.some((lora) => lora.samplingPreset === "dmad-4step") ? 4 : highestLoraStepOverride(loras);
+ return loras.some((lora) => lora.samplingPreset === "dmad-4step") ? 4
+ : loras.some((lora) => lora.samplingPreset === "pika-6step") ? 6 : highestLoraStepOverride(loras);
}
/** Match step overrides: highest active value per stream, with fixed recipes first. */
export function loraSigmaShiftOverrides(loras: Pick<Lora, "videoSigmaShiftOverride" | "audioSigmaShiftOverride" | "samplingPreset">[]): SigmaShifts {
if (loras.some((lora) => lora.samplingPreset === "dmad-4step")) return { videoSigmaShift: 12, audioSigmaShift: 2 };
+ if (loras.some((lora) => lora.samplingPreset === "pika-6step")) return { videoSigmaShift: 12, audioSigmaShift: 3 };
const highest = (values: (number | undefined)[]) => values.filter(isSigmaShift).reduce<number | undefined>((result, value) => Math.max(result ?? 0, value), undefined);
return { videoSigmaShift: highest(loras.map((lora) => lora.videoSigmaShiftOverride)), audioSigmaShift: highest(loras.map((lora) => lora.audioSigmaShiftOverride)) };
}
diff --git a/src/lib/settings.ts b/src/lib/settings.ts
index bfab91b..4755a9b 100644
--- a/src/lib/settings.ts
+++ b/src/lib/settings.ts
@@ -779,9 +779,11 @@ export function engineProviderSetting(settings: EngineSettings, base?: ProviderS
if (shiftOverrides.audioSigmaShift !== undefined) options.audioSigmaShiftOverride = shiftOverrides.audioSigmaShift;
const stepOverride = loraStepOverride(loras);
if (stepOverride !== undefined) options.stepOverride = stepOverride;
- if (loras.some((lora) => lora.samplingPreset === "dmad-4step")) {
- options.samplingPreset = "dmad-4step";
- // The fixed sigma grid defines four evaluations and forbids approximate caches.
+ const presets = new Set(loras.flatMap((lora) => lora.samplingPreset ? [lora.samplingPreset] : []));
+ if (presets.size > 1) throw new Error("Active LoRAs require different sampling recipes. Choose either DMAD or Pika H3 Flex.");
+ if (presets.size) {
+ options.samplingPreset = [...presets][0];
+ // Fixed re-noising schedules forbid approximate caches.
delete options.motionCache;
}
for (const field of ENGINE_PATH_FIELDS) {
diff --git a/src/lib/slop.test.ts b/src/lib/slop.test.ts
index f8dced4..0931972 100644
--- a/src/lib/slop.test.ts
+++ b/src/lib/slop.test.ts
@@ -58,9 +58,9 @@ describe("portable generator bundles", () => {
expect(result.loras).toEqual([existingLora]);
expect(result.settings.defaultTemplateId).toBe(template.id);
});
- it("imports custom LoRAs with distinct recipes and preserves unrelated settings", () => {
+ it.each(["dmad-4step", "pika-6step"] as const)("imports custom LoRAs with the %s recipe and preserves unrelated settings", (samplingPreset) => {
const template = minimaxOriginalTemplate(); template.loras = [{ loraId: "custom", enabled: true, strength: 1.25 }];
- const lora = { id: "custom", name: "My adapter", path: "", url: "https://example.com/lora", samplingPreset: "dmad-4step" as const };
+ const lora = { id: "custom", name: "My adapter", path: "", url: "https://example.com/lora", samplingPreset };
const text = serializeGeneratorSlop([template], [lora]);
saveLoras([{ ...lora, samplingPreset: undefined, path: "D:/different-recipe.safetensors" }]);
localStorage.setItem("slopus.test-secret", "private");
@@ -70,7 +70,7 @@ describe("portable generator bundles", () => {
expect(reopened.templates).toHaveLength(before.templates.length + 1);
expect(reopened.defaultTemplateId).toBe(before.defaultTemplateId);
expect(localStorage.getItem("slopus.test-secret")).toBe("private");
- expect(loadLoras().find((entry) => entry.id === imported.loras![0].loraId)).toMatchObject({ url: lora.url, path: "", samplingPreset: "dmad-4step" });
+ expect(loadLoras().find((entry) => entry.id === imported.loras![0].loraId)).toMatchObject({ url: lora.url, path: "", samplingPreset });
expect(imported.loras![0].loraId).not.toBe("custom");
});
it("reports storage errors and rolls back newly added LoRAs", () => {
diff --git a/src/lib/slop.ts b/src/lib/slop.ts
index 3103a33..c7e5237 100644
--- a/src/lib/slop.ts
+++ b/src/lib/slop.ts
@@ -24,7 +24,7 @@ const sourcesSchema = z.object({
}).strict();
const portableLoraSchema = z.object({
name, url, enabled: z.boolean(), strength: z.number().finite().min(-MAX_LORA_STRENGTH).max(MAX_LORA_STRENGTH),
- stepOverride: steps.optional(), samplingPreset: z.literal("dmad-4step").optional(),
+ stepOverride: steps.optional(), samplingPreset: z.enum(["dmad-4step", "pika-6step"]).optional(),
}).strict();
export const portableGeneratorSchema = z.object({
name, modelType: name, editingModel: z.boolean().optional(), defaultSteps: steps, attention: z.enum(["exact", "flash2", "sage2", "sol"]),
diff --git a/src/lib/weightDownloads.test.ts b/src/lib/weightDownloads.test.ts
index 13574bf..0f99baa 100644
--- a/src/lib/weightDownloads.test.ts
+++ b/src/lib/weightDownloads.test.ts
@@ -1,7 +1,7 @@
// @vitest-environment jsdom
import { invoke } from "@tauri-apps/api/core";
import { cancelWeightDownload, downloadLora, prepareLora, removeLora, refreshDownloadedLoras, retryWeightDownload } from "./weightDownloads";
-import { DMAD_LORA, LIGHTX2V_TURBO_LORA, loadLoras, saveLoras, TAOMATE_LORA, TURBO_LORA, VIGGLE_ANIMATE_LORA } from "./loras";
+import { PIKA_FL2VA_LORA, PIKA_REF2VA_LORA, DMAD_LORA, LIGHTX2V_TURBO_LORA, loadLoras, saveLoras, TAOMATE_LORA, TURBO_LORA, VIGGLE_ANIMATE_LORA } from "./loras";
import { beforeEach, expect, it, vi } from "vitest";
import { chooseWeightSource, downloadTemplateWeights, getWeightDownloadState, refreshDownloadedWeights, removeTemplateWeights, updateWeightPath, weightDownloadProgress, type DownloadState } from "./weightDownloads";
import { ANIMATE_CONDITIONING_URL, mossImageTemplate, fiboImageTemplate, engineProviderSetting, createGeneratorTemplate, defaultGeneratorTemplate, isDownloadUrl, loadGeneratorTemplateSettings, minimaxOriginalTemplate, minimaxSingularityTemplate, saveGeneratorTemplateSettings, templateNeedsDownload, type WeightSource } from "./settings";
@@ -157,14 +157,14 @@ it("preserves additional file edits while a download is in flight and retries fa
expect(getWeightDownloadState()).toMatchObject({ active: false, completed: 1, error: null });
});
-it.each([TAOMATE_LORA, TURBO_LORA, VIGGLE_ANIMATE_LORA, LIGHTX2V_TURBO_LORA, DMAD_LORA])("downloads $name through the weight transfer and restores missing downloads", async (lora) => {
+it.each([TAOMATE_LORA, TURBO_LORA, VIGGLE_ANIMATE_LORA, LIGHTX2V_TURBO_LORA, DMAD_LORA, PIKA_FL2VA_LORA, PIKA_REF2VA_LORA])("downloads $name through the weight transfer and restores missing downloads", async (lora) => {
const savedLora = () => loadLoras().find(({ id }) => id === lora.id)!;
await downloadLora(lora.id);
expect(invoke).toHaveBeenCalledWith("download_weight", { requestId: expect.any(String), url: lora.url });
const path = `C:/Slopus/weights/${lora.url!.split('/').at(-1)}`;
expect(savedLora()).toMatchObject({ ...lora, path });
const options = engineProviderSetting(createGeneratorTemplate().paths, undefined, "sage2", [{ loraId: lora.id, enabled: true, strength: 1 }]).options;
- expect(options.stepOverride).toBe(lora.samplingPreset === "dmad-4step" ? 4 : lora.stepOverride);
+ expect(options.stepOverride).toBe(lora.samplingPreset === "dmad-4step" ? 4 : lora.samplingPreset === "pika-6step" ? 6 : lora.stepOverride);
expect(options.samplingPreset).toBe(lora.samplingPreset);
expect(JSON.parse(options.loras as string)).toEqual([{ path, strength: 1 }]);
expect(getWeightDownloadState()).toMatchObject({ loraId: lora.id, active: false, completed: 1, error: null });