Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@zchn
Copy link
Owner

@zchn zchn commented Jan 14, 2025

Added support for Apple Silicon GPUs (MPS) alongside CUDA.

Changes:

  1. Created utils/device.py with helper functions:

    • get_device(): Returns best available device (cuda > mps > cpu)
    • to_device(): Moves tensors/models to the best device
    • set_default_device(): Sets default tensor type based on device
  2. Modified all files that used cuda directly:

    • evaluate.py
    • llama.py
    • main.py
    • train_ppo.py
    • train_rm.py
    • train_sft.py
    • trainers.py

The code now checks for the best available device and uses it appropriately.

@zchn zchn marked this pull request as ready for review January 14, 2025 18:58
@zchn zchn merged commit 36134a0 into main Jan 14, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants