Repository navigation
Studio: serve the Jev API locally with Laya - #11603
Conversation
…it on Python 3.10
… the usage examples
…ted model as loaded
…e load errors to their model
Before/after UI evidenceThis compares merge base Steps: open Settings › API as the owner, turn on Serve requests, wait for the download, send the example below to
Real answers for "I was charged twice this month." (
Settings › API The section through the flow: off, downloaded, first request served Checks
Review fixes on this branch (each with a regression test that fails before and passes after):
|
# Conflicts: # studio/frontend/src/features/hub/index.ts
…or the selected model
The stack gate accepts mlx below 0.24.1, where only mx.metal.clear_cache exists, so calling mx.clear_cache unconditionally broke every Decision API load and unload there.
Studio: run the Decision API on MLX when GPU is chosen on Apple Silicon
|
Review record from the review rounds on the mirror (danielhanchen/unsloth-staging-review#104). All fixes were pushed to this branch directly; the head was approved after round 3.
Also on this branch: e137681 (refuse unload while a load is claimed but its thread has not started), 517fc71 (merge of main), and two comment-only passes. |
…tween the sections
* Studio: serve the Jev API locally with Laya * Studio: keep Decision API loads off managed downloads and serving during switches * Studio: probe downloads outside the Decision API state lock and gate it on Python 3.10 * Studio: simplify Decision API settings and explain the missing laya package * Studio: install laya automatically for the Decision API * Studio: tighten the Decision API model row and move the section below the usage examples * Studio: cap Decision API question text before it reaches the model lock * Studio: refuse the Decision API without torch and only show the selected model as loaded * Studio: keep the Decision API route importable on Python 3.9 and scope load errors to their model * Studio: show the Decision API section with its error when settings fail to load * Studio: stub the systemone router in desktop auth tests and decode the laya install as utf-8 * Studio: clear a stale laya install error once the package is present * Studio: drop expired Decision API load errors and show Loading only for the selected model * Studio: tokenize the Decision API state once per request * Studio: rerank document search with the Decision API model * Studio: document measured rerank latency * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Studio: move Laya to CPU when the GPU runs out of memory, like laya's own predict * Studio: run the Decision API on MLX when GPU is chosen on Apple Silicon With the device set to GPU on Apple Silicon, laya_runtime now loads the checkpoint through unsloth_zoo.mlx.decision instead of torch MPS, reusing laya's tokenizer, prompt building and calibration so answers match laya on CPU. An unsloth-zoo without the module keeps the MPS path. Evicting or unloading also clears the MLX allocator cache so the memory is returned. * Studio: wait for the retry load in the hand-install Decision API test * Studio: move the MLX Decision API model to CPU when it runs out of memory The MLX path returned before the GPU out-of-memory fallback, so on Apple Silicon an MLX allocation failure became a 500 on every retry where MPS used to move to CPU. The resident agent now releases the MLX model and its buffer cache, loads laya on CPU and continues in place; a failed CPU load drops the agent so the next request reloads it. Also read rl_agent_config.json as UTF-8. * Studio: clear the MLX cache under its older mx.metal name too The stack gate accepts mlx below 0.24.1, where only mx.metal.clear_cache exists, so calling mx.clear_cache unconditionally broke every Decision API load and unload there. * Studio: reject Decision API requests that truncate state * Studio: center the Decision API device dropdown on its row * Studio: drop Studio from the Decision API device description * Studio: allow MLX 0.31+ precision in the MLX Decision API test * Studio: remove Laya document search reranking * Studio: trim Decision API comments * Studio: refuse Decision API unload while a load is claimed but not yet started * Studio: free cached device memory on Decision API unload and keep keyless callers on the configured model * Studio: free cached device memory after the Decision API falls back to CPU * Studio: trim Decision API comments after review * Studio: let the Decision API placement test pass without a comment between the sections --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Lyxot <[email protected]> Co-authored-by: wasimysaid <[email protected]> Co-authored-by: danielhanchen <[email protected]>


Adds a Decision API to Studio, backed by Laya running locally.
POST /v1/systemone takes text plus yes/no, pick-one or score questions and returns a probability for each answer. The request format matches TypeSafe's Jev, so the TypeSafe SDK works against Studio as is.
Off by default. The owner turns it on from a new Decision API section in Settings > API, which downloads the model. The model loads into memory on the first request. The same section has the model picker, the CPU or GPU choice, and an unload button.
Before / after
Settings > API on the merge base (left) and on this branch with the Decision API switched on (right). The new section shows the Serve requests switch, the model picker (Multilingual, not downloaded, 678 MB, with a Download button), and the CPU / GPU choice.
GET /api/settings/systemonereturns 404 on the base and 200 here, and it is off by default.