Accessing '.pickle' file in Google Colab

Adhish Thite picture Adhish Thite · Mar 10, 2018 · Viewed 19.6k times · Source

I am fairly new to using Google's Colab as my go-to tool for ML.

In my experiments, I have to use the 'notMNIST' dataset, and I have set the 'notMNIST' data as notMNIST.pickle in my Google Drive under a folder called as Data.

Having said this, I want to access this '.pickle' file in my Google Colab so that I can use this data.

Is there a way I can access it?

I have read the documentation and some questions on StackOverflow, but they speak about Uploading, Downloading files and/or dealing with 'Sheets'.

However, what I want is to load the notMNIST.pickle file in the environment and use it for further processing.

Any help will be appreciated.

Thanks !

Answer

Bert Carremans picture Bert Carremans · Sep 28, 2018

You can try the following:

import pickle
drive.mount('/content/drive')
DATA_PATH = "/content/drive/Data"
infile = open(DATA_PATH+'/notMNIST.pickle','rb')
best_model2 = pickle.load(infile)