Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to download large files (like weights of a model) from Colaboratory?

I have tried downloading small files from google Colaboratory. They are easily downloaded but whenever I try to download files which have a large sizes it shows an error? What is the way to download large files?

like image 638
shivin saluja Avatar asked Mar 22 '18 12:03

shivin saluja


People also ask

How do I download weights from Google Colab?

How to link your Google Drive in your Google Colab notebook. Second, copy the file from your Google Colab notebook to your Google Drive. This requires us to specify (1) the path of the file we want to copy (our weights, in this case) and (2) the location of where we're saving the weights in our Google Drive.

Can you download files from Google Colab?

How to download a file created in Google Colab workspace? To download a file for Colab lib use, however, you will need to use the Google Chrome Browser. If you are using Firefox, then this won't work. Once executed, this will download the file directly to your downloads.

How do I download all files from a folder in Colab?

How to Download Folders from Colab. The command is !zip followed by r which means “recursive”, then we write the file path of the zipped file (i.e. /content/sample_data. zip ) and finally, we write the folder that we want to zip (i.e. /content/sample_data ) and voila, the zip file is generated :-).


1 Answers

If you have created a large zip file, say my_archive.zip, then you can download it as following:

  1. Mount your Google drive from your Google colab Notebook. You will be asked to enter a authentication code.
from google.colab import drive
drive.mount('/content/gdrive',force_remount=True)
  1. Copy the zip file to any of your google drive folder (e.g. downloads folder). You may also copy the file on 'My Drive' which is a root folder.
!cp my_archive.zip '/content/gdrive/My Drive/downloads/'
!ls -lt '/content/gdrive/My Drive/downloads/' 

Finally, you can download the zip file from your Google drive to your local machine.

like image 125
codefun Avatar answered Sep 20 '22 12:09

codefun