google-colaboratorytorchvision

Where are datasets downloaded using torchvision?


I'm new to Colab today.

When I download a dataset using torchvision like

trainset = torchvision.datasets.CIFAR10(root='./data', train=True, download=True)

My understanding is that I'm downloading the data to the folder ./data.

But where is ./data on my computer?

I'm on Windows 10.

Thanks.


Solution

  • As stated in an article from Towards Data Science:

    There is one big issue with Google Colab, often discussed before, which is the storage of your data. Notebooks, for example, Jupyter notebooks, often use data files stored locally, on your computer. This is often done using a simple read_csv statement or comparable. But Google Colaboratory is running in the Cloud. The Cloud’s local is not your local. Therefore a read_csv statement will search for the file on Google’s side rather than on your side. And then it will not find it.

    Short history: Downloaded data is stored temporaly at Cloud's local. If your colab notebook is disconnected then be sure such data is forever lost.

    How to fix that issue (lost of downloaded data): Use Google Drive along with Google Colaboratory notebooks. For more info about it read the mentioned article.