-
Notifications
You must be signed in to change notification settings - Fork 434
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
Support train deep learning models on Apple Silicon GPU? #224
Comments
It's supported but there is a bug in tch-rs which prevents from automatically installing torch C++ libs (see the issue #180). However, we checked in a work around script. Please see my comment on how to run it: #180 (comment). This is available on main branch currently. Let us know if you're having trouble setting it up. I develop and test on Mac M1 pro and I created this workaround script. So I can confirm Burn with tch backend works. Also to note: we enabled the accelerate framework support (for MacOS and iOS) for burn-ndarray (see #183). There is a "blas-accelerate" flag in burn-ndarray tat you can use to build. |
@antimora Thanks. When I try this script, it shows:
But I have tomli
BTW, conda is actived. I think that is ok. Right? |
Actrully, it does.
Inspired by this article
|
On my Macbook pro 13' 2020(M1), example mnist one iteration takes about 2 minutes with @antimora How about on your Mac M1 pro for example mnist? |
@overheat yes, with accelerate it takes about this long. This is because NDArray is not optimized as torch yet. @nathanielsimard made a few optimizations so you'd want to update the main. However, currently burn-tch backend with CPU and GPU on Mac is fast. Try with "tch-gpu" or "tch-cpu" feature flags. You'll notice for some reason CPU is faster for this MNIST example, but only with the current model. It appears the model is small enough, it completes under one minute on CPU. Probably the overhead copying data to GPU is more. When I updated with a bigger model, GPU was faster. You can view activity monitor on your mac to see how much GPU is busy, like this: |
Thanks for reporting. Probably there were some differences in the installation. I use pip and I didn't test with conda. Python packages installations is always difficult for different environments compared to rust =D |
@overheat Were you able to train your models on Mac M1/M2 GPU? Can we consider this issue closed? |
@nathanielsimard we should close this as duplicate #180. I don't have ability to close this ticket. |
Feature description
Support train deep learning models on Apple Silicon GPU? M1 and M2
Feature motivation
Faster
(Optional) Suggest a Solution
The text was updated successfully, but these errors were encountered: