Skip to content

Studio: Developer mode opt-in for experimental CPU video generation - #14247

Merged
danielhanchen merged 1 commit into
mainfrom
studio-video-cpu-dev-mode
Oct 19, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
studio-video-cpu-dev-mode

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Closes #9458.

Video stays hidden on hosts without a supported GPU by default. This adds an owner-only Developer mode in Settings > General with one switch, "Allow video generation on CPU (experimental)". UNSLOTH_VIDEO_ALLOW_CPU overrides the saved setting in either direction.

What changes

  • video_capability() admits only the plain CPU-only case (reason no_accelerator) when the opt-in is on, marked video_cpu_experimental. Detection failures, missing or broken PyTorch, Intel Macs and GPUs PyTorch cannot reach stay blocked.
  • The setting lives in the owner's store (PUT /api/settings/developer-mode, owner only, 403 for managed accounts; any account can read it).
  • /api/health carries video_cpu_opt_in so the sidebar keeps the Video row enabled once opted in.
  • Enabling opens a confirm dialog: "CPU video generation may take hours, consume large amounts of RAM, and may freeze your system. Continue at your own risk.", plus host RAM against a 32 GB minimum and a measured speed estimate. Disabling restores the GPU gate at once.
  • The Video page shows a persistent "CPU (experimental)" banner while it is in effect.

The backend video pipelines already resolve to a float32 CPU target when no accelerator is visible (the routes on main already render on CPU; only the capability gate and the UI blocked it), so no inference code changes.

Testing

  • Wan2.1-T2V-1.3B with no GPU visible, through /video/load and /video/generate on a real Studio server: 832x480, 5 frames, 3 steps, generate 228 s on 16 threads, peak RSS 24.5 GiB (this sets the 32 GB minimum). After the owner PUT, /api/system moved from no_accelerator to video_supported: true, video_cpu_experimental: true, and the load reported device cpu, float32. The output matches the base tree's frame for frame (mean 141.29).
  • Tiny Wan pipelines render on CPU for wan2.1-t2v-1.3b, wan2.2-ti2v-5b and wan2.2-t2v-a14b.
  • Backend: 34 new tests (capability matrix, every other refusal reason staying blocked with the opt-in on, env and setting precedence, owner-only PUT, health wiring); the related suites pass (145 in the capability, developer-mode and account settings files).
  • Frontend: 8 new tests (RAM check, confirm flow, gate wiring); tsc and the strict i18n parity check pass.

Not verified on CPU: LTX-2 / 2.5, HunyuanVideo 1.5 and MiniMax-H3 (no tiny repos; MiniMax-H3 already runs through the CPU sd.cpp build on such hosts). A default-length clip (33 frames, 30 steps) was not timed; "hours" is extrapolated from about 27 s per denoise step at 832x480.

Screenshots

Studio started with no GPU visible (/api/system reports no_accelerator on both sides).

Settings > General: AFTER adds the Developer mode section with the switch, off by default.

Settings General before and after

Turning the switch on asks first (the issue's warning, host RAM against the minimum, and the measured speed):

Confirm dialog

After confirming, /api/system reports video_supported: true, video_cpu_experimental: true without a restart, and the Video page opens with the CPU (experimental) banner. BEFORE, the same host keeps the no-accelerator block:

Video page before and after

Video stays hidden on a host with no supported GPU by default. A new owner-only
Settings > General > Developer mode switch (or UNSLOTH_VIDEO_ALLOW_CPU, which
wins over the saved setting in both directions) lets a plain CPU-only host
(video reason no_accelerator) run the video pipelines on the CPU. Detection
failures, missing or broken PyTorch, Intel Macs and GPUs PyTorch cannot reach
stay blocked.

video_capability() reports the opt-in as supported with video_cpu_experimental,
/api/health carries video_cpu_opt_in for the sidebar's Video row, and the Video
page keeps a CPU (experimental) warning up while it is in effect. Enabling asks
first with the warning from the issue, the host RAM against a 32 GB minimum
(Wan2.1 1.3B peaked at 24.5 GiB RSS on CPU) and a measured speed estimate.

Closes #9458
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T12:44:54.593199Z 85c3bd9 Manual request
🔒 Security Review ⚠️ Failed 2026-10-19T12:29:43.425649Z 85c3bd9 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 19, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 19, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 19, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 85c3bd9a3f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit 26e246d into main Oct 19, 2026
@danielhanchen
danielhanchen deleted the studio-video-cpu-dev-mode branch October 19, 2026 13:16
danielhanchen added a commit that referenced this pull request Oct 19, 2026
## Summary

Main is over the startup bundle budget again, so `Frontend build +
bundle sanity` fails on every PR based on it:

```
over the startup budget: transfer 2012.0 KB > 2011.9 KB, raw 6681.8 KB > 6680.6 KB      (main at 26e246d)
```

#14247 (Developer mode opt-in for experimental CPU video generation)
added 1,777 B raw / 654 B transfer to the startup chunks. It merged
without raising the limits.

## Cause

`#14247` touches eager startup code. Its new strings land in
`i18n/locales/en.ts` (the English catalog ships in the startup chunks),
and the developer-mode flag is read from `__root.tsx`,
`app-sidebar.tsx`, `config/env.ts` and `config/hardware-verdict.ts`. The
settings section itself is lazy. This is small real growth with no lazy
home. The other commits since the last measurement (#14204, #14239,
#14249) change no frontend code.

## Change

- **`check-bundle-budget.ts`:** a BUDGET comment entry for #14247, and
both limits moved to the measured build plus a 160 B raw / 189 B
transfer margin:
  - `rawBytes`: 6,840,888 -> 6,842,343.
  - `transferBytes`: 2,060,219 -> 2,060,510.

## Testing

One machine and build, Node 24, exact byte totals from the budget
script. CI has matched this machine to the byte on earlier budget
changes.

| tree | raw B | transfer B |
|---|---|---|
| `88afa84b87` (before #14247) | 6,840,406 | 2,059,667 |
| main `26e246d407` | 6,842,183 | 2,060,321 |

- **Main against the old limits:** `over the startup budget: transfer
2012.0 KB > 2011.9 KB, raw 6681.8 KB > 6680.6 KB`.
- **With this change:** `within budget (0.2 KB transfer, 0.2 KB raw to
spare)`, 96 chunks.
danielhanchen added a commit that referenced this pull request Oct 19, 2026
danielhanchen added a commit that referenced this pull request Oct 19, 2026
## Summary


`tests/test_formatter_fixed_point.py::test_every_tracked_python_file_is_already_formatted`
fails in `Repo tests (CPU, rest)` on PRs based on current main (seen on
#14229):

```
these tracked files are not a fixed point of the ruff-format-with-kwargs hook, so pre-commit.ci will fail the next PR that edits them
```

That run listed eight files. Most were reformatted on main since then.
Running the hook (`scripts/run_ruff_format.py`, ruff 0.6.9 as pinned)
over every tracked file inside the hook's scope, at main `6c159816c5`,
leaves two:

- `studio/backend/routes/settings.py`: one `logger.info(...)` call the
hook joins onto one line.
- `studio/backend/tests/test_video_cpu_developer_mode.py`: one `from
utils.account_context import ...` the hook splits.

Both came in with #14247, which merged without its pre-commit.ci format
commit.

## Change

The hook's own output for those two files, nothing else. No behavior
change.

## Testing

- **The hook over every tracked `.py`:** I ran it and then reverted
everything the hook's `exclude` pattern skips (read from
`.pre-commit-config.yaml` the same way the guard does). Exactly these
two files remain changed.
- **Running it again on this branch:** no further changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]Add Developer Mode to enable CPU-only video generation with warning prompt

1 participant