Skip to content

Finalise Apple Silicon (MPS) support#17

Open
gmorain wants to merge 1 commit into
Brekel:mainfrom
gmorain:feat/apple-silicon-mps
Open

Finalise Apple Silicon (MPS) support#17
gmorain wants to merge 1 commit into
Brekel:mainfrom
gmorain:feat/apple-silicon-mps

Conversation

@gmorain

@gmorain gmorain commented Jul 17, 2026

Copy link
Copy Markdown

Most MPS support was already in place; this finishes it so VisionCaptioner runs on Apple Silicon Macs.

  • Prefer bfloat16 on MPS; fix SAM3 autocast for MPS
  • Single device-detection helper (cuda/mps/cpu)
  • Native macOS memory monitor (system-wide via vm_stat); GPU load shows N/A (no unprivileged source on macOS)
  • Disable Int8/NF4 (BitsAndBytes, CUDA-only) when off CUDA
  • Remove unused decord dependency; add macOS install docs; make run.sh executable

Existing test suite passes (165). Transformers captioning and the memory monitor verified on Apple Silicon.

SAM3 masking is untested on MPS: my SAM3 access request was rejected by Meta (as it has been for many other HF users), so I could not obtain the weights. The MPS code path for SAM3 (autocast) is written but unexercised.

The core paths already had MPS scaffolding (device detection, Metal GGUF
offload, cache clearing, load-then-.to("mps")). This finishes the port.

- backend.py: single get_torch_device() helper (dedupes QwenEngine/SAM3Engine
  detection); prefer bfloat16 on MPS (float16 NaNs on bf16-native VLMs);
  SAM3 autocast now uses device_type="mps"/float16 instead of nullcontext,
  fixing the mixed bf16/fp32 dtype-mismatch on Apple Silicon.
- gui_workers.py + main.py: native macOS memory monitor via torch.mps
  allocation vs total unified memory (os.sysconf); relabel VRAM/"No NVIDIA
  GPU" to neutral "GPU Mem"/"GPU N/A".
- tab_captions.py: disable Int8/NF4 (BitsAndBytes, CUDA-only) off CUDA.
- requirements.txt: drop unused decord (no arm64 wheels; frames come from cv2).
- README.md: macOS (Apple Silicon) install section + prerequisite; run.sh
  message no longer Linux-specific.
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.

1 participant