Repository navigation
Make TrainerBoi work fully on macOS (Apple Silicon / MPS) - #5
Merged
Merged
Conversation
- New device_utils module: CUDA -> MPS -> CPU selection, dtype, 4-bit/optimizer/mixed-precision policy, cross-platform process helpers - All training scripts (SFT/DPO/ORPO/KTO/GRPO/pretrain/vision/ embeddings/audio/tabular) and inference paths fall back gracefully where NVIDIA-only features (QLoRA, Unsloth, 8-bit optims) are missing - Mac setup/launch scripts (setup.sh, START.sh, launch_*.sh), libomp wiring for XGBoost without Homebrew, requirements markers + rich - Desktop app: macOS setup flow, portable backend kill, dist:mac DMG target, generated icon.icns; CI now tests macOS + runs unit tests - Device-aware errors, planner estimates/model caps, hardware reporting - tests/test_device_utils.py: 19 stdlib regression tests Verified on M1 Pro: setup.sh, SFT/DPO/ORPO/KTO/GRPO/pretrain/vision/ embeddings smokes, chat, merge, health check, Studio boot, guided end-to-end run, and arm64+x64 DMG builds.
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.
TrainerBoi was Windows + NVIDIA-only. This makes it run completely on Apple Silicon Macs (with Metal/MPS acceleration) while keeping Windows behavior unchanged.
How it works
device_utilsmodule: picks CUDA → MPS → CPU and centralizes dtype, 4-bit availability, optimizer, mixed-precision, memory stats, and cross-platform process helpers (kill_pid/kill_tree, file-manager reveal).adamw_torch, bf16 → fp16 (MPS) / fp32 (CPU). Each prints a one-line note instead of crashing.setup.sh/scripts/setup.sh(uv + Python 3.11 + MPS PyTorch + libs + UI),START.sh,launch_*.sh,activate.sh, Desktop.commandcreator. XGBoost's missinglibompis wired from PyTorch's bundled copy — no Homebrew needed.transcribe_audiouses the existing PyAV decoder (torchaudio needs torchcodec + system FFmpeg);Transcriberdevice fixed (device=0→ accelerator-aware).dist:macDMG target, generatedicon.icns.tests/test_device_utils.py(19 stdlib tests, no deps); CI matrix now covers macOS and runs them.Verified on M1 Pro / 16 GB
setup.shend to end; MPS detected (~4.7 TFLOPS fp16); SFT/DPO/ORPO/KTO/GRPO/pretrain/vision/embeddings smokes; chat, merge, health check, Studio boot + API + classic mount, full guided run (data → plan → train → before/after); arm64 + x64 DMGs build.