AI media harness for planning, generating, and editing locally
TypeScript
Allow local SeedVR2 upscaling
Bitti62d8d3e495bc
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.mdindex 21439fb..2387b6d 100644--- a/RELEASE_NOTES.md+++ b/RELEASE_NOTES.md@@ -34,9 +34,9 @@ This alpha update adds LAN generation workers, Linux support, expanded color gra- Video scenes offer a separate audio step count. Audio follows the video step count by default, with optional overrides for local and worker generation.- Character Sheet lets you enable Close up, Front view, Side view and Back view independently. Side view is off by default; generation and the combined image include only enabled views.-- Real-ESRGAN and SeedVR2 weights support local file paths in Other weights settings. SeedVR2 sends selected local files to the worker and downloads any missing components there.+- Real-ESRGAN and SeedVR2 weights support local file paths in Other weights settings. When using a worker, SeedVR2 sends selected local files and downloads any missing components there.- Scene continuation offers a Lock Overlap toggle for local and worker generation, constraining overlapping video and audio to the source scene.-- Image and video exports share a work queue with progress, cancellation, and retained results. SeedVR2 upscaling runs on the selected CUDA worker, which prepares its own models.+- Image and video exports share a work queue with progress, cancellation, and retained results. SeedVR2 upscaling runs locally when Local is selected, or on the selected CUDA worker, which prepares its own models.- Upscaler downloads share the generator and LoRA download queue, with progress in Work Queue and cancellation for waiting downloads.- Work queue activity indicators keep moving in the top bar and open queue when Windows interface animations are disabled.- Image and video export offer None, Real-ESRGAN and SeedVR2 upscaling through SlopFab. Download their models from the new Other weights section in Settings → Generator.diff --git a/src-tauri/src/commands/artifacts.rs b/src-tauri/src/commands/artifacts.rsindex 0cb52af..29dcfd9 100644--- a/src-tauri/src/commands/artifacts.rs+++ b/src-tauri/src/commands/artifacts.rs@@ -415,7 +415,7 @@ fn export_image_file_running(source: &std::path::Path, destination: &std::path::let original = image.to_rgba8();let mut input = Some(original.clone().into_raw());let mut output = None;- progress("rendering", if config.method == crate::slopfab::upscale::UpscaleMethod::Seedvr2 { "Upscaling with SeedVR2 on worker…" } else { "Upscaling with Real-ESRGAN…" });+ progress("rendering", if config.method == crate::slopfab::upscale::UpscaleMethod::Seedvr2 { "Upscaling with SeedVR2…" } else { "Upscaling with Real-ESRGAN…" });crate::upscale::run(workers, id, config, (source_width, source_height), (width, height),1,stop, &mut || Ok(input.take()),diff --git a/src-tauri/src/tests/images.rs b/src-tauri/src/tests/images.rsindex 8be0213..941356c 100644--- a/src-tauri/src/tests/images.rs+++ b/src-tauri/src/tests/images.rs@@ -160,7 +160,7 @@ fn image_export_does_not_silently_skip_a_selected_upscaler() {upscale: Some(UpscaleConfig { method, model_path: folder.path().join("missing.safetensors").to_string_lossy().into(), vae_path: None }),..Default::default()}).unwrap_err();- assert!(error.contains(if method == UpscaleMethod::Seedvr2 { "Select a worker" } else { "weights are missing" }));+ assert!(error.contains("weights are missing"));assert!(!destination.exists());assert_eq!(fs::read(&source).unwrap(), original);}diff --git a/src-tauri/src/upscale.rs b/src-tauri/src/upscale.rsindex 5c7bb28..6c3e232 100644--- a/src-tauri/src/upscale.rs+++ b/src-tauri/src/upscale.rs@@ -13,13 +13,13 @@ pub(crate) fn run(workers: &Workers, id: &str, config: &UpscaleConfig,read: &mut (dyn FnMut() -> Result<Option<Vec<u8>>, String> + Send),write: &mut (dyn FnMut(Vec<u8>) -> Result<(), String> + Send)) -> Result<u64, String> {if config.method == UpscaleMethod::Seedvr2 {- let worker = workers.active()?.ok_or("Select a worker in Settings → Workers to use SeedVR2 upscaling.")?;- let [model, vae] = workers.prepare_upscale_files(&worker, id, config, stop)?;- worker.upscale(id, &StartUpscale { input_width: input.0, input_height: input.1, width: output.0, height: output.1, segment_frames,- model: Some(model), vae: Some(vae) }, stop, read, write)- } else {- upscale::run(config, input, output, segment_frames as i32, stop, read, write)+ if let Some(worker) = workers.active()? {+ let [model, vae] = workers.prepare_upscale_files(&worker, id, config, stop)?;+ return worker.upscale(id, &StartUpscale { input_width: input.0, input_height: input.1, width: output.0, height: output.1, segment_frames,+ model: Some(model), vae: Some(vae) }, stop, read, write);+ }}+ upscale::run(config, input, output, segment_frames as i32, stop, read, write)}#[tauri::command]@@ -64,10 +64,14 @@ pub(crate) fn cancel_export_upscale(id: String) -> Result<(), String> {mod tests {use super::*;#[test]- fn seedvr2_requires_a_worker_instead_of_running_locally() {- let config = UpscaleConfig { method: UpscaleMethod::Seedvr2, model_path: String::new(), vae_path: None };+ fn seedvr2_uses_local_runtime_when_no_worker_is_selected() {+ let model = tempfile::NamedTempFile::new().unwrap();+ let vae = tempfile::NamedTempFile::new().unwrap();+ let config = UpscaleConfig { method: UpscaleMethod::Seedvr2, model_path: model.path().to_string_lossy().into_owned(),+ vae_path: Some(vae.path().to_string_lossy().into_owned()) };+ // Cancellation is handled by the local runtime before loading weights or using the GPU.let result = run(&Workers::default(), "test", &config, (16, 16), (32, 32), 1,- &AtomicBool::new(false), &mut || Ok(None), &mut |_| Ok(()));- assert!(result.unwrap_err().contains("Select a worker"));+ &AtomicBool::new(true), &mut || Ok(None), &mut |_| Ok(()));+ assert_eq!(result.unwrap_err(), "Upscaling cancelled.");}}diff --git a/src/components/OtherWeightsSettings.test.tsx b/src/components/OtherWeightsSettings.test.tsxindex 3956ee9..ac1ec3a 100644--- a/src/components/OtherWeightsSettings.test.tsx+++ b/src/components/OtherWeightsSettings.test.tsx@@ -18,7 +18,7 @@ it("downloads the SeedVR2 model and VAE as one template and remembers both pathsif (name === "download_weight") return `C:/weights/${(args as { url: string }).url.split("/").at(-1)}` as never;return undefined as never;});- expect(() => upscaleConfig("seedvr2")).toThrow("Select a worker");+ expect(() => upscaleConfig("seedvr2")).toThrow("Download SeedVR2");render(<OtherWeightsSettings desktop />);await waitFor(() => expect(invoke).toHaveBeenCalledWith("find_downloaded_weights", expect.anything()));fireEvent.click(within(screen.getByText("SeedVR2").closest(".ui-settings-card") as HTMLElement).getByRole("button", { name: "Download" }));@@ -29,15 +29,16 @@ it("downloads the SeedVR2 model and VAE as one template and remembers both paths[OTHER_WEIGHT_TEMPLATES[1].files[1].url]: "C:/weights/seedvr2_ema_vae_fp16.safetensors",});expect(upscaleConfig("none")).toBeUndefined();+ expect(upscaleConfig("seedvr2")).toEqual({ method: "seedvr2", modelPath: "C:/weights/seedvr2_3b_fp16.safetensors", vaePath: "C:/weights/seedvr2_ema_vae_fp16.safetensors" });});-it.each(OTHER_WEIGHT_TEMPLATES)("saves local $name files and uses them for exports after refreshing downloads", async (template) => {+it.each(OTHER_WEIGHT_TEMPLATES.flatMap((template) => [false, true].map((remote) => ({ template, remote }))))("uses local $template.name files after refreshing downloads (worker: $remote)", async ({ template, remote }) => {vi.mocked(invoke).mockImplementation(async (name, args) => {if (name === "find_downloaded_weights") return Object.fromEntries(template.files.map((file) => [file.url, `C:/cache/${file.id}.safetensors`])) as never;if (name === "check_weight_files") return Object.fromEntries((args as { paths: string[] }).paths.map((path) => [path, true])) as never;return undefined as never;});- localStorage.setItem("slopus.generation-worker.v1", JSON.stringify({ id: "worker" }));+ if (remote) localStorage.setItem("slopus.generation-worker.v1", JSON.stringify({ id: "worker" }));render(<OtherWeightsSettings desktop />);fireEvent.click(screen.getByRole("button", { name: `Edit ${template.name} weights` }));for (const file of template.files) {@@ -61,7 +62,19 @@ it.each(OTHER_WEIGHT_TEMPLATES)("saves local $name files and uses them for exporawait waitFor(() => expect(screen.queryByRole("dialog")).toBeNull());expect(localOtherWeightPaths()).toEqual({});expect(otherWeightPaths()[template.files[0].url]).toBe("C:/cache/model.safetensors");- if (template.id === "seedvr2") expect(upscaleConfig("seedvr2")).toMatchObject({ modelPath: "", vaePath: undefined });+ if (template.id === "seedvr2") expect(upscaleConfig("seedvr2")).toMatchObject(remote+ ? { modelPath: "", vaePath: undefined } : { modelPath: "C:/cache/model.safetensors", vaePath: "C:/cache/vae.safetensors" });+});++it("allows worker SeedVR2 downloads without local weights but requires both weights locally", () => {+ localStorage.setItem("slopus.generation-worker.v1", JSON.stringify({ id: "worker" }));+ expect(upscaleConfig("seedvr2")).toEqual({ method: "seedvr2", modelPath: "", vaePath: undefined });+ localStorage.removeItem("slopus.generation-worker.v1");+ const [model, vae] = OTHER_WEIGHT_TEMPLATES[1].files;+ localStorage.setItem("slopus.other-weights.v1", JSON.stringify({ [model.url]: "C:/model.safetensors" }));+ expect(() => upscaleConfig("seedvr2")).toThrow("Download SeedVR2");+ localStorage.setItem("slopus.other-weights.v1", JSON.stringify({ [vae.url]: "C:/vae.safetensors" }));+ expect(() => upscaleConfig("seedvr2")).toThrow("Download SeedVR2");});it("rejects relative paths and missing files without saving them", async () => {diff --git a/src/components/OtherWeightsSettings.tsx b/src/components/OtherWeightsSettings.tsxindex ad6d5ad..4248c3b 100644--- a/src/components/OtherWeightsSettings.tsx+++ b/src/components/OtherWeightsSettings.tsx@@ -81,7 +81,7 @@ function OtherWeightEditor({ template, desktop, busy, onDone }: {onChange={(event) => setPaths({ ...paths, [file.url]: event.target.value })} placeholder="Absolute path to a .safetensors file" /><button className="secondary-button" type="button" disabled={!desktop} aria-label={`Browse for ${file.name}`} onClick={() => void browse(file)}>Browse…</button></span></label>)}- {template.id === "seedvr2" && <p>Local files are sent to the selected worker for upscaling. The worker downloads any weights without a local path.</p>}+ {template.id === "seedvr2" && <p>SeedVR2 runs locally or on the selected worker. Workers receive local files and download any weights without a local path.</p>}{error && <InfoBar severity="error" message={error} />}</fieldset></ContentDialog>;diff --git a/src/components/workspace/ExportView.test.tsx b/src/components/workspace/ExportView.test.tsxindex 8f045bc..e739552 100644--- a/src/components/workspace/ExportView.test.tsx+++ b/src/components/workspace/ExportView.test.tsx@@ -97,6 +97,7 @@ describe("the export view where nothing can encode", () => {expect(optionNames(upscaler)).toEqual(["None", "Real-ESRGAN", "SeedVR2"]);chooseOption(upscaler, "SeedVR2");expect(upscaler.textContent).toContain("SeedVR2");+ expect(screen.queryByText(/Select a worker.*SeedVR2/)).toBeNull();});});diff --git a/src/components/workspace/ExportView.tsx b/src/components/workspace/ExportView.tsxindex 052e9f9..ff88018 100644--- a/src/components/workspace/ExportView.tsx+++ b/src/components/workspace/ExportView.tsx@@ -42,7 +42,6 @@ import { formatTimecode, frameAt, frameStartMs } from "../../lib/timeline";import { ProgramMonitor } from "./ProgramMonitor";import { ProjectStatus } from "./ProjectStatus";import { UPSCALERS, type Upscaler } from "../../lib/upscalers";-import { remoteWorkerSelected } from "../../lib/workers";import type { ProjectConfig } from "../../lib/project";import { ComboBox, InfoBar, ProgressBar, PropRow, PropSection, Slider, Splitter, tooltipProps, usePaneSize } from "../ui";@@ -222,7 +221,6 @@ export function ExportView({ config, folderPath, onClose }: {const codecProbe = probes?.find((probe) => probe.id === settings.codec) ?? null;const blockers = [...plan.blockers];- if (settings.upscaler === "seedvr2" && !remoteWorkerSelected()) blockers.push("Select a worker in Settings → Workers to use SeedVR2 upscaling.");if (!support.desktop) {blockers.push("This is the browser preview. There is no project folder to read media from and nowhere on disk to write a file, so exporting is only available in the Slopus desktop app.",diff --git a/src/lib/exportPipeline.ts b/src/lib/exportPipeline.tsindex e54eeeb..5fb06c6 100644--- a/src/lib/exportPipeline.ts+++ b/src/lib/exportPipeline.ts@@ -1365,7 +1365,7 @@ export async function runExport(options: ExportRunOptions): Promise<ExportResulttry {encoder.configure(encoderConfig(probe.codecString, plan, bitrate));if (upscale) {- report("preparing", 0, upscale.method === "seedvr2" ? "Preparing SeedVR2 on worker…" : "Loading upscaler weights…");+ report("preparing", 0, upscale.method === "seedvr2" ? "Preparing SeedVR2…" : "Loading upscaler weights…");upscaler = await startUpscaleExport({ config: upscale, inputWidth: renderWidth, inputHeight: renderHeight,width: plan.width, height: plan.height, frameRate: plan.frameRate, frameCount: plan.frameCount, cancelled,output: async (frame, index) => {diff --git a/src/lib/upscalers.ts b/src/lib/upscalers.tsindex ece7698..6535806 100644--- a/src/lib/upscalers.ts+++ b/src/lib/upscalers.ts@@ -50,8 +50,7 @@ export function subscribeOtherWeights(listener: () => void) {export interface UpscaleConfig { method: Exclude<Upscaler, "none">; modelPath: string; vaePath?: string }export function upscaleConfig(method: Upscaler): UpscaleConfig | undefined {if (method === "none") return undefined;- if (method === "seedvr2") {- if (!selectedWorker()) throw new Error("Select a worker in Settings → Workers to use SeedVR2 upscaling.");+ if (method === "seedvr2" && selectedWorker()) {const local = localOtherWeightPaths();return { method, modelPath: local[OTHER_WEIGHT_TEMPLATES[1].files[0].url] ?? "",vaePath: local[OTHER_WEIGHT_TEMPLATES[1].files[1].url] };@@ -59,7 +58,8 @@ export function upscaleConfig(method: Upscaler): UpscaleConfig | undefined {const template = OTHER_WEIGHT_TEMPLATES.find((item) => item.id === method)!;const paths = otherWeightPaths();if (template.files.some((file) => !paths[file.url])) throw new Error(`Download ${template.name} or choose a local weight file in Settings → Generator → Other weights first.`);- return { method, modelPath: paths[template.files[0].url] };+ return { method, modelPath: paths[template.files[0].url],+ ...(template.id === "seedvr2" ? { vaePath: paths[template.files[1].url] } : {}) };}export async function refreshOtherWeights() {if (!isTauri()) return;