fix(serve): accept --device mps for Apple Silicon - #134
Open
o2yama wants to merge 1 commit into
Open
Conversation
The index build CLI already accepts mps (StarTrail-org#73, StarTrail-org#109), but the serve CLI was left with choices=["cpu", "cuda"], so pixelrag serve --device mps fails at argument parsing. The downstream dtype logic already handles non-cpu devices (bfloat16), so widening the choices list is sufficient. Verified on an M3 MacBook Air (8 GB): the model loads in bfloat16 on MPS and search latency is 0.2-1.2 s per query after warmup.
|
@o2yama is attempting to deploy a commit to the andylizf's projects Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The index build CLI accepts
--device mpssince #73 / #109, but the serve CLI was left behind:serve/src/pixelrag_serve/api.pystill haschoices=["cpu", "cuda"], so on Apple Siliconpixelrag serve --device mpsfails at argument parsing:The downstream logic already handles non-cpu devices correctly (
dtype = torch.float32 if device == "cpu" else torch.bfloat16), so the argparse whitelist is the only blocker.Fix
Add
"mps"to the--devicechoices and update the help text. No other changes needed.Testing
uvx ruff check .passespytest tests/— 87 passed; 5 pre-existing failures intest_department_filter.pyreproduce identically on unmodifiedmain(unrelated to this change)pixelrag serve --device mpsloads Qwen3-VL-Embedding-2B in bfloat16 (~4.3 GB), and search over a prebuilt FAISS index responds in 0.2–1.2 s per query after warmup. Retrieval scores match CPU/float32 results from the same index within ±0.001.