Skip to content

Commit

Permalink
allow PyTorch 1.9 as minimum requirement, fix PyTorch install on mac
Browse files Browse the repository at this point in the history
  • Loading branch information
divideconcept authored Mar 2, 2022
1 parent cfeaa3f commit 4e41431
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion torchstudio/pythoncheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
else:
from importlib.metadata import version
pytorch_version=tuple(int(i) for i in version('torch').split('.')[:2])
min_pytorch_version=(1,9) if args.remote else (1,10) #1.9 required for torch.package support, 1.10 required for stable torch.fx and profile-directed typing in torchscript
min_pytorch_version=(1,9) #1.9 required for torch.package support, 1.10 preferred for stable torch.fx and profile-directed typing in torchscript
if pytorch_version<min_pytorch_version:
print("Error: PyTorch "+str(min_pytorch_version[0])+"."+str(min_pytorch_version[1])+" minimum is required.", file=sys.stderr)
print("This environment has PyTorch "+str(pytorch_version[0])+"."+str(pytorch_version[1])+".", file=sys.stderr)
Expand Down
5 changes: 3 additions & 2 deletions torchstudio/pythoninstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
else:
conda_install="pytorch torchvision torchaudio cpuonly datasets scipy pandas matplotlib-base python-graphviz paramiko pysoundfile"
elif sys.platform.startswith('darwin'):
conda_install="nomkl pytorch torchvision torchaudio datasets scipy pandas matplotlib-base python-graphviz paramiko"
# force a pytorch/mkl version, because pytorch 1.10.2+ depends on mkl 2022 which is incompatible with Rosetta 2 in M1 macs
conda_install="pytorch==1.10.1 torchvision==0.11.2 torchaudio==0.10.1 mkl==2021.4.0 datasets scipy pandas matplotlib-base python-graphviz paramiko"
elif sys.platform.startswith('linux'):
if args.gpu:
conda_install="pytorch torchvision torchaudio cudatoolkit=11.3 datasets scipy pandas matplotlib-base python-graphviz paramiko"
Expand All @@ -40,7 +41,7 @@
print(conda_install)
print("")

# channels: pytorch for pytorch torchvision torchaudio, nvidia for cudatoolkit=11.1 on Linux, huggingface for datasets(+huggingface_hub), conda-forge for everything else except anaconda for python-graphviz
# channels: pytorch for pytorch torchvision torchaudio, nvidia for cudatoolkit=11.1 on Linux, huggingface for datasets(+huggingface_hub), conda-forge for everything else except anaconda for python-graphviz and ngam for osx-arm64 torchaudio
conda_install+=" -c pytorch -c nvidia -c huggingface -c conda-forge -c anaconda"

# https://stackoverflow.com/questions/41767340/using-conda-install-within-a-python-script
Expand Down

0 comments on commit 4e41431

Please sign in to comment.