Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How To downgrade Torch Version for Google Colab

I would like to downgrade the Torch version used in my Google Colab notebooks. How could I do that?

like image 871
Sara Djaroud Avatar asked Apr 17 '20 13:04

Sara Djaroud


People also ask

How do I change the PyTorch version in Colab?

Just use !pip uninstall torch -y to skip the confirmation prompt.

How do I install an old version of PyTorch?

Download and install Anaconda (choose the latest Python version). Go to PyTorch's site and find the get started locally section. Specify the appropriate configuration options for your particular environment. Run the presented command in the terminal to install PyTorch.

Does PyTorch work on Google Colab?

Combining PyTorch and Google's cloud-based Colab notebook environment can be a good solution for building neural networks with free access to GPUs.


1 Answers

Run from your cell:

!pip install torch==version

Where version could be, for example, 1.3.0 (default is 1.4.0). You may have to downgrade torchvision appropriately as well so you would go with:

!pip install torch==1.3.0 torchvision==0.4.1

On the other hand PyTorch provides backward compatibility between major versions so there should be no need for downgrading.

Remember you have to restart your Google Colab for changes to take effect

like image 153
Szymon Maszke Avatar answered Sep 17 '22 09:09

Szymon Maszke