When you run a tutorial in Google Colab, there might be additional
requirements and dependencies that you need to meet in order
for the tutorial to work properly. This section contains notes on how to
configure various settings in order to successfully
run PyTorch tutorials in Google Colab.
PyTorch Version in Google Colab
Wen you are running a tutorial that requires a version of PyTorch that has
just been released, that version might not be yet available in Google Colab.
To check that you have the required torch and compatible domain libraries
installed, run .
!piplist
If the installed version of PyTorch is lower than required,
uninstall it and reinstall again by running the following commands:
We’ve added a new feature to tutorials that allows users to open the
notebook associated with a tutorial in Google Colab. You may need to
copy data to your Google drive account to get the more complex tutorials
to work.
In this example, we’ll demonstrate how to change the notebook in Colab
to work with the Chatbot Tutorial. To do this, you’ll first need to be
logged into Google Drive. (For a full description of how to access data
in Colab, you can view their example notebook
here.)
We’re now pointing to the file we uploaded to Drive.
Now when you click the Run cell button for the code section,
you’ll be prompted to authorize Google Drive and you’ll get an
authorization code. Paste the code into the prompt in Colab and you
should be set.
Rerun the notebook from the Runtime / Run All menu command and
you’ll see it process. (Note that this tutorial takes a long time to
run.)
Hopefully this example will give you a good starting point for running
some of the more complex tutorials in Colab. As we evolve our use of
Colab on the PyTorch tutorials site, we’ll look at ways to make this
easier for users.
Enabling CUDA
Some tutorials require a CUDA-enabled device (NVIDIA GPU), which involves
changing the Runtime type prior to executing the tutorial.
To change the Runtime in Google Colab, on the top drop-down menu select Runtime,
then select Change runtime type. Under Hardware accelerator, select T4GPU,
then click Save.