Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: make MiniMax Music 3 installable from Music (#4414)

[._.]/ Adam Eivyfb228efde08b
diff --git a/.changelog/next/changed-windows-shell-job-spawn.md b/.changelog/next/changed-windows-shell-job-spawn.md
new file mode 100644
index 0000000000..5ce8916f02
--- /dev/null
+++ b/.changelog/next/changed-windows-shell-job-spawn.md
@@ -0,0 +1 @@
+- MiniMax Music 3 weights download skips the bundled Qwen-7B captioner and the original-format .pth checkpoints its diffusers pipeline never loads — about 29 GB instead of 57 GB
diff --git a/.changelog/next/fixed-fix-windows-shell-job-spawn-followup.md b/.changelog/next/fixed-fix-windows-shell-job-spawn-followup.md
new file mode 100644
index 0000000000..a5b3ef1de3
--- /dev/null
+++ b/.changelog/next/fixed-fix-windows-shell-job-spawn-followup.md
@@ -0,0 +1 @@
+- MiniMax Music 3 setup now offers one action that installs the runtime and then downloads its required weights after readiness is confirmed.
diff --git a/client/src/components/music/MusicGenPanel.jsx b/client/src/components/music/MusicGenPanel.jsx
index 3c3b566aad..2c7c1c53b2 100644
--- a/client/src/components/music/MusicGenPanel.jsx
+++ b/client/src/components/music/MusicGenPanel.jsx
@@ -1,15 +1,23 @@
/**
* MusicGenPanel — on-device music generation for the Track editor.
*
- * Lets the user pick a generation engine (MusicGen / AudioLDM2 / ACE-Step),
- * pick or install a model, and Generate audio from the track's prompt (+ lyrics
- * for lyric-aware engines like ACE-Step). On success the parent receives the
- * updated track (the server attaches the audio + gen metadata).
+ * Lets the user pick a generation engine (MusicGen / AudioLDM2 / ACE-Step /
+ * MiniMax Music 3), pick or install a model, and Generate audio from the track's
+ * prompt (+ lyrics for lyric-aware engines like ACE-Step and MiniMax Music 3).
+ * On success the parent receives the updated track (the server attaches the
+ * audio + gen metadata).
*
* Engines that aren't provisioned (their opt-in venv is missing) are shown with
* an in-app install action and the Generate button is gated — mirroring the FLUX.2
* venv gate in image gen. Additional HuggingFace checkpoints can be installed
* inline (streamed download), then selected immediately.
+ *
+ * A fixed-model engine (MiniMax Music 3) needs BOTH a runtime venv and a fixed
+ * weights download, and neither is useful alone. The setup banner therefore
+ * carries ONE action that installs whatever is still missing: it opens the
+ * runtime installer first when that's absent, then — once the refreshed engine
+ * list confirms the venv landed — chains straight into the weights download
+ * without the user having to find a second button.
*/
import { useEffect, useMemo, useState } from 'react';
@@ -21,18 +29,43 @@ import { formatDurationSec } from '../../utils/formatters.js';
import {
listMusicEngines, generateMusic, installAudioModel, removeAudioModel,
} from '../../services/api';
+import { formatDownloadGb } from '../../utils/formatters';
import RuntimeInstallModal from '../install/RuntimeInstallModal';
-function engineSetupMessage(engine) {
- // Host-incompatible comes first: it is the only reason that no amount of
- // installing will fix, so it must not be worded as a setup step.
- if (engine.platformSupported === false) return `${engine.name} requires ${engine.platformLabel || 'a different host'} and is unavailable on this machine.`;
- if (engine.cudaRequired && engine.cudaState === 'absent') return `${engine.name} requires an NVIDIA CUDA GPU and is unavailable on this host.`;
- if (engine.cudaRequired && engine.cudaState === 'unknown') return `${engine.name} is disabled because CUDA availability could not be determined.`;
- if (engine.runtimeReady === false && engine.fixedModelInstall && engine.modelReady === false) return `${engine.name} needs its runtime and model weights before generation.`;
- if (engine.runtimeReady === false) return `${engine.name} needs its runtime before generation.`;
- if (engine.fixedModelInstall && engine.modelReady === false) return `${engine.name} model weights are not installed yet.`;
- return `${engine.name} is not installed yet. Install the runtime to enable generation.`;
+/**
+ * What an engine still needs, the sentence explaining it, and the label for the
+ * one button that fixes it. Single derivation so the banner text and the button
+ * can't disagree, and so the handlers branch on the same flags the UI shows
+ * rather than re-deriving them.
+ *
+ * `label` is null when there's nothing to install — the engine is provisioned,
+ * or it's CUDA-only on a host with no usable NVIDIA GPU, where an install button
+ * would just be a slower way to fail.
+ */
+function engineSetupState(engine) {
+ if (!engine) return null;
+ const needsRuntime = engine.runtimeReady !== true;
+ const needsWeights = engine.fixedModelInstall === true && engine.modelReady === false;
+ const blocked = engine.platformSupported === false
+ || (engine.cudaRequired === true && engine.cudaState !== 'available');
+
+ let message;
+ if (engine.platformSupported === false) message = `${engine.name} requires ${engine.platformLabel || 'a different host'} and is unavailable on this machine.`;
+ else if (engine.cudaRequired === true && engine.cudaState === 'unknown') message = `${engine.name} is disabled because CUDA availability could not be determined.`;
+ else if (engine.cudaRequired === true && engine.cudaState !== 'available') message = `${engine.name} requires an NVIDIA CUDA GPU and is unavailable on this host.`;
+ else if (engine.runtimeReady === false && needsWeights) message = `${engine.name} needs its runtime and model weights before generation.`;
+ else if (engine.runtimeReady === false) message = `${engine.name} needs its runtime before generation.`;
+ else if (needsWeights) message = `${engine.name} model weights are not installed yet.`;
+ else message = `${engine.name} is not installed yet. Install the runtime to enable generation.`;
+
+ const size = formatDownloadGb(engine.modelSizeGb);
+ const suffix = size ? ` (${size})` : '';
+ let label = null;
+ if (!blocked && needsRuntime && needsWeights) label = `Install runtime + weights${suffix}`;
+ else if (!blocked && needsRuntime) label = 'Install runtime';
+ else if (!blocked && needsWeights) label = `Download model weights${suffix}`;
+
+ return { needsRuntime, needsWeights, blocked, message, label };
}
function supportsAutoDuration(engine) {
@@ -55,13 +88,20 @@ export default function MusicGenPanel({ track, title = '', artistId = '', artist
const [installRepo, setInstallRepo] = useState('');
const [installing, setInstalling] = useState(false);
const [installProgress, setInstallProgress] = useState(null);
+ // Progress for the setup action (runtime/fixed weights), rendered under the
+ // setup banner. Kept apart from `installProgress`, which belongs to the
+ // custom-HuggingFace-repo field further down.
+ const [setupProgress, setSetupProgress] = useState(null);
const [runtimeInstallEngine, setRuntimeInstallEngine] = useState(null);
const [userSelectedEngine, setUserSelectedEngine] = useState(false);
const mountedRef = useMounted();
+ // Returns the freshly-fetched list as well as storing it: the post-runtime
+ // chain below needs the NEW engine record, and reading `engine` off state
+ // right after setEngines() would still see the pre-install one.
const loadEngines = async () => {
const data = await listMusicEngines({ silent: true }).catch(() => null);
- if (!mountedRef.current) return;
+ if (!mountedRef.current) return [];
const list = Array.isArray(data?.engines) ? data.engines : [];
setEngines(list);
setLoading(false);
@@ -71,6 +111,7 @@ export default function MusicGenPanel({ track, title = '', artistId = '', artist
const pick = ready || list.find((e) => e.id === data.defaultEngine) || list[0];
setEngineId(pick.id);
}
+ return list;
};
useEffect(() => { loadEngines(); }, []);
@@ -126,25 +167,51 @@ export default function MusicGenPanel({ track, title = '', artistId = '', artist
}, [engine?.id, engine?.models]);
const canGenerate = !!engine?.ready && !!prompt?.trim() && !generating;
+ const setup = engineSetupState(engine);
- const handleFixedModelInstall = async () => {
- const model = engine?.models?.find((item) => item.id === engine.defaultModelId) || engine?.models?.[0];
- if (!engine || !model?.repo) return;
+ // `target` is the engine record to install for — passed explicitly by the
+ // post-runtime chain, which holds a fresher record than component state does.
+ const installFixedModel = async (target) => {
+ const eng = target || engine;
+ const model = eng?.models?.find((item) => item.id === eng.defaultModelId) || eng?.models?.[0];
+ if (!eng || !model?.repo) return;
setInstalling(true);
- setInstallProgress({ message: `Starting ${model.name}…` });
+ setSetupProgress({ message: `Starting ${model.name}…` });
let failed = false;
- await installAudioModel({ engine: engine.id, repo: model.repo }, (ev) => {
+ await installAudioModel({ engine: eng.id, repo: model.repo }, (ev) => {
if (!mountedRef.current) return;
- if (ev.type === 'progress') setInstallProgress({ message: `${ev.file || 'downloading'} — ${Math.round((ev.progress || 0) * 100)}%`, progress: ev.progress });
- else if (ev.type === 'stage') setInstallProgress({ message: ev.stage });
+ if (ev.type === 'progress') setSetupProgress({ message: `${ev.file || 'downloading'} — ${Math.round((ev.progress || 0) * 100)}%`, progress: ev.progress });
+ else if (ev.type === 'stage') setSetupProgress({ message: ev.stage });
else if (ev.type === 'error') { failed = true; toast.error(ev.message || 'Download failed'); }
}).catch((err) => { failed = true; if (mountedRef.current) toast.error(err.message || 'Install failed'); });
if (!mountedRef.current) return;
setInstalling(false);
- setInstallProgress(null);
+ setSetupProgress(null);
if (!failed) { await loadEngines(); toast.success(`${model.name} installed`); }
};
+ // The banner's one setup action. Runtime first when it's missing — weights are
+ // useless without an interpreter to load them — otherwise straight to weights.
+ const handleSetupInstall = async () => {
+ if (!setup || setup.blocked) return;
+ if (setup.needsRuntime) { setRuntimeInstallEngine(engine); return; }
+ await installFixedModel(engine);
+ };
+
+ // Runtime installer closed: refresh, then continue into the weights — but only
+ // once the refreshed record shows the venv actually landed, so a cancelled or
+ // failed runtime install can't kick off a multi-GB pull with nothing to run it.
+ const handleRuntimeInstallClose = async () => {
+ setRuntimeInstallEngine(null);
+ const list = await loadEngines();
+ if (!mountedRef.current) return;
+ const fresh = list.find((e) => e.id === engineId);
+ const freshSetup = engineSetupState(fresh);
+ if (freshSetup && !freshSetup.blocked && !freshSetup.needsRuntime && freshSetup.needsWeights) {
+ await installFixedModel(fresh);
+ }
+ };
+
const handleGenerate = async () => {
if (!engine) return;
if (!prompt?.trim()) { toast.error('Add a generation prompt first'); return; }
@@ -210,9 +277,6 @@ export default function MusicGenPanel({ track, title = '', artistId = '', artist
const selectedUserModel = engine?.models?.find((m) => m.id === modelId && m.userAdded);
const showRuntimeInstallHint = !!engine && !engine.ready && (!!prompt?.trim() || userSelectedEngine);
- const canInstallRuntime = engine?.runtimeReady !== true
- && engine?.platformSupported !== false
- && (!engine?.cudaRequired || engine?.cudaState === 'available');
return (
<div className="space-y-2 border border-port-border rounded-lg p-3 bg-port-bg/40">
@@ -316,26 +380,22 @@ export default function MusicGenPanel({ track, title = '', artistId = '', artist
{showRuntimeInstallHint ? (
<div className="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 rounded-lg border border-port-warning/30 bg-port-warning/10 px-3 py-2">
<p className="text-[11px] text-port-warning">
- {engineSetupMessage(engine)}
+ {setup.message}
</p>
- {canInstallRuntime ? <button
+ {setup.label ? <button
type="button"
- onClick={() => setRuntimeInstallEngine(engine)}
- className="inline-flex items-center justify-center gap-2 px-3 py-1.5 rounded-lg bg-port-bg border border-port-warning/50 text-port-warning text-xs font-medium hover:border-port-warning disabled:opacity-50"
+ onClick={handleSetupInstall}
+ disabled={installing}
+ className="inline-flex items-center justify-center gap-2 whitespace-nowrap px-3 py-1.5 rounded-lg bg-port-bg border border-port-warning/50 text-port-warning text-xs font-medium hover:border-port-warning disabled:opacity-50"
>
- <Download size={13} />
- Install runtime
+ {installing ? <Loader2 size={13} className="animate-spin" /> : <Download size={13} />}
+ {setup.label}
</button>
: null}
</div>
) : null}
- {engine?.fixedModelInstall && !engine.modelReady && engine.platformSupported !== false && engine.cudaState === 'available' ? (
- <div className="rounded-lg border border-port-border px-3 py-2">
- <button type="button" onClick={handleFixedModelInstall} disabled={installing} className="inline-flex items-center gap-2 text-xs text-port-accent disabled:opacity-50">
- {installing ? <Loader2 size={13} className="animate-spin" /> : <Download size={13} />} Install model
- </button>
- {installProgress ? <p className="mt-1 truncate text-[11px] text-gray-500">{installProgress.message}</p> : null}
- </div>
+ {setupProgress ? (
+ <p className="truncate text-[11px] text-gray-500">{setupProgress.message}</p>
) : null}
{engine?.lyrics ? (
<p className="text-[11px] text-gray-500">This engine uses the track’s lyrics as conditioning.</p>
@@ -418,8 +478,7 @@ export default function MusicGenPanel({ track, title = '', artistId = '', artist
label={runtimeInstallEngine?.name}
installUrlBase="/api/music/setup/runtime-install"
description="Installing the music runtime and python packages. Large downloads may take several minutes."
- onClose={() => setRuntimeInstallEngine(null)}
- onComplete={() => loadEngines()}
+ onClose={handleRuntimeInstallClose}
/>
</div>
);
diff --git a/client/src/components/music/MusicGenPanel.test.jsx b/client/src/components/music/MusicGenPanel.test.jsx
index e4ea9a8f5a..855ee8fa75 100644
--- a/client/src/components/music/MusicGenPanel.test.jsx
+++ b/client/src/components/music/MusicGenPanel.test.jsx
@@ -12,7 +12,12 @@ vi.mock('../../services/api', () => ({
}));
vi.mock('../install/RuntimeInstallModal', () => ({
- default: ({ open, label }) => (open ? <div>Installing {label}</div> : null),
+ default: ({ open, label, onClose }) => (open ? (
+ <div>
+ Installing {label}
+ <button type="button" onClick={onClose}>close installer</button>
+ </div>
+ ) : null),
}));
const engine = (overrides) => ({
@@ -29,6 +34,26 @@ const engine = (overrides) => ({
...overrides,
});
+// MiniMax Music 3 as the server reports it: CUDA-only, one fixed checkpoint,
+// and a runtime venv installed separately from the weights.
+const minimax = (overrides) => engine({
+ id: 'minimax-music3',
+ name: 'MiniMax Music 3 (CUDA only)',
+ models: [{ id: 'minimax-music3', repo: 'MiniMaxAI/MiniMax-Music3', name: 'MiniMax Music 3' }],
+ defaultModelId: 'minimax-music3',
+ maxDurationSec: 300,
+ defaultDurationSec: 60,
+ lyrics: true,
+ customModels: false,
+ fixedModelInstall: true,
+ modelReady: false,
+ modelSizeGb: 29,
+ cudaRequired: true,
+ cudaState: 'available',
+ ready: false,
+ ...overrides,
+});
+
describe('MusicGenPanel', () => {
beforeEach(() => {
vi.clearAllMocks();
@@ -128,8 +153,8 @@ describe('MusicGenPanel', () => {
render(<MusicGenPanel track={{ id: 'track-1' }} prompt="cinematic score" lyrics="Example lyrics" />);
expect(await screen.findByText(/requires an NVIDIA CUDA GPU/i)).toBeInTheDocument();
- expect(screen.queryByRole('button', { name: /install runtime/i })).not.toBeInTheDocument();
- expect(screen.queryByRole('button', { name: /install model/i })).not.toBeInTheDocument();
+ expect(screen.queryByRole('button', { name: /install/i })).not.toBeInTheDocument();
+ expect(screen.queryByRole('button', { name: /download model weights/i })).not.toBeInTheDocument();
});
it('generates an unsaved standalone track without requiring a title or associations', async () => {
@@ -272,20 +297,63 @@ describe('MusicGenPanel', () => {
it('offers the fixed-model install without suggesting a runtime reinstall', async () => {
api.listMusicEngines.mockResolvedValue({
defaultEngine: 'minimax-music3',
- engines: [engine({
- id: 'minimax-music3', name: 'MiniMax Music 3 (CUDA only)', ready: false,
- runtimeReady: true, modelReady: false, fixedModelInstall: true,
- cudaRequired: true, cudaState: 'available', customModels: false,
- models: [{ id: 'minimax-music3', repo: 'MiniMaxAI/MiniMax-Music3', name: 'MiniMax Music 3' }],
- defaultModelId: 'minimax-music3',
- })],
+ engines: [minimax({ runtimeReady: true })],
});
+ api.installAudioModel.mockResolvedValue({});
render(<MusicGenPanel prompt="cinematic score" lyrics="" />);
expect(await screen.findByText(/model weights are not installed yet/i)).toBeInTheDocument();
- expect(screen.getByRole('button', { name: /install model/i })).toBeInTheDocument();
+ // Runtime is already there, so the one action is the weights pull — sized,
+ // because the user is about to spend 29 GB of disk on it.
+ const install = screen.getByRole('button', { name: /download model weights \(~29 GB\)/i });
expect(screen.queryByRole('button', { name: /install runtime/i })).not.toBeInTheDocument();
+
+ fireEvent.click(install);
+ await waitFor(() => expect(api.installAudioModel).toHaveBeenCalledWith(
+ { engine: 'minimax-music3', repo: 'MiniMaxAI/MiniMax-Music3' },
+ expect.any(Function),
+ ));
+ });
+
+ // Runtime and weights are separate installs, but a user who picks MiniMax
+ // wants the engine, not a two-step scavenger hunt: the missing-runtime state
+ // used to offer "Install runtime" and leave the weights to a second button
+ // elsewhere in the panel.
+ it('installs runtime and weights from one action when both are missing', async () => {
+ api.listMusicEngines
+ .mockResolvedValueOnce({ defaultEngine: 'minimax-music3', engines: [minimax({ runtimeReady: false })] })
+ .mockResolvedValue({ defaultEngine: 'minimax-music3', engines: [minimax({ runtimeReady: true })] });
+ api.installAudioModel.mockResolvedValue({});
+
+ render(<MusicGenPanel prompt="cinematic score" lyrics="" />);
+
+ fireEvent.click(await screen.findByRole('button', { name: /install runtime \+ weights \(~29 GB\)/i }));
+ expect(await screen.findByText(/Installing MiniMax Music 3/i)).toBeInTheDocument();
+ expect(api.installAudioModel).not.toHaveBeenCalled(); // weights wait for the venv
+
+ fireEvent.click(screen.getByRole('button', { name: /close installer/i }));
+ await waitFor(() => expect(api.installAudioModel).toHaveBeenCalledWith(
+ { engine: 'minimax-music3', repo: 'MiniMaxAI/MiniMax-Music3' },
+ expect.any(Function),
+ ));
+ });
+
+ // A cancelled or failed runtime install must not start a 29 GB download that
+ // has no interpreter to load it.
+ it('does not chain into the weights download when the runtime install did not land', async () => {
+ api.listMusicEngines.mockResolvedValue({
+ defaultEngine: 'minimax-music3',
+ engines: [minimax({ runtimeReady: false })],
+ });
+
+ render(<MusicGenPanel prompt="cinematic score" lyrics="" />);
+
+ fireEvent.click(await screen.findByRole('button', { name: /install runtime \+ weights/i }));
+ fireEvent.click(await screen.findByRole('button', { name: /close installer/i }));
+
+ await waitFor(() => expect(api.listMusicEngines).toHaveBeenCalledTimes(2));
+ expect(api.installAudioModel).not.toHaveBeenCalled();
});
it('shows honest elapsed GPU feedback while MiniMax generation is running', async () => {
diff --git a/client/src/components/videoGen/ModelDisclosure.jsx b/client/src/components/videoGen/ModelDisclosure.jsx
index 6efec1d15f..2e6999a39b 100644
--- a/client/src/components/videoGen/ModelDisclosure.jsx
+++ b/client/src/components/videoGen/ModelDisclosure.jsx
@@ -18,13 +18,10 @@
// acknowledgement.
import { Server, Cloud } from 'lucide-react';
import FactLink from './FactLink.jsx';
+import { formatDownloadGb } from '../../utils/formatters';
const UNKNOWN = 'Unknown';
-// Compact GB rendering — `estimatedDownloadGb` is decimal GB (10^9 bytes),
-// measured from the pinned repository snapshot on HuggingFace.
-const formatGb = (gb) => (typeof gb === 'number' && gb > 0 ? `~${gb} GB` : null);
-
function Fact({ label, children }) {
return (
<div className="min-w-0">
@@ -100,7 +97,7 @@ export default function ModelDisclosure({
<span aria-hidden="true">·</span>
<span>Weights license: {disclosure?.weightsLicense?.name || UNKNOWN}</span>
<span aria-hidden="true">·</span>
- <span>Download: {formatGb(disclosure?.estimatedDownloadGb) || UNKNOWN}</span>
+ <span>Download: {formatDownloadGb(disclosure?.estimatedDownloadGb) || UNKNOWN}</span>
</>
)}
<span className="text-gray-500 underline">Details</span>
@@ -141,7 +138,7 @@ export default function ModelDisclosure({
Excludes {model.termsGate.excludedTerritories.join(', ')}
</Fact>
)}
- <Fact label="Estimated download">{formatGb(disclosure?.estimatedDownloadGb)}</Fact>
+ <Fact label="Estimated download">{formatDownloadGb(disclosure?.estimatedDownloadGb)}</Fact>
<MemoryFact model={model} systemMemoryGb={systemMemoryGb} />
<Fact label="Supported modes">{modes}</Fact>
<Fact label="Runtime">{model?.runtime || null}</Fact>
diff --git a/client/src/utils/README.md b/client/src/utils/README.md
index 08f51cb04f..a295c8407a 100644
--- a/client/src/utils/README.md
+++ b/client/src/utils/README.md
@@ -22,7 +22,7 @@ grep -i "what you want to do" client/src/utils/README.md
| Module | Purpose |
|---|---|
-| `formatters` | Date/time/duration/byte/word formatters (`clamp`, `formatBytes`, `formatCompactCount`, `timeAgo`, `formatTimecode`, `formatDurationMs`, `formatDateShort`, `parseTimeoutMs`, `formatCooldown`, `recommendedRamGb`, `nameFromImageFilename`, `formatUsd` — one USD renderer (`signed` puts the minus outside the `$`; `trimWhole` drops `.00` on a typed round price) — `formatWeight` / `formatPercent` — round unit-converted floats (`170.35000000000002` → `170.4 lbs`) so raw binary precision never reaches a tile — `middleTruncate` — clip a long string from the MIDDLE so its distinguishing tail survives, where CSS `line-clamp`/`text-overflow` always eats the end — …) plus timeout-input bounds and `getAppName`. Do not re-define formatters inside components. **Never write `new Date(x).toLocaleDateString()` inline** — pick the helper for the shape you want: `formatDateNumeric` ("3/5/2026", compact cells), `formatDateShort` ("Mar 5, 2026"), `formatDate` ("March 5, 2026"), `formatDateFull` ("Saturday, March 5, 2026"), `formatWeekdayDate` ("Monday, Mar 5", `{ weekday, year }`), `formatMonthDay` ("Mar 5"), `formatMonthYear` ("March 2026"), `formatWeekdayShort` ("Mon"), `formatWeekdayTime` ("Mon, 7:00 AM"), `formatTimeOfDay` ("1:30 PM"), `formatTimeOfDaySeconds` ("1:30:45 PM", log/queue rows), `formatClockTime` ("02:30:45 PM"; `{ seconds, hour12, timeZone }`), `formatDateTime`. All of them anchor a bare `YYYY-MM-DD` at LOCAL midnight (a naive `new Date('2026-03-05')` is UTC midnight and renders as the previous day west of Greenwich) and take a fallback instead of rendering the literal "Invalid Date". |
+| `formatters` | Date/time/duration/byte/word formatters (`clamp`, `formatBytes`, `formatDownloadGb` (decimal-GB model download size, "~29 GB"), `formatCompactCount`, `timeAgo`, `formatTimecode`, `formatDurationMs`, `formatDateShort`, `parseTimeoutMs`, `formatCooldown`, `recommendedRamGb`, `nameFromImageFilename`, `formatUsd` — one USD renderer (`signed` puts the minus outside the `$`; `trimWhole` drops `.00` on a typed round price) — `formatWeight` / `formatPercent` — round unit-converted floats (`170.35000000000002` → `170.4 lbs`) so raw binary precision never reaches a tile — `middleTruncate` — clip a long string from the MIDDLE so its distinguishing tail survives, where CSS `line-clamp`/`text-overflow` always eats the end — …) plus timeout-input bounds and `getAppName`. Do not re-define formatters inside components. **Never write `new Date(x).toLocaleDateString()` inline** — pick the helper for the shape you want: `formatDateNumeric` ("3/5/2026", compact cells), `formatDateShort` ("Mar 5, 2026"), `formatDate` ("March 5, 2026"), `formatDateFull` ("Saturday, March 5, 2026"), `formatWeekdayDate` ("Monday, Mar 5", `{ weekday, year }`), `formatMonthDay` ("Mar 5"), `formatMonthYear` ("March 2026"), `formatWeekdayShort` ("Mon"), `formatWeekdayTime` ("Mon, 7:00 AM"), `formatTimeOfDay` ("1:30 PM"), `formatTimeOfDaySeconds` ("1:30:45 PM", log/queue rows), `formatClockTime` ("02:30:45 PM"; `{ seconds, hour12, timeZone }`), `formatDateTime`. All of them anchor a bare `YYYY-MM-DD` at LOCAL midnight (a naive `new Date('2026-03-05')` is UTC midnight and renders as the previous day west of Greenwich) and take a fallback instead of rendering the literal "Invalid Date". |
| `cronHelpers` | Cron preset list, `isCronExpression` detection, and `describeCron` human-readable rendering. |
| `markdownText` | `markdownToPlainText(md)` — flatten markdown source to one plain-text string for a clamped preview: strips heading/list/blockquote/fence markers, unwraps emphasis, inline code and links, images → `[alt]`, collapses blank-line runs. Use whenever a card previews arbitrary agent-authored markdown — `line-clamp-N` does not clamp a subtree of block elements, and foreign `##` headings would otherwise join the page's heading outline. Underscore emphasis is word-boundary gated and `__…__` needs interior whitespace, so stack frames and user-agent strings (`10_15_7`, `__init__`) are never silently rewritten. `dropsMarkupWhenFlattened(md)` — did the flatten lose actual markup, as opposed to only normalizing whitespace? Gates a "Show more" disclosure so a short-but-lossy body stays reachable without putting a toggle on every body that merely lost a trailing newline. |
| `timeWindow` | Time-of-day window math (`isInTimeWindow`, `timeStringToMinutes`) and morning-layout auto-switch helpers (`pickActiveLayoutId`, `recordManualLayoutPick`). |
diff --git a/client/src/utils/formatters.js b/client/src/utils/formatters.js
index 9b1f8ce4cf..1f67c8f82c 100644
--- a/client/src/utils/formatters.js
+++ b/client/src/utils/formatters.js
@@ -364,6 +364,19 @@ export function formatBytes(bytes, decimals = 1) {
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(decimals))} ${sizes[i]}`;
}
+/**
+ * Format a model's decimal-GB (10^9 bytes) download footprint as "~29 GB".
+ * Returns null for missing/zero/invalid values so callers can omit the label
+ * entirely rather than render "~undefined GB". Deliberately decimal, not the
+ * binary units `formatBytes` uses: these values come from HuggingFace repo
+ * sizes, which are quoted in decimal GB.
+ * @param {number|null|undefined} gb
+ * @returns {string|null}
+ */
+export function formatDownloadGb(gb) {
+ return typeof gb === 'number' && Number.isFinite(gb) && gb > 0 ? `~${gb} GB` : null;
+}
+
/**
* Format a model context window (in tokens) compactly, e.g. 32768 → "32K ctx",
* 131072 → "128K ctx", 1048576 → "1M ctx". Returns null for missing/invalid
diff --git a/scripts/setup-image-video.sh b/scripts/setup-image-video.sh
index d9702a9422..bada4f3368 100755
--- a/scripts/setup-image-video.sh
+++ b/scripts/setup-image-video.sh
@@ -19,11 +19,17 @@
# INSTALL_AUDIOLDM2 '1' to bootstrap a venv at ~/.portos/venv-audioldm2 (torch + diffusers) for local AudioLDM2 long-form background-music generation (pipeline audio stage, second backend alongside MusicGen). Default: 0; opt in with INSTALL_AUDIOLDM2=1 (runs on MPS / CUDA / CPU).
# INSTALL_ACESTEP '1' to bootstrap a venv at ~/.portos/venv-acestep (torch + the acestep package) for local ACE-Step full-song generation with vocals (Music studio, third backend). Default: 0; opt in with INSTALL_ACESTEP=1 (runs on MPS / CUDA / CPU; checkpoints auto-download to ~/.cache/ace-step on first run).
# INSTALL_ACESTEP15 '1' to bootstrap a venv at ~/.portos/venv-acestep15 (the ACE-Step 1.5 package + torch) for local ACE-Step 1.5 full-song generation (Music studio). Default: 0; opt in with INSTALL_ACESTEP15=1 (runs on MPS / CUDA / CPU; model weights are installed separately from Music).
+# INSTALL_MINIMAX_MUSIC3 '1' to bootstrap a venv at ~/.portos/venv-minimax-music3 (CUDA torch + a pinned diffusers) for local MiniMax Music 3 full-song generation up to five minutes (Music studio, fourth backend). Default: 0; opt in with INSTALL_MINIMAX_MUSIC3=1 (NVIDIA CUDA only; the ~29 GB of weights install separately from Music → Generate).
# INSTALL_MUSCRIPTOR '1' to bootstrap a venv at ~/.portos/venv-muscriptor (the muscriptor pip package + its torch stack) for local audio → MIDI transcription (Rounds reference audio + Music Video parsing). Default: 0; opt in with INSTALL_MUSCRIPTOR=1 (runs on MPS / CUDA / CPU; model weights auto-download from HuggingFace on first transcription).
set -euo pipefail
PYTHON_BIN="${PYTHON_BIN:-python3}"
+# CUDA wheel index for every runtime that needs torch on Windows, where the
+# default PyPI wheel is CPU-only. One definition: a cu126 → cu130 bump has to
+# move in lockstep with WIN_TORCH_CUDA_INDEX in server/lib/pythonSetup.js, and
+# a per-block copy makes that a grep instead of an edit.
+TORCH_CUDA_INDEX="${PORTOS_TORCH_CUDA_INDEX:-https://download.pytorch.org/whl/cu126}"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
PORTOS_DATA="${PORTOS_DATA:-${REPO_ROOT}/data}"
@@ -484,10 +490,9 @@ if [[ "$INSTALL_MINIMAX_H3_CUDA" == "1" ]]; then
# Windows wheel is CPU-only, which on a 33B model is not "slower" but
# unusable. Linux's PyPI torch already bundles CUDA, so it needs no swap.
# Mirrors WIN_TORCH_CUDA_INDEX in server/lib/pythonSetup.js.
- MINIMAX_H3_TORCH_INDEX="${PORTOS_TORCH_CUDA_INDEX:-https://download.pytorch.org/whl/cu126}"
if is_windows; then
- echo "📦 Installing CUDA torch from ${MINIMAX_H3_TORCH_INDEX}..."
- "$MINIMAX_H3_CUDA_PY" -m pip install --upgrade --index-url "$MINIMAX_H3_TORCH_INDEX" torch
+ echo "📦 Installing CUDA torch from ${TORCH_CUDA_INDEX}..."
+ "$MINIMAX_H3_CUDA_PY" -m pip install --upgrade --index-url "$TORCH_CUDA_INDEX" torch
else
echo "📦 Installing torch..."
"$MINIMAX_H3_CUDA_PY" -m pip install --upgrade torch
@@ -752,6 +757,14 @@ fi
INSTALL_MINIMAX_MUSIC3="${INSTALL_MINIMAX_MUSIC3:-0}"
if [[ "$INSTALL_MINIMAX_MUSIC3" == "1" ]]; then
+ # MiniMax Music 3 (Music studio, CUDA-only) — full songs with vocals up to five
+ # minutes. diffusers is pinned to a git commit until a release carries the
+ # MiniMax-Music3 modular pipeline, so pip needs git to build that wheel. Say so
+ # up front rather than failing several minutes into a torch download.
+ if ! have git; then
+ echo "❌ INSTALL_MINIMAX_MUSIC3=1 requires git (the diffusers pin is a git commit)." >&2
+ exit 1
+ fi
MINIMAX_MUSIC3_VENV="${HOME}/.portos/venv-minimax-music3"
mkdir -p "${HOME}/.portos"
# A venv built from a conda/anaconda base is the sticky Windows failure: pip
@@ -803,6 +816,7 @@ if [[ "$INSTALL_MINIMAX_MUSIC3" == "1" ]]; then
'diffusers @ git+https://github.com/huggingface/diffusers.git@2da7040be1a2e5f2fcbc8b985083342a308f5a86'
"$MINIMAX_MUSIC3_PY" -c "import torch; from diffusers import ModularPipeline; assert torch.cuda.is_available()"
echo "✅ MiniMax Music 3 venv ready: $MINIMAX_MUSIC3_PY"
+ echo " Model weights (~29 GB) install separately from Music → Generate."
fi
INSTALL_MUSCRIPTOR="${INSTALL_MUSCRIPTOR:-0}"
diff --git a/server/lib/hfDownload.js b/server/lib/hfDownload.js
index 7a398c5666..d13bee91d0 100644
--- a/server/lib/hfDownload.js
+++ b/server/lib/hfDownload.js
@@ -26,8 +26,7 @@
import { spawn } from './childProcess.js';
import { join } from 'node:path';
import {
- resolveFlux2Python, isFlux2VenvHealthy,
- resolveAcestepPython, resolveAudioldm2Python, resolveMusicgenPython,
+ resolveFlux2Python, isFlux2VenvHealthy, HF_HUB_PYTHON_RESOLVERS,
} from './pythonSetup.js';
import { PATHS } from './fileUtils.js';
import { getHfTokenInfo } from './hfToken.js';
@@ -165,8 +164,30 @@ export async function resolveHfDownloadPython(preferredPython = null) {
if (flux2 && await isFlux2VenvHealthy()) return flux2;
const settings = await getSettings();
if (settings?.imageGen?.local?.pythonPath) return settings.imageGen.local.pythonPath;
- // Music venvs are a valid hf_hub host — used when only music gen is set up.
- return resolveAcestepPython() || resolveAudioldm2Python() || resolveMusicgenPython() || null;
+ // Any provisioned music venv is a valid hf_hub host — used when only music
+ // gen is set up. pythonSetup owns the list so it can't drift out of step with
+ // the resolvers themselves (see HF_HUB_PYTHON_RESOLVERS).
+ for (const resolve of HF_HUB_PYTHON_RESOLVERS) {
+ const found = resolve();
+ if (found) return found;
+ }
+ return null;
+}
+
+// Argv for scripts/hf_download_repo.py. Pure and exported so the flag contract
+// is unit-tested without spawning python — the same split as buildSidecarArgs in
+// services/pipeline/musicGen.js. Returns `onlyFiles` too because the caller
+// branches its progress copy on single-file mode.
+export function buildHfDownloadArgs({ repo, revision = null, only = null, ignore = null, tokenEnv = 'HF_TOKEN' }) {
+ const globList = (v) => (Array.isArray(v) ? v.filter((f) => typeof f === 'string' && f.length > 0) : []);
+ const args = [HELPER_SCRIPT, '--repo', repo, '--token-env', tokenEnv];
+ if (revision) args.push('--revision', revision);
+ const onlyFiles = globList(only);
+ for (const f of onlyFiles) args.push('--only', f);
+ // The helper hard-errors on --only with --ignore (single-file mode never
+ // enumerates the repo, so there is nothing to filter). Single-file mode wins.
+ if (!onlyFiles.length) for (const pat of globList(ignore)) args.push('--ignore', pat);
+ return { args, onlyFiles };
}
// Returns `{ promise, kill }`. The promise resolves with `{ ok, sizeBytes,
@@ -178,7 +199,13 @@ export async function resolveHfDownloadPython(preferredPython = null) {
// files. This is MANDATORY for aggregate repos — `DeepBeepMeep/LTX-2` mirrors
// every LTX weight in one ~708 GB repo, so a snapshot would fill the user's
// disk to pull one 1.3 GB IC-LoRA (see server/lib/icLoraWeights.js).
-export function downloadHfRepo({ repo, revision = null, only = null, pythonPath: preferredPython = null, onEvent }) {
+//
+// `ignore` is an array of fnmatch globs dropped from the enumerated file list —
+// the inverse tool, for repos that ship extra checkpoint formats the runtime
+// never loads (MiniMax Music 3 carries a 20 GB captioning model and 10 GB of
+// original-format .pth beside the 29 GB the diffusers pipeline actually reads).
+// It is ignored in single-file mode, where the helper never enumerates at all.
+export function downloadHfRepo({ repo, revision = null, only = null, ignore = null, pythonPath: preferredPython = null, onEvent }) {
let proc = null;
let killed = false;
let errorKind = null;
@@ -208,10 +235,7 @@ export function downloadHfRepo({ repo, revision = null, only = null, pythonPath:
if (token) env.HF_TOKEN = token;
else delete env.HF_TOKEN;
- const args = [HELPER_SCRIPT, '--repo', repo, '--token-env', 'HF_TOKEN'];
- if (revision) args.push('--revision', revision);
- const onlyFiles = Array.isArray(only) ? only.filter((f) => typeof f === 'string' && f.length > 0) : [];
- for (const f of onlyFiles) args.push('--only', f);
+ const { args, onlyFiles } = buildHfDownloadArgs({ repo, revision, only, ignore });
onEvent({
type: 'stage',
diff --git a/server/lib/hfDownload.test.js b/server/lib/hfDownload.test.js
index 415132b785..5b0dcbeb13 100644
--- a/server/lib/hfDownload.test.js
+++ b/server/lib/hfDownload.test.js
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
-import { parseHfDownloadLine } from './hfDownload.js';
+import { buildHfDownloadArgs, parseHfDownloadLine } from './hfDownload.js';
describe('parseHfDownloadLine', () => {
it('treats an empty line as ignore', () => {
@@ -101,3 +101,38 @@ describe('parseHfDownloadLine', () => {
});
});
});
+
+describe('buildHfDownloadArgs', () => {
+ const flags = (opts) => buildHfDownloadArgs(opts).args.slice(1); // drop the helper path
+
+ it('passes ignore globs through for a snapshot pull', () => {
+ expect(flags({ repo: 'org/bundle', ignore: ['extra/*', 'legacy.pth'] })).toEqual([
+ '--repo', 'org/bundle', '--token-env', 'HF_TOKEN',
+ '--ignore', 'extra/*', '--ignore', 'legacy.pth',
+ ]);
+ });
+
+ // scripts/hf_download_repo.py hard-errors on the two together (--only never
+ // enumerates the repo, so there is nothing for a glob to filter), so an argv
+ // carrying both would fail the download outright.
+ it('drops ignore when only is set, rather than emitting both', () => {
+ const { args, onlyFiles } = buildHfDownloadArgs({ repo: 'org/bundle', only: ['weight.safetensors'], ignore: ['extra/*'] });
+ expect(args).toContain('--only');
+ expect(args).not.toContain('--ignore');
+ expect(onlyFiles).toEqual(['weight.safetensors']);
+ });
+
+ it('skips empty and non-string entries in both lists', () => {
+ expect(flags({ repo: 'org/x', only: ['', null, 'a.bin'] })).toEqual([
+ '--repo', 'org/x', '--token-env', 'HF_TOKEN', '--only', 'a.bin',
+ ]);
+ expect(flags({ repo: 'org/x', ignore: ['', undefined] })).toEqual([
+ '--repo', 'org/x', '--token-env', 'HF_TOKEN',
+ ]);
+ });
+
+ it('adds --revision only when one is pinned', () => {
+ expect(flags({ repo: 'org/x', revision: 'abc123' })).toContain('--revision');
+ expect(flags({ repo: 'org/x' })).not.toContain('--revision');
+ });
+});
diff --git a/server/lib/pythonSetup.js b/server/lib/pythonSetup.js
index d8775f9795..1e5a8723c3 100644
--- a/server/lib/pythonSetup.js
+++ b/server/lib/pythonSetup.js
@@ -483,6 +483,22 @@ export function invalidateMinimaxMusic3Python() {
cachedMinimaxMusic3Python = null;
}
+// Every venv PortOS provisions with `huggingface_hub` installed, in preference
+// order. hfDownload.js falls back through these to find an interpreter that can
+// run scripts/hf_download_repo.py when no image-gen runtime is configured — a
+// music-only install still has to be able to download its own weights.
+//
+// ADDING A RUNTIME: if its setup-image-video.sh block pip-installs
+// huggingface_hub, add its resolver here. This list used to live in
+// hfDownload.js, where each new engine forgot it; keeping it next to the
+// resolvers is what makes the omission visible.
+export const HF_HUB_PYTHON_RESOLVERS = Object.freeze([
+ resolveAcestepPython,
+ resolveAudioldm2Python,
+ resolveMusicgenPython,
+ resolveMinimaxMusic3Python,
+]);
+
// MuScriptor (audio → MIDI transcription for the Rounds workbench + Music Video
// parsing, #reference-audio-to-midi) runs in its own venv at
// ~/.portos/venv-muscriptor — the `muscriptor` pip package pulls its own torch
diff --git a/server/lib/sseDownload.js b/server/lib/sseDownload.js
index 9509df860f..76f4a6d8c0 100644
--- a/server/lib/sseDownload.js
+++ b/server/lib/sseDownload.js
@@ -72,6 +72,10 @@ export async function startHfDownloadStream({ req, res, repo, repos, fallbacks,
// helper's single-file mode — MANDATORY for aggregate repos where a snapshot is
// catastrophic (the ~708 GB DeepBeepMeep/LTX-2 mirror).
//
+ // `ignore` (array of fnmatch globs, per entry) is the inverse: still snapshot
+ // the repo, but drop paths the runtime never loads — extra checkpoint formats
+ // or a bundled sibling model. Ignored when `only` is set for the same entry.
+ //
// `cachedFile` is the "is it already here?" predicate for a single-file pull:
// `inspectModelCache` reports the whole repo cached as soon as ANY weight is
// resident, which for an aggregate mirror is true after the first unrelated
@@ -81,16 +85,19 @@ export async function startHfDownloadStream({ req, res, repo, repos, fallbacks,
const normalizeOnly = (v) => (Array.isArray(v) ? v.filter((f) => typeof f === 'string' && f.length > 0) : []);
const normalizeRevision = (v) => (typeof v === 'string' && v.length > 0 ? v : null);
const normalizeTarget = (target) => {
- if (typeof target === 'string' && target.length > 0) return { repo: target, only: [], revision: null };
+ if (typeof target === 'string' && target.length > 0) return { repo: target, only: [], ignore: [], revision: null };
if (!target || typeof target.repo !== 'string' || target.repo.length === 0) return null;
- return { repo: target.repo, only: normalizeOnly(target.only), revision: normalizeRevision(target.revision) };
+ return {
+ repo: target.repo,
+ only: normalizeOnly(target.only),
+ ignore: normalizeOnly(target.ignore),
+ revision: normalizeRevision(target.revision),
+ };
};
const firstSuccessWins = Array.isArray(fallbacks);
- const targets = firstSuccessWins
- ? fallbacks
- .filter((t) => t && typeof t.repo === 'string' && t.repo.length > 0)
- .map((t) => ({ repo: t.repo, only: normalizeOnly(t.only), revision: normalizeRevision(t.revision) }))
- : (Array.isArray(repos) ? repos : [repo]).map(normalizeTarget).filter(Boolean);
+ const targets = (firstSuccessWins ? fallbacks : (Array.isArray(repos) ? repos : [repo]))
+ .map(normalizeTarget)
+ .filter(Boolean);
const { send, safeEnd } = openSseStream(res);
if (targets.length === 0) {
@@ -122,7 +129,7 @@ export async function startHfDownloadStream({ req, res, repo, repos, fallbacks,
let succeededRepo = null;
const attemptErrors = [];
for (let i = 0; i < targets.length; i += 1) {
- const { repo: r, only: onlyFiles, revision } = targets[i];
+ const { repo: r, only: onlyFiles, ignore: ignorePatterns, revision } = targets[i];
const isLastTarget = i === targets.length - 1;
if (aborted) return;
// For a single-file pull the repo-wide cache verdict is both the wrong
@@ -184,6 +191,7 @@ export async function startHfDownloadStream({ req, res, repo, repos, fallbacks,
repo: r,
revision,
only: singleFile ? onlyFiles : null,
+ ignore: ignorePatterns,
pythonPath,
onEvent: (ev) => {
// File-start frames only. Byte ticks arrive several times a second on
diff --git a/server/lib/sseDownload.test.js b/server/lib/sseDownload.test.js
index 48225fc0ba..a84b263a8a 100644
--- a/server/lib/sseDownload.test.js
+++ b/server/lib/sseDownload.test.js
@@ -252,6 +252,19 @@ describe('startHfDownloadStream single-file + fallbacks (#3112)', () => {
}));
});
+ // The inverse of `only`: still snapshot the repo, but drop paths the runtime
+ // never loads. MiniMax Music 3 ships a 20 GB captioner and 10 GB of
+ // original-format checkpoints beside the 29 GB its diffusers pipeline reads.
+ it('forwards `ignore` globs for a snapshot pull', async () => {
+ const { req, res } = makeReqRes();
+ await startHfDownloadStream({ req, res, repos: [{ repo: 'org/bundle', ignore: ['extra/*', 'legacy.pth'] }] });
+ expect(downloadHfRepo).toHaveBeenCalledWith(expect.objectContaining({
+ repo: 'org/bundle',
+ only: null,
+ ignore: ['extra/*', 'legacy.pth'],
+ }));
+ });
+
it('forwards `only` so the helper never enumerates the repo', async () => {
const { req, res } = makeReqRes();
await startHfDownloadStream({ req, res, fallbacks: [CANDIDATES[0]], cachedFile: async () => false });
diff --git a/server/routes/music.js b/server/routes/music.js
index 37cef3d298..f2ff5a4a38 100644
--- a/server/routes/music.js
+++ b/server/routes/music.js
@@ -31,7 +31,7 @@ import { validateRequest } from '../lib/validation.js';
import { createLineReader } from '../lib/streamLines.js';
import { SETUP_IMAGE_VIDEO_SCRIPT, spawnSetupScript, stopSetupScript } from '../lib/setupScriptRunner.js';
import {
- ENGINES, DEFAULT_ENGINE_ID, getEngine, isEngineHealthy, isEnginePlatformSupported,
+ ENGINES, DEFAULT_ENGINE_ID, getEngine, getEngineModel, isEngineHealthy, isEnginePlatformSupported,
enginePlatformLabel, generateMusic,
} from '../services/pipeline/musicGen.js';
import { listEngineModels, addAudioModel, removeAudioModel, isValidRepoId } from '../services/audioModels.js';
@@ -52,7 +52,11 @@ const router = Router();
router.get('/engines', asyncHandler(async (_req, res) => {
const cuda = await getCudaCapability();
const engines = await Promise.all(Object.values(ENGINES).map(async (engine) => {
- const modelCache = engine.fixedModelInstall ? await inspectModelCache(engine.models[0].repo).catch(() => ({ cached: false })) : null;
+ // The one checkpoint a fixed-model engine installs. Resolved by
+ // defaultModelId, not position, so readiness + size stay attached to the
+ // model the client actually downloads and renders with.
+ const fixedModel = engine.fixedModelInstall ? getEngineModel(engine.id, engine.defaultModelId) : null;
+ const modelCache = fixedModel ? await inspectModelCache(fixedModel.repo).catch(() => ({ cached: false })) : null;
// isEngineHealthy, not isEngineReady: a half-built venv (install died
// mid-pip) still has its interpreter, and reporting that as runtimeReady
// hides the install affordance on a backend that cannot generate.
@@ -73,6 +77,9 @@ router.get('/engines', asyncHandler(async (_req, res) => {
customModels: engine.customModels === true,
fixedModelInstall: engine.fixedModelInstall === true,
modelReady: modelCache ? modelCache.cached === true : true,
+ // Rough download footprint for the fixed weights, so the install button can
+ // say how big the pull is before the user commits to it.
+ modelSizeGb: fixedModel?.downloadSizeGb ?? null,
runtimeReady,
cudaRequired: engine.cudaRequired === true,
// false when this host can never run the backend (e.g. MLX MusicGen off
@@ -256,7 +263,7 @@ router.post('/models', asyncHandler(async (req, res) => {
// ACE-Step, which uses a fixed checkpoint_dir) — otherwise a downloaded repo
// would register as selectable but the sidecar would ignore it.
const engine = ENGINES[body.engine];
- const fixedModel = engine.fixedModelInstall && engine.models.some((model) => model.repo === body.repo);
+ const fixedModel = engine.fixedModelInstall ? engine.models.find((model) => model.repo === body.repo) || null : null;
if (!engine.customModels && !fixedModel) {
throw new ServerError(`${ENGINES[body.engine].name} does not support custom HuggingFace models`, { status: 400, code: 'AUDIO_MODEL_ENGINE_FIXED' });
}
@@ -265,7 +272,14 @@ router.post('/models', asyncHandler(async (req, res) => {
if (!fixedModel) await addAudioModel({ engine: body.engine, repo: body.repo, name: body.name });
// Hand the response to the shared SSE driver — it owns writeHead/end + the
// in-flight dedupe + client-disconnect kill. Resolves after the stream ends.
- await startHfDownloadStream({ req, res, repo: body.repo });
+ // A shipped fixed model may declare `downloadIgnore` to skip repo paths its
+ // runtime never loads (see MINIMAX_MUSIC3_MODELS) — a user-added repo has no
+ // such contract, so it always gets the full snapshot.
+ await startHfDownloadStream({
+ req,
+ res,
+ repos: [{ repo: body.repo, ignore: fixedModel?.downloadIgnore ?? [] }],
+ });
// Roll back if the weights aren't actually present now (failed/cancelled
// download) so a bogus repo doesn't persist. Best-effort: a rollback failure
// is logged by the service, not surfaced (the response already closed).
diff --git a/server/routes/music.test.js b/server/routes/music.test.js
index ac2f386677..f9d511fef7 100644
--- a/server/routes/music.test.js
+++ b/server/routes/music.test.js
@@ -23,12 +23,13 @@ vi.mock('../services/pipeline/musicGen.js', () => {
musicgen: { id: 'musicgen', name: 'MusicGen', models: [{ id: 'm', name: 'M' }], defaultModelId: 'm', minDurationSec: 1, maxDurationSec: 30, defaultDurationSec: 12, installEnv: 'INSTALL_MUSICGEN', venvDefault: '/v/mg', resolvePython: () => (gen.ready ? '/v/mg/bin/python3' : null), customModels: true },
acestep: { id: 'acestep', name: 'ACE-Step', models: [{ id: 'a', name: 'A' }], defaultModelId: 'a', minDurationSec: 1, maxDurationSec: 240, defaultDurationSec: 60, installEnv: 'INSTALL_ACESTEP', venvDefault: '/v/ace', resolvePython: () => (gen.ready ? '/v/ace/bin/python3' : null), lyrics: true, customModels: false },
acestep15: { id: 'acestep15', name: 'ACE-Step 1.5', models: [{ id: 'ace-step-v1.5', repo: 'ACE-Step/Ace-Step1.5', name: 'ACE-Step 1.5' }], defaultModelId: 'ace-step-v1.5', minDurationSec: 1, maxDurationSec: 240, defaultDurationSec: 60, installEnv: 'INSTALL_ACESTEP15', venvDefault: '/v/ace15', resolvePython: () => (gen.ready ? '/v/ace15/bin/python3' : null), lyrics: true, customModels: false, fixedModelInstall: true },
- 'minimax-music3': { id: 'minimax-music3', name: 'MiniMax Music 3', models: [{ id: 'minimax-music3', repo: 'MiniMaxAI/MiniMax-Music3', name: 'MiniMax Music 3' }], defaultModelId: 'minimax-music3', minDurationSec: 1, maxDurationSec: 300, defaultDurationSec: 60, installEnv: 'INSTALL_MINIMAX_MUSIC3', venvDefault: '/v/minimax', resolvePython: () => (gen.ready ? '/v/minimax/bin/python3' : null), lyrics: true, customModels: false, fixedModelInstall: true, cudaRequired: true, autoDuration: true },
+ 'minimax-music3': { id: 'minimax-music3', name: 'MiniMax Music 3', models: [{ id: 'minimax-music3', repo: 'MiniMaxAI/MiniMax-Music3', name: 'MiniMax Music 3', downloadIgnore: ['qwen_7B/*', 'flowmatching_vae.pth', 'dav.pth', 'figures/*'], downloadSizeGb: 29 }], defaultModelId: 'minimax-music3', minDurationSec: 1, maxDurationSec: 300, defaultDurationSec: 60, installEnv: 'INSTALL_MINIMAX_MUSIC3', venvDefault: '/v/minimax', resolvePython: () => (gen.ready ? '/v/minimax/bin/python3' : null), lyrics: true, customModels: false, fixedModelInstall: true, cudaRequired: true, autoDuration: true },
};
return {
ENGINES,
DEFAULT_ENGINE_ID: 'musicgen',
getEngine: (id) => ENGINES[id] || ENGINES.musicgen,
+ getEngineModel: (id, modelId) => (ENGINES[id] || ENGINES.musicgen).models.find((m) => m.id === modelId) || null,
isEngineReady: (engineId) => (gen.readyByEngine ? gen.readyByEngine[engineId] === true : gen.ready),
// The route reads readiness through isEngineHealthy (the import probe), so
// `gen.healthyByEngine` / `gen.healthy` drive it; both default to the same
@@ -287,6 +288,9 @@ describe('music routes', () => {
const supported = await request(app).get('/api/music/engines');
expect(supported.body.engines.find((e) => e.id === 'minimax-music3')).toMatchObject({
cudaState: 'available', fixedModelInstall: true, modelReady: false, runtimeReady: true, ready: false,
+ // The UI puts this on the install button so the user knows the size of the
+ // pull before starting it.
+ modelSizeGb: 29,
});
cuda.status = 'absent';
@@ -398,11 +402,30 @@ describe('music routes', () => {
models.add.mockResolvedValueOnce({ id: 'facebook/musicgen-large', repo: 'facebook/musicgen-large', name: 'musicgen-large' });
const r = await request(app).post('/api/music/models').send({ engine: 'musicgen', repo: 'facebook/musicgen-large' });
expect(r.status).toBe(200);
- expect(sse.run).toHaveBeenCalledWith(expect.objectContaining({ repo: 'facebook/musicgen-large' }));
+ // A user-added repo has no shipped contract about which paths matter, so it
+ // gets the full snapshot (no ignore patterns).
+ expect(sse.run).toHaveBeenCalledWith(expect.objectContaining({
+ repos: [{ repo: 'facebook/musicgen-large', ignore: [] }],
+ }));
// Registered only AFTER the download landed in the cache.
expect(models.add).toHaveBeenCalledWith({ engine: 'musicgen', repo: 'facebook/musicgen-large', name: undefined });
});
+ it('POST /models forwards a shipped fixed model\'s downloadIgnore to the download stream', async () => {
+ const r = await request(app).post('/api/music/models').send({ engine: 'minimax-music3', repo: 'MiniMaxAI/MiniMax-Music3' });
+ expect(r.status).toBe(200);
+ // Skipping the bundled captioner and original-format checkpoints keeps the
+ // roughly 29 GB the diffusers pipeline actually loads on the user's disk.
+ expect(sse.run).toHaveBeenCalledWith(expect.objectContaining({
+ repos: [{
+ repo: 'MiniMaxAI/MiniMax-Music3',
+ ignore: ['qwen_7B/*', 'flowmatching_vae.pth', 'dav.pth', 'figures/*'],
+ }],
+ }));
+ // A shipped model is already in the engine's list — nothing to register.
+ expect(models.add).not.toHaveBeenCalled();
+ });
+
it('POST /models rolls back the registration when the download did not land', async () => {
cache.cached = false; // download failed/cancelled → repo not in cache
const r = await request(app).post('/api/music/models').send({ engine: 'musicgen', repo: 'someorg/typo-repo' });
diff --git a/server/services/pipeline/musicGen.js b/server/services/pipeline/musicGen.js
index 02e9dfb6c9..ebee69002d 100644
--- a/server/services/pipeline/musicGen.js
+++ b/server/services/pipeline/musicGen.js
@@ -108,8 +108,22 @@ export const ACESTEP15_MODELS = Object.freeze([
{ id: 'ace-step-v1.5', repo: 'ACE-Step/Ace-Step1.5', name: 'ACE-Step 1.5 (full song + vocals)' },
]);
export const DEFAULT_ACESTEP15_MODEL_ID = 'ace-step-v1.5';
+// MiniMax Music 3 weights. The HF repo is ~57 GB, but `ModularPipeline`
+// (what scripts/generate_minimax_music3.py loads) reads only the seven
+// components named in the repo's modular_model_index.json: condition_encoder,
+// language_model, rvq_depth_decoder, scheduler, tokenizer, transformer,
+// vocoder — about 29 GB. The rest is the sglang-omni serving path: a bundled
+// 20 GB Qwen-7B captioner under qwen_7B/ plus the original-format
+// flowmatching_vae.pth / dav.pth checkpoints. `downloadIgnore` keeps those off
+// the user's disk; it is fnmatch (not glob), so `*` spans `/` as well.
export const MINIMAX_MUSIC3_MODELS = Object.freeze([
- { id: 'minimax-music3', repo: 'MiniMaxAI/MiniMax-Music3', name: 'MiniMax Music 3 (CUDA, up to 5 minutes)' },
+ {
+ id: 'minimax-music3',
+ repo: 'MiniMaxAI/MiniMax-Music3',
+ name: 'MiniMax Music 3 (CUDA, up to 5 minutes)',
+ downloadIgnore: Object.freeze(['qwen_7B/*', 'flowmatching_vae.pth', 'dav.pth', 'figures/*']),
+ downloadSizeGb: 29,
+ },
]);
/**