Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing '.pickle' file in Google Colab

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 !

like image 440
Adhish Thite Avatar asked Mar 10 '18 07:03

Adhish Thite


3 Answers

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)
like image 123
Bert Carremans Avatar answered Oct 31 '22 19:10

Bert Carremans


The data in Google Drive resides in a cloud and in colaboratory Google provides a personal linux virtual machine on which your notebooks will run.so you need to download from google drive to your colaboratory virtual machine and use it. you can follow this download tutorial

like image 28
Poorna Prudhvi Avatar answered Oct 31 '22 19:10

Poorna Prudhvi


Thanks, guys, for your answers. Google Colab has quickly grown into a more mature development environment, and my most favorite feature is the 'Files' tab.

We can easily upload the model to the folder we want and access it as if it were on a local machine.

This solves the issue.

Thanks.

like image 24
Adhish Thite Avatar answered Oct 31 '22 18:10

Adhish Thite