How to upgrade to pytorch-nightly in google colab?

I got into problem , how can i solve this? I want to run pytorch-nightly on colab, I have all codes in pytorch-nightly version because of new packages in it,

I tried to search about this and tried this code but it is not working even after restarting runtime

from os.path import exists
cuda_output = !ldconfig -p|grep cudart.so|sed -e 's/.*\.\([0-9]*\)\.\([0-9]*\)$/cu\1\2/'
accelerator = cuda_output[0] if exists('/dev/nvidia0') else 'cpu'
!pip install torchvision_nightly
!pip install torch_nightly -f https://download.pytorch.org/whl/nightly/{accelerator}/torch_nightly.html

Help!!

1 answer

  • answered 2020-10-16 04:55 kHarshit

    You're using the wrong package name, as mentioned on the pytorch website use this:

    !pip install --pre torch torchvision -f https://download.pytorch.org/whl/nightly/cu102/torch_nightly.html -U
    

    Here, -U option is for upgrade (as there is already pytorch stable version installed on colab).