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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
feat(videoGen): add FastVideo support for Apple Silicon with FastMetal models
[._.]/ Adam Eivy36a9030a2c62
diff --git a/data.reference/media-models.json b/data.reference/media-models.jsonindex 698f39d432..df0109302c 100644--- a/data.reference/media-models.json+++ b/data.reference/media-models.json@@ -490,6 +490,96 @@"estimatedDownloadGb": 39.8,"reviewedAt": "2026-08-09"}+ },+ {+ "id": "fastmetal_1_3b_qad",+ "name": "FastMetal 1.3B QAD (~3.5 GB download, 8+ GB RAM, 3-step)",+ "repo": "FastVideo/FastMetal-1.3B-QAD",+ "runtime": "fastvideo",+ "supportedModes": [+ "text"+ ],+ "defaultWidth": 832,+ "defaultHeight": 480,+ "defaultFrames": 81,+ "memoryGb": 8,+ "steps": 3,+ "guidance": 1,+ "samplerLocked": true,+ "samplerNote": "FastMetal models are DMD2-distilled 3-step models with affine INT8 quantization.",+ "disclosure": {+ "modelCardUrl": "https://huggingface.co/FastVideo/FastMetal-1.3B-QAD",+ "weightsLicense": {+ "name": "Apache-2.0",+ "url": "https://www.apache.org/licenses/LICENSE-2.0"+ },+ "runtimeLicense": {+ "name": "Apache-2.0",+ "url": "https://github.com/hao-ai-lab/FastVideo/blob/main/LICENSE"+ },+ "estimatedDownloadGb": 3.5,+ "reviewedAt": "2026-08-09"+ }+ },+ {+ "id": "fastmetal_5b_qad",+ "name": "FastMetal 5B QAD (~10 GB download, 16+ GB RAM, 3-step)",+ "repo": "FastVideo/FastMetal-5B-QAD",+ "runtime": "fastvideo",+ "supportedModes": [+ "text"+ ],+ "defaultWidth": 1280,+ "defaultHeight": 720,+ "defaultFrames": 81,+ "memoryGb": 16,+ "steps": 3,+ "guidance": 1,+ "samplerLocked": true,+ "samplerNote": "FastMetal models are DMD2-distilled 3-step models with affine INT8 quantization.",+ "disclosure": {+ "modelCardUrl": "https://huggingface.co/FastVideo/FastMetal-5B-QAD",+ "weightsLicense": {+ "name": "Apache-2.0",+ "url": "https://www.apache.org/licenses/LICENSE-2.0"+ },+ "runtimeLicense": {+ "name": "Apache-2.0",+ "url": "https://github.com/hao-ai-lab/FastVideo/blob/main/LICENSE"+ },+ "estimatedDownloadGb": 10.2,+ "reviewedAt": "2026-08-09"+ }+ },+ {+ "id": "fastmetal_14b_qad",+ "name": "FastMetal 14B QAD (~25 GB download, 36+ GB RAM, 3-step)",+ "repo": "FastVideo/FastMetal-14B-QAD",+ "runtime": "fastvideo",+ "supportedModes": [+ "text"+ ],+ "defaultWidth": 1280,+ "defaultHeight": 720,+ "defaultFrames": 81,+ "memoryGb": 36,+ "steps": 3,+ "guidance": 1,+ "samplerLocked": true,+ "samplerNote": "FastMetal models are DMD2-distilled 3-step models with affine INT8 quantization.",+ "disclosure": {+ "modelCardUrl": "https://huggingface.co/FastVideo/FastMetal-14B-QAD",+ "weightsLicense": {+ "name": "Apache-2.0",+ "url": "https://www.apache.org/licenses/LICENSE-2.0"+ },+ "runtimeLicense": {+ "name": "Apache-2.0",+ "url": "https://github.com/hao-ai-lab/FastVideo/blob/main/LICENSE"+ },+ "estimatedDownloadGb": 25.4,+ "reviewedAt": "2026-08-09"+ }}],"cuda": [diff --git a/scripts/generate_fastvideo.py b/scripts/generate_fastvideo.pynew file mode 100755index 0000000000..83b7ec71a8--- /dev/null+++ b/scripts/generate_fastvideo.py@@ -0,0 +1,155 @@+#!/usr/bin/env python3+"""PortOS FastVideo MLX helper for Apple Silicon.++Spawns the pinned FastVideo inference script from the ~/.portos/fastvideo+checkout. Generation is cache-only: PortOS downloads model weights through+the Video Gen UI before launching this helper.+"""++import argparse+import os+import re+import subprocess+import sys+from pathlib import Path++# Same-dir sibling import. _runner_common is stdlib-only at import time.+sys.path.insert(0, str(Path(__file__).resolve().parent))+from _runner_common import emit_runtime_fingerprint, establish_process_group # noqa: E402+++def parse_args() -> argparse.Namespace:+ p = argparse.ArgumentParser(description="PortOS FastVideo MLX helper")+ p.add_argument("--repo-dir", default=None, help="Path to cloned FastVideo repo")+ p.add_argument("--model-root", required=True, help="HF model snapshot path")+ p.add_argument("--mlx-checkpoint", default=None, help="MLX checkpoint path (defaults to model-root)")+ p.add_argument("--prompt", required=True)+ p.add_argument("--negative-prompt", default="")+ p.add_argument("--width", type=int, required=True)+ p.add_argument("--height", type=int, required=True)+ p.add_argument("--num-frames", type=int, default=81)+ p.add_argument("--fps", type=int, default=16)+ p.add_argument("--steps", type=int, default=3)+ p.add_argument("--guidance", type=float, default=1.0)+ p.add_argument("--seed", type=int, default=42)+ p.add_argument("--output", required=True)+ p.add_argument("--image", default=None)+ p.add_argument("--fast", action="store_true", help="Enable fast mode (fewer steps + frame interpolation)")+ p.add_argument("--enhance-prompt", action="store_true", help="Enable prompt enhancer")+ p.add_argument("--refine", action="store_true", help="Enable second-pass refinement")+ return p.parse_args()+++def find_entry_script(repo_dir: Path) -> Path:+ candidates = [+ repo_dir / "examples" / "inference" / "basic" / "mlx_wan_prompt_to_video.py",+ repo_dir / "examples" / "inference" / "basic" / "mlx_wan22_generate.py",+ repo_dir / "examples" / "mlx_wan_prompt_to_video.py",+ ]+ for cand in candidates:+ if cand.is_file():+ return cand+ # Fallback to glob search in repo+ found = list(repo_dir.glob("**/mlx_wan_prompt_to_video.py"))+ if found:+ return found[0]+ raise FileNotFoundError(f"Could not find mlx_wan_prompt_to_video.py under {repo_dir}")+++def main() -> int:+ args = parse_args()++ # Runtime fingerprint at startup — recorded by PortOS so output is tied to+ # the specific FastVideo/mlx/torch stack on this machine.+ emit_runtime_fingerprint("fastvideo", ["fastvideo", "mlx", "mlx_metal", "torch", "transformers", "huggingface-hub"])++ establish_process_group()++ repo_dir = Path(args.repo_dir).resolve() if args.repo_dir else (Path.home() / ".portos" / "fastvideo")+ if not repo_dir.is_dir():+ print(f"❌ FastVideo repo directory not found: {repo_dir}", file=sys.stderr)+ return 1++ try:+ entry_script = find_entry_script(repo_dir)+ except FileNotFoundError as err:+ print(f"❌ {err}", file=sys.stderr)+ return 1++ model_root = Path(args.model_root).resolve()+ mlx_checkpoint = Path(args.mlx_checkpoint).resolve() if args.mlx_checkpoint else model_root++ cmd = [+ sys.executable,+ str(entry_script),+ "--model-root", str(model_root),+ "--mlx-checkpoint", str(mlx_checkpoint),+ "--prompt", args.prompt,+ "--width", str(args.width),+ "--height", str(args.height),+ "--num-frames", str(args.num_frames),+ "--output-path", str(args.output),+ ]+ if args.fast:+ cmd.append("--fast")+ if args.enhance_prompt:+ cmd.append("--enhance-prompt")+ if args.refine:+ cmd.append("--refine")+ if args.image:+ cmd.extend(["--image-path", str(args.image)])++ print("STAGE:inference", file=sys.stderr, flush=True)+ print(f"🎬 fastvideo generate {args.width}x{args.height} frames={args.num_frames} steps={args.steps} seed={args.seed}", file=sys.stderr, flush=True)++ env = os.environ.copy()+ env["PYTHONPATH"] = f"{str(repo_dir)}:{env.get('PYTHONPATH', '')}".rstrip(":")++ proc = subprocess.Popen(+ cmd,+ stdout=subprocess.PIPE,+ stderr=subprocess.STDOUT,+ text=True,+ env=env,+ cwd=str(repo_dir),+ )++ assert proc.stdout is not None+ # Parse output lines and map to STAGE: / STATUS: protocols+ step_pattern = re.compile(r'(?:step|Step)\s*(\d+)[/:](\d+)', re.IGNORECASE)+ percent_pattern = re.compile(r'(\d+)%')++ for raw in proc.stdout:+ line = raw.rstrip()+ if not line:+ continue++ step_match = step_pattern.search(line)+ if step_match:+ cur, total = int(step_match.group(1)), int(step_match.group(2))+ print(f"STAGE:fastvideo:step:{cur}:{total}:denoising step {cur}/{total}", file=sys.stderr, flush=True)+ else:+ pct_match = percent_pattern.search(line)+ if pct_match:+ pct = int(pct_match.group(1))+ print(f"STAGE:fastvideo:step:{pct}:100:generating {pct}%", file=sys.stderr, flush=True)+ elif "loading" in line.lower() or "encoding" in line.lower():+ print(f"STATUS:{line}", file=sys.stderr, flush=True)+ else:+ print(line, file=sys.stderr, flush=True)++ return_code = proc.wait()+ if return_code != 0:+ print(f"❌ FastVideo runner exited with code {return_code}", file=sys.stderr)+ return return_code++ if not Path(args.output).exists():+ print(f"❌ FastVideo finished but output missing: {args.output}", file=sys.stderr)+ return 1++ print(f"✅ FastVideo saved {args.output}", file=sys.stderr)+ return 0+++if __name__ == "__main__":+ sys.exit(main())diff --git a/scripts/migrations/314-fastvideo-mlx-models.js b/scripts/migrations/314-fastvideo-mlx-models.jsnew file mode 100644index 0000000000..223d63d8d8--- /dev/null+++ b/scripts/migrations/314-fastvideo-mlx-models.js@@ -0,0 +1,100 @@+/**+ * Add the FastVideo FastMetal MLX models (1.3B, 5B, 14B) to existing macOS+ * video registries. Fresh installs receive them from data.reference/media-models.json.+ */++import { readFile } from 'fs/promises';+import { join } from 'path';+import { atomicWrite } from '../../server/lib/fileUtils.js';+import { VIDEO_BUCKET_MLX, readVideoBucket } from '../../server/lib/mediaModelBuckets.js';++const REL_PATH = 'data/media-models.json';++const NEW_ENTRIES = [+ {+ id: 'fastmetal_1_3b_qad',+ name: 'FastMetal 1.3B QAD (~3.5 GB download, 8+ GB RAM, 3-step)',+ repo: 'FastVideo/FastMetal-1.3B-QAD',+ runtime: 'fastvideo',+ supportedModes: ['text'],+ defaultWidth: 832,+ defaultHeight: 480,+ defaultFrames: 81,+ memoryGb: 8,+ steps: 3,+ guidance: 1,+ samplerLocked: true,+ samplerNote: 'FastMetal models are DMD2-distilled 3-step models with affine INT8 quantization.',+ },+ {+ id: 'fastmetal_5b_qad',+ name: 'FastMetal 5B QAD (~10 GB download, 16+ GB RAM, 3-step)',+ repo: 'FastVideo/FastMetal-5B-QAD',+ runtime: 'fastvideo',+ supportedModes: ['text'],+ defaultWidth: 1280,+ defaultHeight: 720,+ defaultFrames: 81,+ memoryGb: 16,+ steps: 3,+ guidance: 1,+ samplerLocked: true,+ samplerNote: 'FastMetal models are DMD2-distilled 3-step models with affine INT8 quantization.',+ },+ {+ id: 'fastmetal_14b_qad',+ name: 'FastMetal 14B QAD (~25 GB download, 36+ GB RAM, 3-step)',+ repo: 'FastVideo/FastMetal-14B-QAD',+ runtime: 'fastvideo',+ supportedModes: ['text'],+ defaultWidth: 1280,+ defaultHeight: 720,+ defaultFrames: 81,+ memoryGb: 36,+ steps: 3,+ guidance: 1,+ samplerLocked: true,+ samplerNote: 'FastMetal models are DMD2-distilled 3-step models with affine INT8 quantization.',+ },+];++export default {+ async up({ rootDir }) {+ const path = join(rootDir, REL_PATH);+ const raw = await readFile(path, 'utf-8').catch((err) => {+ if (err.code === 'ENOENT') return null;+ throw err;+ });+ if (raw == null) return;+ let config;+ try {+ config = JSON.parse(raw);+ } catch (err) {+ throw new Error(`Cannot migrate ${REL_PATH}: invalid JSON (${err.message})`, { cause: err });+ }+ const mlxEntries = readVideoBucket(config?.video, VIDEO_BUCKET_MLX);+ if (!Array.isArray(mlxEntries)) return;++ let changed = false;+ const present = new Set(mlxEntries.map((entry) => entry?.id));+ for (const entry of NEW_ENTRIES) {+ if (present.has(entry.id)) continue;+ mlxEntries.push(structuredClone(entry));+ present.add(entry.id);+ changed = true;+ }+ const shipped = readVideoBucket(config?._shippedDefaults?.video, VIDEO_BUCKET_MLX);+ if (Array.isArray(shipped)) {+ for (const entry of NEW_ENTRIES) {+ if (!shipped.includes(entry.id)) {+ shipped.push(entry.id);+ changed = true;+ }+ }+ }+ if (changed) {+ await atomicWrite(path, `${JSON.stringify(config, null, 2)}\n`);+ console.log(`📝 ${REL_PATH}: added FastVideo FastMetal MLX models`);+ }+ },+};diff --git a/scripts/migrations/314-fastvideo-mlx-models.test.js b/scripts/migrations/314-fastvideo-mlx-models.test.jsnew file mode 100644index 0000000000..904595f2c0--- /dev/null+++ b/scripts/migrations/314-fastvideo-mlx-models.test.js@@ -0,0 +1,72 @@+import { mkdirSync, readFileSync, rmSync, writeFileSync } from 'fs';+import { tmpdir } from 'os';+import { join } from 'path';+import { afterEach, beforeEach, describe, expect, it } from 'vitest';+import migration from './314-fastvideo-mlx-models.js';++describe('314-fastvideo-mlx-models migration', () => {+ let rootDir;++ beforeEach(() => {+ rootDir = join(tmpdir(), `portos-test-314-${Date.now()}`);+ mkdirSync(join(rootDir, 'data'), { recursive: true });+ });++ afterEach(() => {+ rmSync(rootDir, { recursive: true, force: true });+ });++ it('skips gracefully when media-models.json does not exist', async () => {+ await migration.up({ rootDir });+ expect(true).toBe(true);+ });++ it('adds FastMetal models to an existing MLX registry', async () => {+ const initial = {+ video: {+ mlx: [+ { id: 'ltx23_unified', name: 'LTX-2.3' },+ ],+ cuda: [],+ },+ _shippedDefaults: {+ video: {+ mlx: ['ltx23_unified'],+ },+ },+ };+ writeFileSync(join(rootDir, 'data', 'media-models.json'), JSON.stringify(initial, null, 2));++ await migration.up({ rootDir });++ const updated = JSON.parse(readFileSync(join(rootDir, 'data', 'media-models.json'), 'utf-8'));+ const ids = updated.video.mlx.map((m) => m.id);+ expect(ids).toContain('fastmetal_1_3b_qad');+ expect(ids).toContain('fastmetal_5b_qad');+ expect(ids).toContain('fastmetal_14b_qad');++ const shipped = updated._shippedDefaults.video.mlx;+ expect(shipped).toContain('fastmetal_1_3b_qad');+ expect(shipped).toContain('fastmetal_5b_qad');+ expect(shipped).toContain('fastmetal_14b_qad');+ });++ it('is idempotent when run multiple times', async () => {+ const initial = {+ video: {+ mlx: [+ { id: 'ltx23_unified', name: 'LTX-2.3' },+ ],+ },+ };+ writeFileSync(join(rootDir, 'data', 'media-models.json'), JSON.stringify(initial, null, 2));++ await migration.up({ rootDir });+ const firstPass = readFileSync(join(rootDir, 'data', 'media-models.json'), 'utf-8');++ await migration.up({ rootDir });+ const secondPass = readFileSync(join(rootDir, 'data', 'media-models.json'), 'utf-8');++ expect(firstPass).toBe(secondPass);+ });+});diff --git a/scripts/setup-image-video.sh b/scripts/setup-image-video.shindex c5c6ac1060..cb2b7624e8 100755--- a/scripts/setup-image-video.sh+++ b/scripts/setup-image-video.sh@@ -11,6 +11,7 @@# INSTALL_VIDEO '1' to also install mlx_video for LTX video generation (default: 1 on macOS, 0 on Windows)# INSTALL_LTX2 '1' to also clone + uv-sync dgrauet/ltx-2-mlx at ~/.portos/ltx-2-mlx for the second-gen LTX-2.3 pipeline (proper keyframe interpolation, true video extend, audio-to-video). Default: 0; opt in with INSTALL_LTX2=1.# INSTALL_LTX25 '1' to clone + uv-sync MrMofer's ltx-2.5 fork at ~/.portos/ltx-2.5-mlx (Apple Silicon). The 2.3 pin cannot load LTX-2.5 weights. Default: 0.+# INSTALL_FASTVIDEO '1' to clone hao-ai-lab/FastVideo at ~/.portos/fastvideo and build an MLX venv for native Apple Silicon video generation (FastMetal models). Default: 0; opt in with INSTALL_FASTVIDEO=1.# INSTALL_MINIMAX_H3 '1' to install the pinned MiniMax H3 MLX runtime at ~/.portos/minimax-h3-mlx (Apple Silicon). Weights remain a separate explicit Video Gen download. Default: 0.# INSTALL_MINIMAX_H3_CUDA '1' to install the MiniMax H3 CUDA runtime at ~/.portos/minimax-h3-cuda (Windows + NVIDIA), via diffusers' MiniMaxH3ModularPipeline. Weights remain a separate explicit Video Gen download (~144 GB). Default: 0.# INSTALL_FLUX2 '1' to also bootstrap a separate venv at ~/.portos/venv-flux2 for FLUX.2-klein (default: 1 on macOS, 0 elsewhere)@@ -108,7 +109,7 @@ mkdir -p "${PORTOS_DATA}/video-thumbnails"# install ever starts — which on Linux/CPU/CUDA blocks the advertised# `INSTALL_ACESTEP=1 bash …` path. A bare `bash setup-image-video.sh` still# installs mflux as before.-ANY_BYOV="${INSTALL_LTX2:-0}${INSTALL_LTX25:-0}${INSTALL_WAN22:-0}${INSTALL_HUNYUAN:-0}${INSTALL_MINIMAX_H3:-0}${INSTALL_MINIMAX_H3_CUDA:-0}${INSTALL_MUSICGEN:-0}${INSTALL_AUDIOLDM2:-0}${INSTALL_ACESTEP:-0}${INSTALL_ACESTEP15:-0}${INSTALL_MINIMAX_MUSIC3:-0}${INSTALL_MINIMAX_MUSIC3_MLX:-0}${INSTALL_MUSCRIPTOR:-0}"+ANY_BYOV="${INSTALL_LTX2:-0}${INSTALL_LTX25:-0}${INSTALL_FASTVIDEO:-0}${INSTALL_WAN22:-0}${INSTALL_HUNYUAN:-0}${INSTALL_MINIMAX_H3:-0}${INSTALL_MINIMAX_H3_CUDA:-0}${INSTALL_MUSICGEN:-0}${INSTALL_AUDIOLDM2:-0}${INSTALL_ACESTEP:-0}${INSTALL_ACESTEP15:-0}${INSTALL_MINIMAX_MUSIC3:-0}${INSTALL_MINIMAX_MUSIC3_MLX:-0}${INSTALL_MUSCRIPTOR:-0}"# "no BYOV runtime was requested" = the concatenation contains no non-zero# character. Matching a literal string of zeros instead made this a counting# exercise that the string and the variable list had to agree on — and they had@@ -355,6 +356,52 @@ if [[ "$INSTALL_LTX25" == "1" ]]; thenecho "✅ ltx-2.5-mlx venv ready: ${LTX25_PY}"fi+INSTALL_FASTVIDEO="${INSTALL_FASTVIDEO:-0}"+if [[ "$INSTALL_FASTVIDEO" == "1" ]]; then+ # FastVideo provides native Apple Silicon inference for Wan and FastMetal models+ # via MLX/Metal. Reached only when the user chooses Install/Repair in Video Gen.+ if ! is_macos || [[ "$(uname -m)" != "arm64" ]]; then+ echo "❌ FastVideo MLX requires an Apple-Silicon Mac." >&2+ exit 1+ fi+ if ! have git; then+ echo "❌ INSTALL_FASTVIDEO=1 requires git." >&2+ exit 1+ fi++ FASTVIDEO_UV_TOOL_DIR="${HOME}/.portos/tools/uv-0.8.14"+ FASTVIDEO_UV="${FASTVIDEO_UV_TOOL_DIR}/bin/uv"+ if [[ ! -x "$FASTVIDEO_UV" ]] || [[ "$("$FASTVIDEO_UV" --version 2>/dev/null || true)" != "uv 0.8.14" ]]; then+ echo "📦 Bootstrapping pinned uv 0.8.14 for FastVideo..."+ "$PYTHON_BIN" -m venv --clear "$FASTVIDEO_UV_TOOL_DIR"+ "${FASTVIDEO_UV_TOOL_DIR}/bin/python3" -m pip install --disable-pip-version-check "uv==0.8.14"+ fi++ FASTVIDEO_PIN="${FASTVIDEO_PIN:-main}"+ FASTVIDEO_DIR="${HOME}/.portos/fastvideo"+ FASTVIDEO_PY="${FASTVIDEO_DIR}/.venv/bin/python3"+ mkdir -p "${HOME}/.portos"+ if [[ ! -d "${FASTVIDEO_DIR}/.git" ]]; then+ echo "📦 Cloning hao-ai-lab/FastVideo..."+ git clone https://github.com/hao-ai-lab/FastVideo.git "${FASTVIDEO_DIR}"+ else+ echo "📦 Fetching FastVideo updates..."+ (cd "${FASTVIDEO_DIR}" && git fetch origin)+ fi+ git_checkout_pin "${FASTVIDEO_DIR}" "${FASTVIDEO_PIN}"+ if [[ ! -x "${FASTVIDEO_PY}" ]]; then+ echo "📦 Creating FastVideo venv with Python 3.11..."+ (cd "${FASTVIDEO_DIR}" && "$FASTVIDEO_UV" venv --python 3.11)+ fi+ echo "📦 Installing FastVideo MLX packages (uv pip install -e '.[mlx]')..."+ (cd "${FASTVIDEO_DIR}" && "$FASTVIDEO_UV" pip install -e '.[mlx]')+ probe_or_fail \+ "FastVideo synced but the runtime import failed." \+ "Use Repair / Upgrade from the Video Gen runtime panel to retry." \+ "${FASTVIDEO_PY}" -c "import fastvideo; import mlx.core"+ echo "✅ FastVideo MLX runtime ready: ${FASTVIDEO_PY}"+fi+INSTALL_WAN22="${INSTALL_WAN22:-0}"if [[ "$INSTALL_WAN22" == "1" ]]; then# MLX-Gen provides the validated Apple-Silicon Wan 2.2 TI2V-5B and A14B@@ -964,6 +1011,9 @@ fiif [[ "$INSTALL_LTX25" == "1" ]]; thenecho " LTX-2.5: ${HOME}/.portos/ltx-2.5-mlx/.venv/bin/python3 (MrMofer ltx25 fork @ ${LTX25_PIN:0:12})"fi+if [[ "$INSTALL_FASTVIDEO" == "1" ]]; then+ echo " FastVideo MLX: ${HOME}/.portos/fastvideo/.venv/bin/python3 (FastVideo @ ${FASTVIDEO_PIN:0:12})"+fiif [[ "$INSTALL_WAN22" == "1" ]]; thenecho " Wan 2.2: ${HOME}/.portos/mlx-gen/.venv/bin/python3 (MLX-Gen @ ${WAN22_PIN:0:12})"echo " Weights remain uninstalled until Download is chosen in Video Gen."diff --git a/server/lib/huggingfaceModel.js b/server/lib/huggingfaceModel.jsindex 07f83e337f..cf32d62b66 100644--- a/server/lib/huggingfaceModel.js+++ b/server/lib/huggingfaceModel.js@@ -79,6 +79,9 @@ const detectVideoRuntime = (blob) => {if (/\bwan[\s._-]?2|wan-ai\b/.test(blob) || /\bwan2\.\d/.test(blob)) {return { runtime: 'wan22', installHint: 'INSTALL_WAN22=1 bash scripts/setup-image-video.sh' };}+ if (/fastvideo|fastmetal/i.test(blob)) {+ return { runtime: 'fastvideo', installHint: 'INSTALL_FASTVIDEO=1 bash scripts/setup-image-video.sh' };+ }if (/hunyuan/.test(blob)) {return { runtime: 'hunyuan', installHint: 'INSTALL_HUNYUAN=1 bash scripts/setup-image-video.sh' };}diff --git a/server/lib/mediaModels.js b/server/lib/mediaModels.jsindex b74ba9085a..e51a80a365 100644--- a/server/lib/mediaModels.js+++ b/server/lib/mediaModels.js@@ -496,6 +496,53 @@ const DEFAULT_REGISTRY = {precision: 'fp32',deprecated: true,},+ // FastVideo FastMetal models — Hao AI Lab's distilled DMD2 Wan models+ // with affine INT8 quantization on Apple Silicon MLX.+ {+ id: 'fastmetal_1_3b_qad',+ name: 'FastMetal 1.3B QAD (~3.5 GB download, 8+ GB RAM, 3-step)',+ repo: 'FastVideo/FastMetal-1.3B-QAD',+ runtime: 'fastvideo',+ supportedModes: ['text'],+ defaultWidth: 832,+ defaultHeight: 480,+ defaultFrames: 81,+ memoryGb: 8,+ steps: 3,+ guidance: 1.0,+ samplerLocked: true,+ samplerNote: 'FastMetal models are DMD2-distilled 3-step models with affine INT8 quantization.',+ },+ {+ id: 'fastmetal_5b_qad',+ name: 'FastMetal 5B QAD (~10 GB download, 16+ GB RAM, 3-step)',+ repo: 'FastVideo/FastMetal-5B-QAD',+ runtime: 'fastvideo',+ supportedModes: ['text'],+ defaultWidth: 1280,+ defaultHeight: 720,+ defaultFrames: 81,+ memoryGb: 16,+ steps: 3,+ guidance: 1.0,+ samplerLocked: true,+ samplerNote: 'FastMetal models are DMD2-distilled 3-step models with affine INT8 quantization.',+ },+ {+ id: 'fastmetal_14b_qad',+ name: 'FastMetal 14B QAD (~25 GB download, 36+ GB RAM, 3-step)',+ repo: 'FastVideo/FastMetal-14B-QAD',+ runtime: 'fastvideo',+ supportedModes: ['text'],+ defaultWidth: 1280,+ defaultHeight: 720,+ defaultFrames: 81,+ memoryGb: 36,+ steps: 3,+ guidance: 1.0,+ samplerLocked: true,+ samplerNote: 'FastMetal models are DMD2-distilled 3-step models with affine INT8 quantization.',+ },]))),cuda: applyVideoSpeedProfiles(applyVideoFinishProfiles(applyVideoDisclosures([{ id: 'ltx_video', name: 'LTX-Video 0.9.5 — T2V + I2V (~9.5 GB, auto-downloads)', runtime: 'cuda_video', steps: 25, guidance: 3.0 },diff --git a/server/lib/videoDisclosure.js b/server/lib/videoDisclosure.jsindex 86fd757951..bcfbf7ebb9 100644--- a/server/lib/videoDisclosure.js+++ b/server/lib/videoDisclosure.js@@ -73,6 +73,10 @@ const RUNTIME_LICENSE = {name: 'Tencent Hunyuan Community License',url: 'https://github.com/gaurav-nelson/HunyuanVideo_MLX/blob/main/LICENSE.txt',},+ fastvideo: {+ name: 'Apache-2.0',+ url: 'https://github.com/hao-ai-lab/FastVideo/blob/main/LICENSE',+ },};// Informational territory facts for ModelDisclosure — not an execution gate.@@ -271,6 +275,36 @@ export const VIDEO_MODEL_DISCLOSURES = Object.freeze({reviewedAt: VIDEO_DISCLOSURE_REVIEWED_AT,},},+ fastmetal_1_3b_qad: {+ shippedRepo: 'FastVideo/FastMetal-1.3B-QAD',+ disclosure: {+ modelCardUrl: hfModelCard('FastVideo/FastMetal-1.3B-QAD'),+ weightsLicense: APACHE_2,+ runtimeLicense: RUNTIME_LICENSE.fastvideo,+ estimatedDownloadGb: 3.5,+ reviewedAt: VIDEO_DISCLOSURE_REVIEWED_AT,+ },+ },+ fastmetal_5b_qad: {+ shippedRepo: 'FastVideo/FastMetal-5B-QAD',+ disclosure: {+ modelCardUrl: hfModelCard('FastVideo/FastMetal-5B-QAD'),+ weightsLicense: APACHE_2,+ runtimeLicense: RUNTIME_LICENSE.fastvideo,+ estimatedDownloadGb: 10.2,+ reviewedAt: VIDEO_DISCLOSURE_REVIEWED_AT,+ },+ },+ fastmetal_14b_qad: {+ shippedRepo: 'FastVideo/FastMetal-14B-QAD',+ disclosure: {+ modelCardUrl: hfModelCard('FastVideo/FastMetal-14B-QAD'),+ weightsLicense: APACHE_2,+ runtimeLicense: RUNTIME_LICENSE.fastvideo,+ estimatedDownloadGb: 25.4,+ reviewedAt: VIDEO_DISCLOSURE_REVIEWED_AT,+ },+ },// Legacy CUDA entry. It carries no `repo` because its diffusers helper// resolves LTX-Video 0.9.5 directly, so its weights license stays Unknown.ltx_video: {diff --git a/server/lib/videoModeProfiles.js b/server/lib/videoModeProfiles.jsindex 69e938fdbc..ecbd0980c8 100644--- a/server/lib/videoModeProfiles.js+++ b/server/lib/videoModeProfiles.js@@ -60,6 +60,7 @@ export const VIDEO_RUNTIME_MODES = Object.freeze({ltx2: Object.freeze(['text', 'image', 'fflf', 'extend']),ltx25: Object.freeze(['text', 'image', 'fflf', 'extend']),wan22: Object.freeze(['text', 'image']),+ fastvideo: Object.freeze(['text', 'image']),minimax_h3: MINIMAX_H3_MODE_SET,minimax_h3_cuda: MINIMAX_H3_MODE_SET,hunyuan: Object.freeze(['text']),diff --git a/server/services/videoGen/generateVideo.js b/server/services/videoGen/generateVideo.jsindex d4c3c1966a..3fdefa56e9 100644--- a/server/services/videoGen/generateVideo.js+++ b/server/services/videoGen/generateVideo.js@@ -237,6 +237,23 @@ export async function generateVideo({ pythonPath, prompt, negativePrompt = '', m}}}+ if (model.runtime === 'fastvideo') {+ if (typeof model.revision === 'string' && model.revision) {+ const baseCache = await inspectModelCache(model.repo, { revision: model.revision });+ if (!baseCache.cached || !baseCache.snapshotPath) {+ throw new ServerError(+ `${model.name} revision ${model.revision.slice(0, 8)} is not fully cached. Download or repair it in Video Gen before rendering.`,+ { status: 400, code: 'FASTVIDEO_MODEL_NOT_CACHED' },+ );+ }+ wanModelPath = baseCache.snapshotPath;+ } else {+ const baseCache = await inspectModelCache(model.repo);+ if (baseCache.cached && baseCache.snapshotPath) {+ wanModelPath = baseCache.snapshotPath;+ }+ }+ }// Pinned LTX family entries (LTX-2.5 today) must render the verified// snapshot, not whatever `main` snapshot_download would follow. Unpinned// 2.3 entries keep passing the repo id so the helper's existing Hub resolvediff --git a/server/services/videoGen/modeContract.js b/server/services/videoGen/modeContract.jsindex 5212a4c1cc..9f6889d876 100644--- a/server/services/videoGen/modeContract.js+++ b/server/services/videoGen/modeContract.js@@ -108,6 +108,19 @@ const VIDEO_MODE_CONTRACTS = Object.freeze({: 'Wan 2.2 image-to-video requires a source image — upload one before running this model.'),},},+ fastvideo: {+ codePrefix: 'FASTVIDEO',+ chainCode: 'FASTVIDEO_CHAIN_REQUIRES_IMAGE_MODE',+ modeCeiling: null,+ extraConditioningUnsupported: false,+ messages: {+ modeUnsupported: ({ model, requestedMode }) => `${model.name} does not support ${requestedMode}-to-video. Choose a compatible FastVideo model.`,+ textSourceConflict: () => 'FastVideo text-to-video cannot consume a source image — switch to image mode or remove the source.',+ imageRequiresFirst: ({ sourceResolved }) => (sourceResolved+ ? 'FastVideo image-to-video requires a resolvable source image — choose an existing gallery image or upload one.'+ : 'FastVideo image-to-video requires a source image — upload one before running this model.'),+ },+ },minimax_h3: MINIMAX_H3_CONTRACT,minimax_h3_cuda: MINIMAX_H3_CONTRACT,});diff --git a/server/services/videoGen/modeContract.test.js b/server/services/videoGen/modeContract.test.jsindex 0cef3fda55..4c0ac6c217 100644--- a/server/services/videoGen/modeContract.test.js+++ b/server/services/videoGen/modeContract.test.js@@ -8,11 +8,12 @@ import {// Fake registry entries — never a real install's media-models.json.const wan = (supportedModes) => ({ runtime: 'wan22', name: 'Example Wan Profile', supportedModes });+const fv = (supportedModes) => ({ runtime: 'fastvideo', name: 'Example FastVideo Model', supportedModes });const h3 = (supportedModes) => ({ runtime: 'minimax_h3', name: 'Example H3', supportedModes });describe('videoModeContractError — shared gate', () => {it('gates exactly the runtimes that declare a contract row', () => {- expect([...VIDEO_MODE_GATED_RUNTIMES].sort()).toEqual(['minimax_h3', 'minimax_h3_cuda', 'wan22']);+ expect([...VIDEO_MODE_GATED_RUNTIMES].sort()).toEqual(['fastvideo', 'minimax_h3', 'minimax_h3_cuda', 'wan22']);});it.each(['ltx2', 'mlx_video', 'hunyuan', undefined])('leaves the %s runtime ungated', (runtime) => {@@ -79,6 +80,35 @@ describe('videoModeContractError — wan22 codes and messages', () => {});});+describe('videoModeContractError — fastvideo codes and messages', () => {+ it('rejects a mode the profile does not declare', () => {+ const err = videoModeContractError({ model: fv(['text']), mode: 'image', hasFirstImage: true });+ expect(err).toMatchObject({ status: 400, code: 'FASTVIDEO_MODE_UNSUPPORTED' });+ expect(err.message).toContain('Example FastVideo Model does not support image-to-video');+ });++ it('resolves an entry with no declared supportedModes from its runtime', () => {+ expect(videoModeContractError({ model: fv(undefined), mode: 'text' })).toBeNull();+ expect(videoModeContractError({ model: fv(undefined), mode: 'fflf' }))+ .toMatchObject({ code: 'FASTVIDEO_MODE_UNSUPPORTED' });+ });++ it('rejects text mode carrying a source image', () => {+ expect(videoModeContractError({ model: fv(['text', 'image']), mode: 'text', hasFirstImage: true }))+ .toMatchObject({ code: 'FASTVIDEO_TEXT_MODE_SOURCE_CONFLICT' });+ });++ it('phrases the missing-source message for the boundary that asked', () => {+ const staged = videoModeContractError({ model: fv(['image']), mode: 'image' });+ expect(staged).toMatchObject({ code: 'FASTVIDEO_I2V_REQUIRES_IMAGE' });+ expect(staged.message).toContain('upload one before running this model');++ const resolved = videoModeContractError({ model: fv(['image']), mode: 'image', sourceResolved: true });+ expect(resolved).toMatchObject({ code: 'FASTVIDEO_I2V_REQUIRES_IMAGE' });+ expect(resolved.message).toContain('choose an existing gallery image or upload one');+ });+});+describe('videoModeContractError — minimax_h3 codes and messages', () => {it('caps a hand-widened supportedModes at the helper ceiling', () => {const err = videoModeContractError({ model: h3([...MINIMAX_H3_MODES, 'extend']), mode: 'extend' });diff --git a/server/services/videoGen/renderArgs.js b/server/services/videoGen/renderArgs.jsindex c1db235708..bfbbbb7d19 100644--- a/server/services/videoGen/renderArgs.js+++ b/server/services/videoGen/renderArgs.js@@ -40,6 +40,9 @@ import {HUNYUAN_VENV_PYTHON,HUNYUAN_HELPER_SCRIPT,HUNYUAN_REPO_DIR,+ FASTVIDEO_VENV_PYTHON,+ FASTVIDEO_HELPER_SCRIPT,+ FASTVIDEO_REPO_DIR,BYOV_RUNTIME_INFO,videoLoraUnsupportedError,routesToWindowsHelper,@@ -539,6 +542,32 @@ export const assertRenderModeContract = ({if (err) throw err;};+// Build args for the FastVideo MLX helper on Apple Silicon.+export const buildFastVideoArgs = ({+ model, fastvideoModelPath, prompt, negativePrompt, width, height,+ numFrames, fps, steps, guidance, seed, sourceImagePath, mode, outputPath,+}) => {+ assertByovRuntimeInstalled('fastvideo');+ assertRenderModeContract({ model, mode, sourceImagePath });+ const args = [+ FASTVIDEO_HELPER_SCRIPT,+ '--repo-dir', FASTVIDEO_REPO_DIR,+ '--model-root', fastvideoModelPath || model.repo,+ '--prompt', prompt,+ '--width', String(width),+ '--height', String(height),+ '--num-frames', String(numFrames),+ '--fps', String(fps),+ '--steps', String(steps),+ '--guidance', String(guidance ?? 1.0),+ '--seed', String(seed),+ '--output', outputPath,+ ];+ if (negativePrompt) args.push('--negative-prompt', negativePrompt);+ if (sourceImagePath) args.push('--image', sourceImagePath);+ return { bin: FASTVIDEO_VENV_PYTHON, args };+};+// Build args for the pinned MLX-Gen Wan CLI. The helper itself never downloads:// all base + profile weights must already be present through the UI flow.const buildWan22Args = ({ model, wanModelPath, wanRequiredWeights, prompt, negativePrompt, width, height, numFrames, fps, steps, guidance, seed, sourceImagePath, mode, outputPath }) => {@@ -833,6 +862,9 @@ export const buildArgs = ({ pythonPath, modelId, model, wanModelPath, wanRequire): videoLoraUnsupportedError(model, modelId);}+ if (model.runtime === 'fastvideo') {+ return buildFastVideoArgs({ model, fastvideoModelPath: wanModelPath, prompt, negativePrompt, width, height, numFrames, fps, steps, guidance, seed, sourceImagePath, mode, outputPath });+ }if (model.runtime === 'wan22') {return buildWan22Args({ model, wanModelPath, wanRequiredWeights, prompt, negativePrompt, width, height, numFrames, fps, steps, guidance, seed, sourceImagePath, mode, outputPath });}diff --git a/server/services/videoGen/runtimes.js b/server/services/videoGen/runtimes.jsindex 335cda598a..f3e10b8e35 100644--- a/server/services/videoGen/runtimes.js+++ b/server/services/videoGen/runtimes.js@@ -93,6 +93,11 @@ export const HUNYUAN_VENV_PYTHON = join(homedir(), '.portos', 'hunyuan-video-mlxexport const HUNYUAN_HELPER_SCRIPT = join(PATHS.root, 'scripts', 'generate_hunyuan.py');export const HUNYUAN_REPO_DIR = join(homedir(), '.portos', 'hunyuan-video-mlx');+// FastVideo MLX runtime — Hao AI Lab's FastVideo / FastMetal Apple Silicon framework.+export const FASTVIDEO_VENV_PYTHON = join(homedir(), '.portos', 'fastvideo', '.venv', 'bin', 'python3');+export const FASTVIDEO_HELPER_SCRIPT = join(PATHS.root, 'scripts', 'generate_fastvideo.py');+export const FASTVIDEO_REPO_DIR = join(homedir(), '.portos', 'fastvideo');+// Standalone runtime-fingerprint probe (scripts/runtime_fingerprint.py). Run in// each installed BYOV venv by resolveRuntimeFingerprint() to surface resolved// package versions on GET /api/video-gen/status without running a render. Shares@@ -240,6 +245,18 @@ export const BYOV_RUNTIME_INFO = Object.freeze({importProbe: 'import ltx_pipelines_mlx',fingerprintPackages: ['ltx_pipelines_mlx', 'ltx_core_mlx', 'mlx', 'mlx_metal'],},+ fastvideo: {+ id: 'fastvideo',+ label: 'FastVideo MLX',+ venvPython: FASTVIDEO_VENV_PYTHON,+ repoDir: FASTVIDEO_REPO_DIR,+ installEnvVar: 'INSTALL_FASTVIDEO',+ killProcessGroup: true,+ repoUrl: 'https://github.com/hao-ai-lab/FastVideo',+ pinEnvVar: 'FASTVIDEO_PIN',+ importProbe: 'import fastvideo; import mlx.core',+ fingerprintPackages: ['fastvideo', 'mlx', 'mlx_metal', 'torch', 'transformers', 'huggingface-hub'],+ },});export const BYOV_VIDEO_RUNTIMES = Object.freeze(new Set(Object.keys(BYOV_RUNTIME_INFO)));diff --git a/server/services/videoGen/runtimes.test.js b/server/services/videoGen/runtimes.test.jsindex 9b371c8560..78c6c30073 100644--- a/server/services/videoGen/runtimes.test.js+++ b/server/services/videoGen/runtimes.test.js@@ -378,6 +378,27 @@ describe('MiniMax H3 CUDA offload profiles', () => {});});+describe('fastvideo runtime registration', () => {+ const info = BYOV_RUNTIME_INFO.fastvideo;++ it('is a BYOV runtime with its own venv', () => {+ expect(BYOV_VIDEO_RUNTIMES.has('fastvideo')).toBe(true);+ expect(info.installEnvVar).toBe('INSTALL_FASTVIDEO');+ expect(info.venvPython).toContain('.portos/fastvideo/.venv');+ expect(info.repoDir).toContain('.portos/fastvideo');+ });++ it('probes for fastvideo and mlx.core', () => {+ expect(info.importProbe).toContain('fastvideo');+ expect(info.importProbe).toContain('mlx.core');+ });++ it('never reports LoRA capability', async () => {+ expect(byovRuntimeLoraCapable('fastvideo')).toBe(false);+ await expect(resolveByovRuntimeLoraCapable('fastvideo')).resolves.toBe(false);+ });+});+// Execution facts read off the registry rather than re-derived from a runtime id// at the spawn site, so a new cache-only runtime is a table line, not an edit to// the child-spawn path. Absent means off, as with every other optional key here.@@ -387,11 +408,13 @@ describe('runtime execution flags', () => {expect(runtimeIsCacheOnly('minimax_h3_cuda')).toBe(true);expect(runtimeIsCacheOnly('ltx2')).toBe(false);expect(runtimeIsCacheOnly('wan22')).toBe(false);+ expect(runtimeIsCacheOnly('fastvideo')).toBe(false);expect(runtimeIsCacheOnly(undefined)).toBe(false);});it('reports group-kill for the runners that spawn children of their own', () => {expect(runtimeNeedsProcessGroupKill('wan22')).toBe(true);+ expect(runtimeNeedsProcessGroupKill('fastvideo')).toBe(true);expect(runtimeNeedsProcessGroupKill('minimax_h3')).toBe(true);expect(runtimeNeedsProcessGroupKill('minimax_h3_cuda')).toBe(true);expect(runtimeNeedsProcessGroupKill('ltx2')).toBe(false);