DEV Community

Cover image for Pre-compiled pytorch versions
MoniqueLive
MoniqueLive

Posted on

Pre-compiled pytorch versions

I had just found about a repository that just saved my bacon so I decided to share it with you guys.

If you go to pytorch's website, you'll be given a lot of choices to install it:

Alt Text

The thing is, if you want to install a different version than the one listed (1.7.1 as of today) you'll begin a not very pleasant treasure hunt.

There's a repo that somehow took me quite a while to find here:

https://download.pytorch.org/whl/torch_stable.html
Enter fullscreen mode Exit fullscreen mode

But you don't need to click on it! You can ask pip to fetch it for you:

pip[3] install pytorch==1.6.0+cu101 -f https://download.pytorch.org/whl/torch_stable.html
Enter fullscreen mode Exit fullscreen mode

And voilá, your package will be installed automagically!

Now some extra tips:

  1. Some cuda versions are considered "default". For instance if you look for 1.6.0+cu102 you won't find it, that's because installing pip install cuda==1.6.0 will automatically fetch cuda's 10.2 version.

  2. If you're a masochist and need the CPU-only version: pip install 1.6.0+cpu

  3. To save this repo on your requirements.txt, just add this as the first line of it:

-f https://download.pytorch.org/whl/torch_stable.html

...
torch==1.6.0+cu110
...
Enter fullscreen mode Exit fullscreen mode

Happy torching!

Top comments (0)