Mounting Google Drive Files in Colab

Is it necessary to mount Google Drive files in Colab if fastbook is used?

I have read some posts on this forum where fastai users suggest mounting Google Drive files in Collab to improve data access speeds using the following code:

from google.colab import drive
drive.mount('/content/gdrive', force_remount=True)

path = Path("/content/gdrive/...")
!ls /content/gdrive/MyDrive/'...'

However, fastbook seems to mount relevant files for you, as indicated by the printout:

!pip install -Uqq fastbook
import fastbook
     |████████████████████████████████| 720 kB 5.1 MB/s 
     |████████████████████████████████| 48 kB 5.0 MB/s 
     |████████████████████████████████| 1.2 MB 45.2 MB/s 
     |████████████████████████████████| 189 kB 50.9 MB/s 
     |████████████████████████████████| 55 kB 3.9 MB/s 
     |████████████████████████████████| 561 kB 45.2 MB/s 
     |████████████████████████████████| 51 kB 336 kB/s 
     |████████████████████████████████| 130 kB 45.3 MB/s 
Mounted at /content/gdrive

Hi Simon, you are correct. fastbook.setup_book() automatically does the Google Drive connect for you, so you don’t need to do the mounting step separately. See for example: deep learning - FastAI fastbook - what does it do and why do I need to setup a book? - Stack Overflow

Hi, could you provide links to the posts you mentioned regarding improving data access?
I am working on a classification project using fastai, and the training process is a lot slower when data is in Google drive than when data in content/ (download data every time when I reopen Colab).

Here are a few:

You will likely find more by searching for “mounting google drive” in the forums.


1 Like