AI media harness for planning, generating, and editing locally
TypeScript
Add Singularity generator template
Bittiaaaf4def9088
diff --git a/docs/generator-weights.md b/docs/generator-weights.mdindex f9e9d83..6b684dc 100644--- a/docs/generator-weights.md+++ b/docs/generator-weights.md@@ -34,17 +34,20 @@ are injected into runtime requests and are not saved into portable project filesIn Settings → Generator, edit a template and enter local paths or HTTP/HTTPSdownload URLs. Hugging Face `blob` links are converted to direct file downloads.The bundled **First/Last Frame** (formerly **Minimax H3 Original**),-**References**, and **First/Last Frame Fast** templates each download four model files. References has the same+**References**, **First/Last Frame Fast**, and **Singularity** templates each download four model files. References has the samesettings, with the `minimax_h3_ref2va_pruned_int8_convrot.safetensors` transformerin place of the First/Last Frame `minimax_h3_fl2va_pruned_int8_convrot.safetensors`.First/Last Frame Fast uses `minimax_h3_fl2va_fasth3_dense_pruned_int8_convrot.safetensors`-and defaults to **6 steps**; its other settings are identical. The other two-templates default to 20 steps.-All three text encoder downloads use the original Qwen3-VL 32B encoder on all GPUs.+and defaults to **6 steps**; its other settings are identical. First/Last Frame and+References default to 20 steps.+Singularity defaults to **4 steps** and uses+[Minimax-h3_Singularity_ref2va_Pruned_v1.3_int8.safetensors](https://huggingface.co/WarmBloodAban/Minimax-h3_Singularity/blob/main/Minimax-h3_Singularity_ref2va_Pruned_v1.3_int8.safetensors)+on all GPUs, with the same text encoder and VAEs as First/Last Frame.+All four text encoder downloads use the original Qwen3-VL 32B encoder on all GPUs.The incompatible 4B INT4 ConvRot option is removed from saved Minimax templates;templates using its downloaded file switch back to the original encoder, whichmay need downloading. The old file is left on disk.-All three templates use the hybrid W4A8 transformer at 20 GB or less+First/Last Frame, References, and First/Last Frame Fast use the hybrid W4A8 transformer at 20 GB or lessand their respective INT8 transformer above 20 GB; unknown hardware uses the W4A8 fallback.Other local weights and customized download variants are preserved.diff --git a/src/lib/settings.test.ts b/src/lib/settings.test.tsindex da42e67..aa97a9c 100644--- a/src/lib/settings.test.ts+++ b/src/lib/settings.test.ts@@ -14,6 +14,7 @@ import {minimaxOriginalTemplate,minimaxReferencesTemplate,minimaxFastTemplate,+ minimaxSingularityTemplate,templateNeedsDownload,saveAgentEndpointSettings,saveGeneratorTemplateSettings,@@ -26,7 +27,7 @@ describe("generator templates", () => {localStorage.setItem("slopus.engine-paths.v1", JSON.stringify({ transformer: "D:\\Models\\main.safetensors" }));const settings = loadGeneratorTemplateSettings();expect(settings.defaultTemplateId).toBe("default");- expect(settings.templates).toHaveLength(4);+ expect(settings.templates).toHaveLength(5);expect(settings.templates[1].name).toBe("First/Last Frame");expect(settings.templates[0]).toMatchObject({id: "default",@@ -55,7 +56,7 @@ describe("generator templates", () => {paths: { ...original.paths, transformer },sources: { ...original.sources, transformer: [{ ...original.sources!.transformer![0], url: transformer }, original.sources!.transformer![1]] },});- expect(loadGeneratorTemplateSettings().templates.map(({ name }) => name)).toEqual(["Default", "First/Last Frame", "References", "First/Last Frame Fast"]);+ expect(loadGeneratorTemplateSettings().templates.map(({ name }) => name)).toEqual(["Default", "First/Last Frame", "References", "First/Last Frame Fast", "Singularity"]);});it.each(["Minimax H3 Original", "My custom generator"])("migrates the saved %s template without changing its configuration", (name) => {@@ -70,8 +71,9 @@ describe("generator templates", () => {expect(settings.templates[0]).toEqual({ ...template, name: name === "Minimax H3 Original" ? "First/Last Frame" : name });expect(settings.templates[1]).toEqual(minimaxReferencesTemplate());expect(settings.templates[2]).toEqual(minimaxFastTemplate());+ expect(settings.templates[3]).toEqual(minimaxSingularityTemplate());expect(settings.defaultTemplateId).toBe(template.id);- expect(settings.catalogVersion).toBe(4);+ expect(settings.catalogVersion).toBe(5);expect(loadGeneratorTemplateSettings()).toEqual(settings);saveGeneratorTemplateSettings({ ...settings, templates: [settings.templates[0]] });expect(loadGeneratorTemplateSettings().templates).toHaveLength(1);@@ -81,7 +83,29 @@ describe("generator templates", () => {const references = minimaxReferencesTemplate();references.paths.transformer = "D:/Models/custom.safetensors";localStorage.setItem("slopus.generator-templates.v1", JSON.stringify({ templates: [references], catalogVersion: 3 }));- expect(loadGeneratorTemplateSettings().templates).toEqual([references, minimaxFastTemplate()]);+ expect(loadGeneratorTemplateSettings().templates).toEqual([references, minimaxFastTemplate(), minimaxSingularityTemplate()]);+ });++ it("adds Singularity to the previous catalog once while preserving saved templates", () => {+ const custom = createGeneratorTemplate("My generator");+ custom.defaultSteps = 12;+ custom.paths.transformer = "D:/Models/custom.safetensors";+ localStorage.setItem("slopus.generator-templates.v1", JSON.stringify({ templates: [custom], defaultTemplateId: custom.id, catalogVersion: 4 }));+ const settings = loadGeneratorTemplateSettings();+ expect(settings.templates).toEqual([expect.objectContaining(custom), minimaxSingularityTemplate()]);+ expect(settings.defaultTemplateId).toBe(custom.id);+ expect(settings.catalogVersion).toBe(5);+ expect(loadGeneratorTemplateSettings()).toEqual(settings);+ saveGeneratorTemplateSettings({ ...settings, templates: [custom] });+ expect(loadGeneratorTemplateSettings().templates).toEqual([expect.objectContaining(custom)]);+ });++ it("preserves a customized Singularity during catalog migration", () => {+ const template = minimaxSingularityTemplate();+ template.defaultSteps = 8;+ template.paths.transformer = "D:/Models/singularity.safetensors";+ localStorage.setItem("slopus.generator-templates.v1", JSON.stringify({ templates: [template], catalogVersion: 4 }));+ expect(loadGeneratorTemplateSettings().templates).toEqual([template]);});it("adds First/Last Frame Fast with six steps and its transformer URL", () => {@@ -103,7 +127,7 @@ describe("generator templates", () => {template.paths[field] = downloadedPath;localStorage.setItem("slopus.generator-templates.v1", JSON.stringify({ templates: [template], catalogVersion: 1 }));const settings = loadGeneratorTemplateSettings();- expect(settings.catalogVersion).toBe(4);+ expect(settings.catalogVersion).toBe(5);expect(settings.templates[0].paths[field]).toBe(downloadedPath);expect(settings.templates[0].sources![field]).toEqual(minimaxOriginalTemplate().sources![field]!.map((source, index) =>index === 0 ? { ...source, downloadedPath } : source));@@ -118,7 +142,7 @@ describe("generator templates", () => {expect(loadGeneratorTemplateSettings().templates[0].sources![field]).toEqual(template.sources![field]);const custom = createGeneratorTemplate();localStorage.setItem("slopus.generator-templates.v1", JSON.stringify({ templates: [custom], catalogVersion: 1 }));- expect(loadGeneratorTemplateSettings().templates.map(({ id }) => id)).toEqual([custom.id, "minimax-h3-references", "minimax-h3-fast"]);+ expect(loadGeneratorTemplateSettings().templates.map(({ id }) => id)).toEqual([custom.id, "minimax-h3-references", "minimax-h3-fast", "minimax-h3-singularity"]);});it.each(["url", "downloaded", "original", "custom", "cached original"])("removes the incompatible encoder from saved templates using %s", (selection) => {@@ -138,7 +162,7 @@ describe("generator templates", () => {localStorage.setItem("slopus.generator-templates.v1", JSON.stringify({ templates: [template], defaultTemplateId: template.id, catalogVersion: 2 }));const settings = loadGeneratorTemplateSettings();const migrated = settings.templates[0];- expect(settings.catalogVersion).toBe(4);+ expect(settings.catalogVersion).toBe(5);expect(migrated.sources!.textEncoder).toEqual([{ url: originalUrl, gpuModel: "", minVramGb: 0, ...(selection === "cached original" ? { downloadedPath: cachedOriginal } : {}) },custom,diff --git a/src/lib/settings.ts b/src/lib/settings.tsindex 232a25d..f70bf8c 100644--- a/src/lib/settings.ts+++ b/src/lib/settings.ts@@ -186,10 +186,19 @@ export function minimaxFastTemplate(): GeneratorTemplate {"https://huggingface.co/datasets/jacokon/fasth3-live/resolve/main/minimax_h3_fl2va_fasth3_dense_pruned_int8_convrot.safetensors", 6);}+export function minimaxSingularityTemplate(): GeneratorTemplate {+ const template = minimaxOriginalTemplate();+ const transformer = "https://huggingface.co/WarmBloodAban/Minimax-h3_Singularity/blob/main/Minimax-h3_Singularity_ref2va_Pruned_v1.3_int8.safetensors";+ return { ...template, id: "minimax-h3-singularity", name: "Singularity", defaultSteps: 4,+ paths: { ...template.paths, transformer },+ sources: { ...template.sources, transformer: [{ url: transformer, gpuModel: "", minVramGb: 0 }] },+ };+}+const initialTemplateSettings = (paths = EMPTY_ENGINE_SETTINGS): GeneratorTemplateSettings => ({- templates: [{ id: "default", name: "Default", defaultSteps: DEFAULT_GENERATION_STEPS, attention: "sage2", paths: copyPaths(paths) }, minimaxOriginalTemplate(), minimaxReferencesTemplate(), minimaxFastTemplate()],+ templates: [{ id: "default", name: "Default", defaultSteps: DEFAULT_GENERATION_STEPS, attention: "sage2", paths: copyPaths(paths) }, minimaxOriginalTemplate(), minimaxReferencesTemplate(), minimaxFastTemplate(), minimaxSingularityTemplate()],defaultTemplateId: "default",- catalogVersion: 4,+ catalogVersion: 5,});const normalizeTemplateSettings = (value: unknown): GeneratorTemplateSettings | null => {@@ -235,7 +244,7 @@ const normalizeTemplateSettings = (value: unknown): GeneratorTemplateSettings |templates,defaultTemplateId: templates.find((template) => template.id === requestedDefault && !templateNeedsDownload(template))?.id?? templates.find((template) => !templateNeedsDownload(template))?.id ?? "",- catalogVersion: typeof record.catalogVersion === "number" && [1, 2, 3, 4].includes(record.catalogVersion) ? record.catalogVersion : 0,+ catalogVersion: typeof record.catalogVersion === "number" && [1, 2, 3, 4, 5].includes(record.catalogVersion) ? record.catalogVersion : 0,};};@@ -293,6 +302,11 @@ export function loadGeneratorTemplateSettings(): GeneratorTemplateSettings {if (!normalized.templates.some(({ id }) => id === template.id)) normalized.templates.push(template);}normalized.catalogVersion = 4;+ }+ if ((normalized.catalogVersion ?? 0) < 5) {+ const template = minimaxSingularityTemplate();+ if (!normalized.templates.some(({ id }) => id === template.id)) normalized.templates.push(template);+ normalized.catalogVersion = 5;localStorage.setItem(GENERATOR_TEMPLATES_KEY, JSON.stringify(normalized));}return normalized;diff --git a/src/lib/weightDownloads.test.ts b/src/lib/weightDownloads.test.tsindex 34e3e72..c7b9be9 100644--- a/src/lib/weightDownloads.test.ts+++ b/src/lib/weightDownloads.test.ts@@ -134,6 +134,26 @@ it("downloads the fast transformer and retains its six-step default", async () =expect(templateNeedsDownload(template)).toBe(false);});+it.each([0, 12, 20, 32])("downloads Singularity with four steps and the shared weights for %s GiB of VRAM", async (vram) => {+ const original = vi.mocked(invoke).getMockImplementation()!;+ vi.mocked(invoke).mockImplementation(async (command, args) => command === "weight_download_hardware"+ ? (vram ? [{ name: "GPU", memoryBytes: vram * 1024 ** 3 }] : []) : original(command, args));+ await downloadTemplateWeights("minimax-h3-singularity");+ expect(getWeightDownloadState()).toMatchObject({ active: false, completed: 4, error: null });+ expect(invoke).toHaveBeenCalledWith("download_weight", expect.objectContaining({+ url: "https://huggingface.co/WarmBloodAban/Minimax-h3_Singularity/blob/main/Minimax-h3_Singularity_ref2va_Pruned_v1.3_int8.safetensors",+ }));+ for (const field of ["textEncoder", "videoVae", "audioVae"] as const) {+ expect(invoke).toHaveBeenCalledWith("download_weight", expect.objectContaining({ url: minimaxOriginalTemplate().paths[field] }));+ }+ const settings = loadGeneratorTemplateSettings();+ const template = settings.templates.find(({ id }) => id === "minimax-h3-singularity")!;+ expect(template.paths.transformer).toBe("C:/Slopus/weights/Minimax-h3_Singularity_ref2va_Pruned_v1.3_int8.safetensors");+ expect(templateNeedsDownload(template)).toBe(false);+ saveGeneratorTemplateSettings({ ...settings, defaultTemplateId: template.id });+ expect(defaultGeneratorTemplate().defaultSteps).toBe(4);+});+it("replaces a URL being typed instead of accumulating partial download sources", () => {let template = createGeneratorTemplate();for (const value of ["https://", "https://e", "https://example.com/model"]) template = updateWeightPath(template, "transformer", value);