Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MPS support #1264

Merged
merged 8 commits into from
Feb 12, 2024
Merged

Add MPS support #1264

merged 8 commits into from
Feb 12, 2024

Conversation

maximegmd
Copy link
Contributor

Description

Supports basic training on Mac M series.

Motivation and Context

It partially solves Mac support.

How has this been tested?

Ran a train job with lora-mps.yml from start to finish.

@maximegmd maximegmd mentioned this pull request Feb 6, 2024
@ehartford
Copy link
Collaborator

This is awesome! @maximegmd

@winglian
Copy link
Collaborator

winglian commented Feb 7, 2024

I'm not sure what's up with packaging and CI. I've run into this issue with our CI before and I think I just gave up on using it at one point.

@maximegmd
Copy link
Contributor Author

maximegmd commented Feb 7, 2024

I can always "parse" version numbers with a quick regex but it's not ideal (thanks ChatGPT)

Copy link
Collaborator

@winglian winglian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @maximegmd 🚀

@winglian winglian merged commit fac2d98 into axolotl-ai-cloud:main Feb 12, 2024
7 checks passed
@fakerybakery fakerybakery mentioned this pull request Feb 12, 2024
@fakerybakery
Copy link

Thanks @maximegmd!! @winglian is MLX support still planned?

@maximegmd
Copy link
Contributor Author

Thanks @maximegmd!! @winglian is MLX support still planned?

The issue with supporting MLX is that we will pretty much have to rewrite axolotl entirely to replace all torch specific code (all of it) to MLX, so no bitsandbytes, no xformers, no flash-attn, no transformers... At this point I think we are better off waiting for the transformers support of MPS to reach an acceptable state.

@flexchar
Copy link

Thanks for this, @maximegmd !!
May I know how long it took to fine-tune and what are your M specs?

@maximegmd
Copy link
Contributor Author

Thanks for this, @maximegmd !! May I know how long it took to fine-tune and what are your M specs?

Will run it again tomorrow, because I was today years old when I discovered the performance power option 😅

M3 Max 16/40 64GB

@fakerybakery
Copy link

fakerybakery commented Feb 13, 2024

@maximegmd For installation, since flash-attn & deepspeed aren't supported on macOS, should I use pip install -e . instead of pip install -e '.[flash-attn,deepspeed]'? (And are you using accelerate?)

@maximegmd
Copy link
Contributor Author

maximegmd commented Feb 14, 2024

Right just install the base without any options.

I use accelerate:

accelerate launch -m axolotl.cli.train examples/tiny-llama/lora-mps.yml

This training takes around 56 minutes on my machine.

@fakerybakery
Copy link

Nice, thx! I'll try it out

djsaunde pushed a commit that referenced this pull request Dec 17, 2024
* add mps support

* linter stuff

* CI fixes

* install packaging for various tests

* Update setup.py

* Revert "install packaging for various tests"

This reverts commit 980e7aa.

* Revert "CI fixes"

This reverts commit 4609e3b.

---------

Co-authored-by: Wing Lian <[email protected]>
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.

5 participants