Getting setup with Fast.ai for Machine Learning

Abhimanyu Aryan | March 11, 2019 · 2 min read

Edit on GithubEdit on Github

Howdy guys, I’m writing this blog post for people who own not so good enough laptops equiped with GPUs, over that a poor internet connection & still want to learn ML from fast.ai

Now sadly some of us feel that setting up development environment is complete waste of time and energy. If you are one of those people, this blog post will make a lot of sense for you.

Free Options

  • Kaggle
  • Google Colab + Github
  • AWS

Kaggle

Kaggle is an amazing platform if you want to start really quick. You don’t have to download datasets. Downloading datasets on any kind of platform is complete waste of resources and bandwidth. Datasets size range from some GBs-TBs, I believe you definitely won’t like spending time on that


To be able to use fast.ai library you need to first install it. In you code field you write
!pip install fastai==0.7.0

The above command will install fast.ai library for you

A sample Kaggle Jupyter Notebook for predicting NYC Taxi Fair prices: https://www.kaggle.com/abhimanyuaryan/new-york-city-taxi-fare-prediction/


add_data

By default you datasets gets added to input directory

PATH="../input/"
df_raw = pd.read_csv(f'{PATH}train.csv', nrows = 50_000_000)

~Happy Hacking~

Google Colab

Google Colaborate will provide you free GPU. You can download sets on Google Colab in two ways:
First of all create an .ipnyb notebook on your local machine. Make it Git repository. Push it to Github. Then go to https://colab.research.google.com and load you Github repository link from Google Colab

colab

Ways to download dataset:

  • Curl
curl link_to_dataset

as shown in video by Jeremy: https://youtu.be/CzdWqFTmn0Y?t=969

  • Kaggle API

First you need to download Kaggle API key. It’s a json file

kaggle

Once you have the API key. Go to

  1. Import Kaggle API Keys to Google Colab
from google.colab import files
files.upload()
  1. Install Kaggle API Client
# Install the Kaggle API Client
!pip install -q kaggle

Open complete notebook in colab here. Click on this button: colab

Last but not least AWS

Jeremy has himself made an AWS starter video: https://course.fast.ai/lessons/aws.html. But AWS will cost you around $0.9/hr for p2 instance. See for yourself if you can afford it or not

pricing

machine

jupyter

Written by

Abhimanyu Aryan

Hi, I'm Abhimanyu Aryan, Deep Learning practitioner. Click here if you want know more about me or checkout my portfolio.