Comments (8)
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.
from burn.
@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:
from burn.
BTW, conda is actived. I think that is ok. Right?
Actrully, it does. I need this:
conda install tomli conda install tomli-w
Inspired by this article
virtual environment in which you can install custom Python modules. But the virtual environment is initially empty—even if you’ve already installed tomli on your computer!
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
from burn.
@overheat Were you able to train your models on Mac M1/M2 GPU? Can we consider this issue closed?
from burn.
@nathanielsimard we should close this as duplicate #180. I don't have ability to close this ticket.
from burn.
@antimora Thanks.
When I try this script, it shows:
✗ python scripts/fix-tch-build-arm64.py
Installing/Upgrading torch via pip install ...
Requirement already satisfied: torch in /opt/homebrew/lib/python3.11/site-packages (1.13.0a0+git49444c3)
Requirement already satisfied: typing_extensions in /opt/homebrew/lib/python3.11/site-packages (from torch) (4.5.0)
Requirement already satisfied: tomli in /opt/homebrew/lib/python3.11/site-packages (2.0.1)
Requirement already satisfied: tomli-w in /opt/homebrew/lib/python3.11/site-packages (1.0.0)
Updating config.toml with torch library paths ...
Traceback (most recent call last):
File "/Volumes/Acrucial/repos/ai/burn/scripts/fix-tch-build-arm64.py", line 71, in <module>
main()
File "/Volumes/Acrucial/repos/ai/burn/scripts/fix-tch-build-arm64.py", line 67, in main
update_toml_config()
File "/Volumes/Acrucial/repos/ai/burn/scripts/fix-tch-build-arm64.py", line 26, in update_toml_config
import tomli
ModuleNotFoundError: No module named 'tomli'
But I have tomli
python3 -m pip install tomli
Requirement already satisfied: tomli in /opt/homebrew/lib/python3.11/site-packages (2.0.1)
BTW, conda is actived. I think that is ok. Right?
from burn.
BTW, conda is actived. I think that is ok. Right?
Actrully, it does.
I need this:
conda install tomli
conda install tomli-w
Inspired by this article
virtual environment in which you can install custom Python modules. But the virtual environment is initially empty—even if you’ve already installed tomli on your computer!
from burn.
On my Macbook pro 13' 2020(M1), example mnist one iteration takes about 2 minutes with ndarray-blas-accelerate
features. In contract, about 4 minutes with ndarray
features.
@antimora How about on your Mac M1 pro for example mnist?
from burn.
Related Issues (20)
- Panic w/ backwards pass when combining gather and max_dim HOT 2
- Convert ONNX graph inputs of 0-dim tensors to scalars HOT 4
- Support for 0-Dimensional Tensors in Burn HOT 5
- No adapter found for graphics API AutoGraphicsApi HOT 1
- [Fusion] Support multi-precision fusion
- burn and drug discovery
- loss.backward() hangs after burn update 0.12 -> 0.13 HOT 3
- Help Wanted: Implementing ONNX Ops
- Implement multi-dimensional repeat operation and rename existing repeat method HOT 2
- [Tensor] Add `cumsum` operation HOT 1
- .select_assign does not work with Autodiff<NdArray> backend
- Add indentation in contributing book
- Text classification example gives "Shader validation error" when run on multiple GPUs HOT 4
- Upgrade all dependencies
- Better memory management in Burn Compute
- Config Derive: Generic Types?
- Optimizer / Visitor / Mapper confusion, no documentation HOT 2
- clamp_min does not handle -inf correctly on Autodiff<NdArray> backend
- Update tch to 0.16+
- Add multi-stream support to all the different backends.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from burn.