Skip to content

AI media harness for planning, generating, and editing locally

TypeScript

Add generator MotionCache toggle

Bittid9cc68fb64be
diff --git a/docs/generator-weights.md b/docs/generator-weights.md
index 10d2164..204c9d6 100644
--- a/docs/generator-weights.md
+++ b/docs/generator-weights.md
@@ -48,6 +48,17 @@ are injected into runtime requests and are not saved into portable project files
## Model weights
+Generator templates also offer **Enable MotionCache**, off by default. It uses
+SlopFab's default motion-aware denoising reuse settings on CUDA and Vulkan.
+Reuse can reduce transformer calls but may change detail and motion; short
+schedules may finish without reuse. It is unavailable in Animate mode. The
+preference is saved per template and applies to subsequent generation requests.
+Older runtimes remain usable with it off and report a clear error if enabled
+without MotionCache support.
+
+The native defaults are threshold 0.15, motion strength 1, warmup 4 calls,
+at most 2 consecutive skips, active range 0.15–0.95, and subsampling stride 8.
+
In Settings → Generator, edit a template and enter local paths or HTTP/HTTPS
download URLs. Hugging Face `blob` links are converted to direct file downloads.
The bundled **First/Last Frame** (formerly **Minimax H3 Original**),
diff --git a/src-tauri/src/slopfab/config.rs b/src-tauri/src/slopfab/config.rs
index 2cb31b4..3e33755 100644
--- a/src-tauri/src/slopfab/config.rs
+++ b/src-tauri/src/slopfab/config.rs
@@ -14,6 +14,7 @@ pub(super) struct Configuration {
pub(super) dll_path: PathBuf,
pub(super) vulkan: bool,
pub(super) attention: &'static str,
+ pub(super) motion_cache: bool,
pub(super) animate: bool,
pub(super) prompt_embedding: Option<PathBuf>,
pub(super) models: [(i32, &'static str, Option<PathBuf>); 5],
@@ -45,6 +46,10 @@ impl Configuration {
dll_path: option("dllPath").unwrap_or_else(default_dll_path),
vulkan: string_option("inferenceBackend") == Some("vulkan"),
animate: string_option("generationMode") == Some("animate"),
+ motion_cache: matches!(
+ slopfab.and_then(|setting| setting.options.get("motionCache")),
+ Some(ProviderOption::Boolean(true))
+ ),
prompt_embedding: option("promptEmbedding"),
attention: match string_option("attention") {
Some("exact") => "exact",
@@ -82,6 +87,9 @@ impl Configuration {
}
pub(super) fn validate_inputs(&self, request: &GenerationRequest) -> Result<(), String> {
+ if self.animate && self.motion_cache {
+ return Err("MotionCache is unavailable in Animate mode.".into());
+ }
if self.animate {
if request.still_image {
return Err("Animate requires video generation.".into());
@@ -144,9 +152,10 @@ impl Configuration {
})
.unwrap_or_default();
format!(
- "slopfab={version}|platform={}|attention={}|{models}|loras={adapters}|steps={:?}",
+ "slopfab={version}|platform={}|attention={}|motionCache={}|{models}|loras={adapters}|steps={:?}",
platform.label(),
self.attention,
+ self.motion_cache,
self.step_override
)
}
diff --git a/src-tauri/src/slopfab/ffi/mod.rs b/src-tauri/src/slopfab/ffi/mod.rs
index ef9a8e4..b8737c2 100644
--- a/src-tauri/src/slopfab/ffi/mod.rs
+++ b/src-tauri/src/slopfab/ffi/mod.rs
@@ -42,6 +42,12 @@ impl Api {
.expect("configure API before creating handles")
.disable_animate_for_test();
}
+ #[cfg(test)]
+ pub fn disable_motion_cache_for_test(&mut self) {
+ Arc::get_mut(&mut self.inner)
+ .expect("configure API before creating handles")
+ .disable_motion_cache_for_test();
+ }
fn check(&self, r: &RequestHandle) -> Result<(), String> {
if Arc::ptr_eq(&self.inner, &r.api.inner) {
Ok(())
@@ -107,6 +113,10 @@ impl Api {
self.check(r)?;
self.inner.set_attention(r.pointer.as_ptr(), v)
}
+ pub fn set_motion_cache(&self, r: &RequestHandle, enabled: bool) -> Result<(), String> {
+ self.check(r)?;
+ self.inner.set_motion_cache(r.pointer.as_ptr(), enabled)
+ }
pub fn set_inference_backend(&self, r: &RequestHandle, backend: i32) -> Result<(), String> {
self.check(r)?;
self.inner
diff --git a/src-tauri/src/slopfab/ffi/raw/mod.rs b/src-tauri/src/slopfab/ffi/raw/mod.rs
index 279bd29..d829605 100644
--- a/src-tauri/src/slopfab/ffi/raw/mod.rs
+++ b/src-tauri/src/slopfab/ffi/raw/mod.rs
@@ -58,6 +58,8 @@ pub struct Output {
pub steps_skipped: i32,
}
pub type ProgressFn = Option<unsafe extern "C" fn(*const Progress, *mut c_void)>;
+type SetMotionCache =
+ unsafe extern "C" fn(*mut Request, i32, f32, f32, i32, i32, f32, f32, i32, i32) -> i32;
pub struct Api {
_library: Library,
@@ -84,6 +86,7 @@ pub struct Api {
add_refmod: Option<unsafe extern "C" fn(*mut Request, *const c_char, f32, i32) -> i32>,
add_reference: unsafe extern "C" fn(*mut Request, *const c_char) -> i32,
set_attention: unsafe extern "C" fn(*mut Request, *const c_char) -> i32,
+ set_motion_cache: Option<SetMotionCache>,
set_inference_backend: unsafe extern "C" fn(*mut Request, i32) -> i32,
set_verbose: unsafe extern "C" fn(*mut Request, i32) -> i32,
set_reuse_models: unsafe extern "C" fn(*mut Request, i32) -> i32,
@@ -215,6 +218,10 @@ impl Api {
"slopfab_request_set_attention",
unsafe extern "C" fn(*mut Request, *const c_char) -> i32
),
+ set_motion_cache: library
+ .get::<SetMotionCache>(b"slopfab_request_set_motion_cache\0")
+ .ok()
+ .map(|symbol| *symbol),
set_inference_backend: symbol!(
"slopfab_request_set_inference_backend",
unsafe extern "C" fn(*mut Request, i32) -> i32
@@ -391,6 +398,21 @@ impl Api {
let v = CString::new(v).map_err(|_| "Attention mode contains a null byte.".to_string())?;
self.error(unsafe { (self.set_attention)(r, v.as_ptr()) })
}
+ pub fn set_motion_cache(&self, r: *mut Request, enabled: bool) -> Result<(), String> {
+ let Some(set) = self.set_motion_cache else {
+ return if enabled {
+ Err("This slopfab.dll does not support MotionCache. Update the runtime or disable MotionCache in the generator template.".into())
+ } else {
+ Ok(())
+ };
+ };
+ // Defaults from slopfab/capi.h; the UI exposes only the enable switch.
+ self.error(unsafe { set(r, enabled as i32, 0.15, 1.0, 4, 2, 0.15, 0.95, 8, 0) })
+ }
+ #[cfg(test)]
+ pub fn disable_motion_cache_for_test(&mut self) {
+ self.set_motion_cache = None;
+ }
pub fn set_inference_backend(&self, r: *mut Request, backend: i32) -> Result<(), String> {
self.error(unsafe { (self.set_inference_backend)(r, backend) })
}
diff --git a/src-tauri/src/slopfab/h3.rs b/src-tauri/src/slopfab/h3.rs
index 8cf7a6e..f4a9068 100644
--- a/src-tauri/src/slopfab/h3.rs
+++ b/src-tauri/src/slopfab/h3.rs
@@ -57,6 +57,7 @@ pub(super) fn configure_request(
api.set_resolution(handle, request.canvas_width, request.canvas_height)?;
api.set_inference_backend(handle, platform.backend())?;
api.set_attention(handle, configuration.attention)?;
+ api.set_motion_cache(handle, configuration.motion_cache)?;
api.set_verbose(handle, false)?;
if let Some(path) = &request.continuation_path {
api.set_continuation_file(
diff --git a/src-tauri/src/slopfab/icons.rs b/src-tauri/src/slopfab/icons.rs
index 66fc74c..c167a1c 100644
--- a/src-tauri/src/slopfab/icons.rs
+++ b/src-tauri/src/slopfab/icons.rs
@@ -110,6 +110,7 @@ pub fn generate_reference_icon_batch(
step_override: Ok(None),
vulkan: backend == ComputePlatform::Vulkan,
attention: "sage2",
+ motion_cache: false,
animate: false,
prompt_embedding: None,
models: [
diff --git a/src-tauri/src/slopfab/tests.rs b/src-tauri/src/slopfab/tests.rs
index d29ae9b..4401e45 100644
--- a/src-tauri/src/slopfab/tests.rs
+++ b/src-tauri/src/slopfab/tests.rs
@@ -405,6 +405,74 @@ fn refmods_attach_for_plans_and_icons_or_report_an_older_dll() {
.is_err());
}
+#[test]
+fn motion_cache_reaches_cuda_and_vulkan_requests_and_changes_timing_profile() {
+ let mut configuration = Configuration::from_settings(&BTreeMap::from([(
+ "slopfab".into(),
+ ProviderSetting {
+ enabled: true,
+ model: None,
+ options: BTreeMap::from([("motionCache".into(), ProviderOption::Boolean(true))]),
+ },
+ )]));
+ assert!(configuration.motion_cache);
+ assert!(!Configuration::from_settings(&BTreeMap::new()).motion_cache);
+ let api = ffi::Api::load(&configuration.dll_path).unwrap();
+ let request = GenerationRequest {
+ prompt: "A quiet harbour.".into(),
+ frames: 120,
+ steps: 20,
+ seed: 1,
+ canvas_width: 736,
+ canvas_height: 416,
+ ..Default::default()
+ };
+ for platform in [ComputePlatform::Cuda13, ComputePlatform::Vulkan] {
+ let enabled_profile = configuration.timing_profile("test", platform);
+ 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 description = api.describe(&handle).unwrap();
+ assert!(description.contains("MotionCache"), "{description}");
+ assert!(description.contains("threshold 0.150"), "{description}");
+ api.set_motion_cache(&handle, false).unwrap();
+ assert!(!api.describe(&handle).unwrap().contains("MotionCache"));
+ }
+ configuration.motion_cache = false;
+ assert_ne!(
+ enabled_profile,
+ configuration.timing_profile("test", platform)
+ );
+ configuration.motion_cache = true;
+ }
+ configuration.animate = true;
+ assert!(configuration
+ .validate_inputs(&request)
+ .unwrap_err()
+ .contains("MotionCache is unavailable in Animate"));
+}
+
+#[test]
+fn older_runtimes_work_with_motion_cache_off_and_explain_missing_support() {
+ let mut api = ffi::Api::load(&default_dll_path()).unwrap();
+ api.disable_motion_cache_for_test();
+ let handle = RequestHandle::new(&api).unwrap();
+ api.set_motion_cache(&handle, false).unwrap();
+ assert!(api
+ .set_motion_cache(&handle, true)
+ .unwrap_err()
+ .contains("does not support MotionCache"));
+}
+
#[test]
fn ordered_loras_and_step_override_reach_cuda_and_vulkan_requests() {
let references = ReferenceVideos::default();
diff --git a/src/components/SettingsView.test.tsx b/src/components/SettingsView.test.tsx
index a986572..792abea 100644
--- a/src/components/SettingsView.test.tsx
+++ b/src/components/SettingsView.test.tsx
@@ -37,6 +37,29 @@ describe("the frame the tabs sit in", () => {
});
describe("the settings screen", () => {
+ it("remembers MotionCache per generator and disables it in Animate mode", () => {
+ const view = open();
+ editDefaultGenerator();
+ const toggle = () => screen.getByRole("checkbox", { name: "Enable MotionCache" }) as HTMLInputElement;
+ expect(toggle().checked).toBe(false);
+ fireEvent.click(toggle());
+ expect(loadGeneratorTemplateSettings().templates.find(({ id }) => id === "default")?.motionCache).toBe(true);
+ fireEvent.change(screen.getByLabelText("Generator mode"), { target: { value: "animate" } });
+ expect(toggle().checked).toBe(false);
+ expect(toggle().disabled).toBe(true);
+ fireEvent.change(screen.getByLabelText("Generator mode"), { target: { value: "prompt" } });
+ expect(toggle().checked).toBe(true);
+ fireEvent.click(screen.getByRole("button", { name: "Generators" }));
+ fireEvent.click(screen.getByRole("button", { name: "New generator" }));
+ expect(toggle().checked).toBe(false);
+ view.unmount();
+ open();
+ editDefaultGenerator();
+ expect(toggle().checked).toBe(true);
+ fireEvent.click(toggle());
+ expect(loadGeneratorTemplateSettings().templates.find(({ id }) => id === "default")?.motionCache).toBe(false);
+ });
+
it("defaults to Sage and remembers each generator's attention", () => {
const view = open();
editDefaultGenerator();
diff --git a/src/components/SettingsView.tsx b/src/components/SettingsView.tsx
index 3314057..f99c92c 100644
--- a/src/components/SettingsView.tsx
+++ b/src/components/SettingsView.tsx
@@ -303,12 +303,12 @@ export function SettingsView({ onClose, updates, initialTab = "engine" }: { onCl
const probe = useCallback((paths?: EngineSettings) => {
const revision = ++probeRevision.current;
- void getEngineStatus(paths, selectedTemplate.attention, selectedTemplate.loras ?? [], selectedTemplate.mode ?? "prompt", selectedTemplate.additionalSafetensors ?? []).then((next) => {
+ void getEngineStatus(paths, selectedTemplate.attention, selectedTemplate.loras ?? [], selectedTemplate.mode ?? "prompt", selectedTemplate.additionalSafetensors ?? [], selectedTemplate.motionCache ?? false).then((next) => {
if (revision === probeRevision.current) setStatus(next);
}).catch(() => {
if (revision === probeRevision.current) setStatus(null);
});
- }, [selectedTemplate.attention, selectedTemplate.loras, selectedTemplate.mode, selectedTemplate.additionalSafetensors]);
+ }, [selectedTemplate.attention, selectedTemplate.loras, selectedTemplate.mode, selectedTemplate.additionalSafetensors, selectedTemplate.motionCache]);
/* Saved on every keystroke — there is no Save button here, so a half-typed
path must never be the reason generation is still broken after a restart.
@@ -373,7 +373,7 @@ export function SettingsView({ onClose, updates, initialTab = "engine" }: { onCl
probe({ ...EMPTY_ENGINE_SETTINGS });
};
- const updateTemplate = (updates: Partial<Pick<typeof selectedTemplate, "name" | "defaultSteps" | "attention" | "loras" | "mode" | "additionalSafetensors">>) => {
+ const updateTemplate = (updates: Partial<Pick<typeof selectedTemplate, "name" | "defaultSteps" | "attention" | "motionCache" | "loras" | "mode" | "additionalSafetensors">>) => {
setTemplateSettings((current) => {
const next = {
...current,
@@ -571,6 +571,13 @@ export function SettingsView({ onClose, updates, initialTab = "engine" }: { onCl
</select>
</label>
</div>
+ <label className="lora-toggle">
+ <input type="checkbox" aria-label="Enable MotionCache" aria-describedby="motion-cache-help"
+ checked={selectedTemplate.mode !== "animate" && Boolean(selectedTemplate.motionCache)} disabled={selectedTemplate.mode === "animate"}
+ onChange={(event) => updateTemplate({ motionCache: event.target.checked })} />
+ Enable MotionCache
+ </label>
+ <p id="motion-cache-help">{selectedTemplate.mode === "animate" ? "MotionCache is unavailable in Animate mode." : "Reuses similar denoising results to reduce computation. May affect detail and motion; short generations may not reuse any steps."}</p>
<div className={`settings-status settings-status--${status?.state ?? "checking"}`} role="status">
<span><i />{engineHeadline(status, desktop)}</span>
<p>{engineDetail(status, desktop, missing.length)}</p>
diff --git a/src/components/workspace/GeneratorView.test.tsx b/src/components/workspace/GeneratorView.test.tsx
index 3f63582..3ee8893 100644
--- a/src/components/workspace/GeneratorView.test.tsx
+++ b/src/components/workspace/GeneratorView.test.tsx
@@ -469,6 +469,7 @@ describe("Generator scene controls", () => {
id: "draft",
name: "Fast draft",
defaultSteps: 8,
+ motionCache: true,
paths: { transformer: "draft.safetensors", textEncoder: "", tokenizer: "", videoVae: "", audioVae: "" },
},
],
@@ -492,7 +493,7 @@ describe("Generator scene controls", () => {
fireEvent.click(screen.getByRole("option", { name: "Fast draft" }));
await waitFor(() => expect(document.querySelector(".generator-runtime--modelsMissing > i")).not.toBeNull());
- expect(getEngineStatus).toHaveBeenCalledWith(expect.objectContaining({ transformer: "draft.safetensors" }), "sage2", [], "prompt", []);
+ expect(getEngineStatus).toHaveBeenCalledWith(expect.objectContaining({ transformer: "draft.safetensors" }), "sage2", [], "prompt", [], true);
expect(JSON.parse(localStorage.getItem("slopus.generator-templates.v1")!).defaultTemplateId).toBe("draft");
expect(screen.queryByText("Video model files missing")).not.toBeInTheDocument();
expect(template.closest(".generator-runtime--modelsMissing")).not.toBeNull();
diff --git a/src/components/workspace/GeneratorView.tsx b/src/components/workspace/GeneratorView.tsx
index fba7cf1..a57562d 100644
--- a/src/components/workspace/GeneratorView.tsx
+++ b/src/components/workspace/GeneratorView.tsx
@@ -59,7 +59,7 @@ export function GeneratorView({ config, folderPath, runtime = null, generationCo
const runtimeProbe = useRef(0);
const [loraLibrary, setLoraLibrary] = useState(loadLoras);
useEffect(() => subscribeLoras(() => setLoraLibrary(loadLoras())), []);
- const templateKey = JSON.stringify([selectedTemplate.id, selectedTemplate.mode, selectedTemplate.paths, selectedTemplate.attention, selectedTemplate.loras, selectedTemplate.additionalSafetensors, loraLibrary]);
+ const templateKey = JSON.stringify([selectedTemplate.id, selectedTemplate.mode, selectedTemplate.paths, selectedTemplate.attention, selectedTemplate.motionCache, selectedTemplate.loras, selectedTemplate.additionalSafetensors, loraLibrary]);
const probedTemplate = useRef(templateKey);
const configRef = useRef(config);
configRef.current = config;
@@ -107,7 +107,7 @@ export function GeneratorView({ config, folderPath, runtime = null, generationCo
setRuntimeError(null);
const probe = ++runtimeProbe.current;
if (!selectedTemplate.id) return;
- void getEngineStatus(selectedTemplate.paths, selectedTemplate.attention, selectedTemplate.loras ?? [], selectedTemplate.mode ?? "prompt", selectedTemplate.additionalSafetensors ?? []).then((status) => {
+ void getEngineStatus(selectedTemplate.paths, selectedTemplate.attention, selectedTemplate.loras ?? [], selectedTemplate.mode ?? "prompt", selectedTemplate.additionalSafetensors ?? [], selectedTemplate.motionCache ?? false).then((status) => {
if (probe !== runtimeProbe.current) return;
setGeneratorRuntime(status);
onRuntimeChange?.(status);
diff --git a/src/lib/runtime.ts b/src/lib/runtime.ts
index eddac6e..fc8070e 100644
--- a/src/lib/runtime.ts
+++ b/src/lib/runtime.ts
@@ -144,16 +144,16 @@ export const CHECKING_PROVIDERS: ProviderStatus[] = [
/** Probes the engine paths on their own, with no project in hand — what the
* settings screen shows. */
-export async function getEngineStatus(settings = loadEngineSettings(), attention?: AttentionMode, loras?: TemplateLora[], mode?: GeneratorTemplate["mode"], additionalSafetensors?: GeneratorTemplate["additionalSafetensors"]): Promise<SlopfabStatus> {
+export async function getEngineStatus(settings = loadEngineSettings(), attention?: AttentionMode, loras?: TemplateLora[], mode?: GeneratorTemplate["mode"], additionalSafetensors?: GeneratorTemplate["additionalSafetensors"], motionCache?: boolean): Promise<SlopfabStatus> {
if (!isTauri()) return DEMO_STATUS.slopfab;
let slopfab;
let adapterError: string | undefined;
try {
- slopfab = engineProviderSetting(settings, undefined, attention, loras, mode, additionalSafetensors);
+ slopfab = engineProviderSetting(settings, undefined, attention, loras, mode, additionalSafetensors, motionCache);
} catch (reason) {
// A missing adapter must not prevent checking the individual model files.
adapterError = reason instanceof Error ? reason.message : String(reason);
- slopfab = engineProviderSetting(settings, undefined, attention, [], mode, additionalSafetensors);
+ slopfab = engineProviderSetting(settings, undefined, attention, [], mode, additionalSafetensors, motionCache);
}
const status = await invoke<SlopfabStatus>("slopfab_status", { settings: { slopfab } });
return adapterError ? { ...status, state: status.state === "ready" ? "modelsMissing" : status.state,
diff --git a/src/lib/settings.test.ts b/src/lib/settings.test.ts
index bd2e95f..209f368 100644
--- a/src/lib/settings.test.ts
+++ b/src/lib/settings.test.ts
@@ -25,6 +25,21 @@ import {
describe("generator templates", () => {
beforeEach(() => localStorage.clear());
+ it("persists MotionCache per template and replaces stale runtime options", () => {
+ const template = createGeneratorTemplate();
+ expect(template.motionCache ?? false).toBe(false);
+ template.motionCache = true;
+ saveGeneratorTemplateSettings({ templates: [template], defaultTemplateId: template.id, catalogVersion: 8 });
+ expect(loadGeneratorTemplateSettings().templates[0].motionCache).toBe(true);
+ const enabled = engineProviderSetting(template.paths);
+ expect(enabled.options.motionCache).toBe(true);
+ expect(engineProviderSetting(template.paths, enabled, template.attention, [], "prompt", [], false).options).not.toHaveProperty("motionCache");
+ expect(engineProviderSetting(template.paths, enabled, template.attention, [], "animate", [], true).options).not.toHaveProperty("motionCache");
+ template.motionCache = false;
+ saveGeneratorTemplateSettings({ templates: [template], defaultTemplateId: template.id, catalogVersion: 8 });
+ expect(engineProviderSetting(template.paths, enabled).options).not.toHaveProperty("motionCache");
+ });
+
it("migrates the former flat engine paths into the Default template", () => {
localStorage.setItem("slopus.engine-paths.v1", JSON.stringify({ transformer: "D:\\Models\\main.safetensors" }));
const settings = loadGeneratorTemplateSettings();
diff --git a/src/lib/settings.ts b/src/lib/settings.ts
index 710023b..f581c60 100644
--- a/src/lib/settings.ts
+++ b/src/lib/settings.ts
@@ -72,6 +72,7 @@ export interface GeneratorTemplate {
name: string;
defaultSteps: number;
attention: AttentionMode;
+ motionCache?: boolean;
mode?: "prompt" | "animate";
paths: EngineSettings;
sources?: Partial<Record<EnginePathId, WeightSource[]>>;
@@ -285,6 +286,7 @@ const normalizeTemplateSettings = (value: unknown): GeneratorTemplateSettings |
...(typeof file.downloadedPath === "string" && file.downloadedPath.trim() && !isDownloadUrl(file.downloadedPath) ? { downloadedPath: file.downloadedPath } : {}) }];
}) : [];
return [{ id, name, defaultSteps, attention, paths, sources,
+ ...(typeof candidate.motionCache === "boolean" ? { motionCache: candidate.motionCache } : {}),
...(candidate.additionalSafetensors !== undefined ? { additionalSafetensors } : {}),
...(candidate.mode === "animate" || candidate.mode === "prompt" ? { mode: candidate.mode } : {}),
...(candidate.loras !== undefined ? { loras: normalizeTemplateLoras(candidate.loras) } : {}) }];
@@ -458,7 +460,7 @@ export function saveEngineSettings(settings: EngineSettings): void {
/** The `slopfab` provider setting these paths describe, with blanks dropped so
* an unset field falls through to whatever the project (or the Rust default)
* already had rather than overwriting it with "". */
-export function engineProviderSetting(settings: EngineSettings, base?: ProviderSetting, attention = defaultGeneratorTemplate().attention, selection = defaultGeneratorTemplate().loras, mode = defaultGeneratorTemplate().mode, additionalSafetensors = defaultGeneratorTemplate().additionalSafetensors): ProviderSetting {
+export function engineProviderSetting(settings: EngineSettings, base?: ProviderSetting, attention = defaultGeneratorTemplate().attention, selection = defaultGeneratorTemplate().loras, mode = defaultGeneratorTemplate().mode, additionalSafetensors = defaultGeneratorTemplate().additionalSafetensors, motionCache = defaultGeneratorTemplate().motionCache ?? false): ProviderSetting {
const options: ProviderSetting["options"] = { ...(base?.options ?? {}), attention, inferenceBackend: loadInferenceBackend() };
// Always replace project-carried adapter paths with this machine's selection.
delete options.loras;
@@ -466,6 +468,8 @@ export function engineProviderSetting(settings: EngineSettings, base?: ProviderS
delete options.stepOverride;
delete options.generationMode;
delete options.promptEmbedding;
+ delete options.motionCache;
+ if (motionCache && mode !== "animate") options.motionCache = true;
if (mode === "animate") options.generationMode = "animate";
if (mode === "animate") {
const path = additionalSafetensors?.find((file) => file.role === "promptEmbedding")?.downloadedPath;