ThatGuySam / doesitarm

🦾 A list of reported app support for Apple Silicon as well as Apple M4 and M3 Ultra Macs

Home Page:https://doesitarm.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PyTorch

Cat7373 opened this issue Β· comments

commented

The official name of the app
Pytorch

Is there a supported version available on a stable release channel?
Unknown

Proposed App Status
Unknown

Proposed App Category
Developer Tools

Related Issue Tracker Link or discussion
None

An Official App Download Page
https://pytorch.org

Additional context
None

Full Screenshot with the App and Activity Monitor(if self reporting) or Silicon Info
None

There are several clues about the supports of pytorch on M1 chip.
Using ARM64 wheel and arm version of Conda: pytorch/pytorch#48145
Still cannot accelerate via neural engine: pytorch/pytorch#47702
It seems that pytorch cannot build from source via python3.9 (universal 2 version, latest release): pytorch/pytorch#44449

BTW, although pytorch can work "just ok" via M1, many tools are still lack of supports, including Scipy, matplotlib and so on. And IDEs are also far from optimized like Pycharm.

@Cat7373 Thanks for the App Request!

It looks like it's not clear that it works well enough for production on Apple Silicon.

Next we'll need to see if it works via Rosetta 2.

See: pytorch/pytorch#48524
We can currently install torch with arm version pip; or we can build torch from source nightly.

Honestly, I'm not super familiar with Pytorch.

Would you say that it can be installed and run as a Python developer would expect it to?

I can confirm that pytorch works well under Rosetta. It seems there are still some issues with installing it through pip (at least for me), so developers need to build it from source, which is possible but kind of tricky at the moment since some people are having issues with OpenMP linking. So probably should not be listed as "native" just yet depending on how strict you want to be with that designation

I just try on my MacBook Air 13 with M1, and pip works greatly installing pytorch.

liyucheng@liyuchengdeMacBook-Air ~ % which pip3
/Library/Frameworks/Python.framework/Versions/3.9/bin/pip3
liyucheng@liyuchengdeMacBook-Air ~ % pip3 install torch
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Collecting torch
  Downloading https://mirrors.aliyun.com/pypi/packages/79/c8/7f7843dcbaf2263918d257e8022770be577a3d7587dd0ddf8171947eabb4/torch-1.7.1-cp39-none-macosx_10_9_x86_64.whl (110.0 MB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 110.0 MB 142 kB/s 
Collecting typing-extensions
  Downloading https://mirrors.aliyun.com/pypi/packages/60/7a/e881b5abb54db0e6e671ab088d079c57ce54e8a01a3ca443f561ccadb37e/typing_extensions-3.7.4.3-py3-none-any.whl (22 kB)
Requirement already satisfied: numpy in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from torch) (1.19.4)
Installing collected packages: typing-extensions, torch
Successfully installed torch-1.7.1 typing-extensions-3.7.4.3
WARNING: You are using pip version 20.2.3; however, version 20.3.3 is available.
You should consider upgrading via the '/Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 -m pip install --upgrade pip' command.
liyucheng@liyuchengdeMacBook-Air ~ % python3
Python 3.9.0 (v3.9.0:9cf6752276, Oct  5 2020, 11:29:23) 
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> 

Note that you should use the latest version python on python.org rather than the python in the Apple CommandLineTools.

Honestly, I'm not super familiar with Pytorch.

Would you say that it can be installed and run as a Python developer would expect it to?

Yes, but the speed is quite slow than the other neural network platform TensorFlow which is optimized on Apple M1. Therefore, it still needs further updates I think.

App is now live on the site!

https://doesitarm.com/app/pytorch/

We'll keep this issue open for when native Apple Silicon support drops via pip on the stable release channel

@liyucheng09 have you tried to see if GPU supports work, doing something like this?

device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
print('Using device:', device)

reply to @mtrazzi

>>> import torch
>>> device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
>>> device
device(type='cpu')

@mtrazzi It is almost impossible for developers of pytorch to support Apple M1 GPU. So, the best situation I can expect is pytorch can release an original arm version.

@liyucheng09 have you tried to see if GPU supports work, doing something like this?

device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
print('Using device:', device)

@mtrazzi Even on previous Intel-based Macs, Pytorch's support for GPU has been discontinued for years. The official releases of PyTorch for macOS have always been CPU-only.

It is now available through miniforge: pytorch/pytorch#48145 (comment)

@iliailmer So you're saying PyTorch can now be considered working and stable on Apple Silicon?

@ThatGuySam I think so, but I may be wrong. I will be using it myself on my Silicon machine soon and so far I see no reason to believe it is unstable.

It looks like the ARM64 Binary is also listed here and here

We'll go ahead and upgrade PyTorch to the following status:
βœ… Yes, Initial Native Apple Silicon Support for CPU only

And we'll link to the following for updates on GPU support:
pytorch/pytorch#47702

Something M1 GPU-related is coming...
pytorch/pytorch#47702 (comment)

PyTorch public beta should be available in ~4 months time.

pytorch/pytorch#47702 (comment)

PyTorch public beta should be available in ~4 months time.

SIKE!