FastAI Library

This is the default environment file that is parsed when you run the command:
conda env update
It installs all the requirements for the FastAI library to run using Pytorch with GPU support.
This file does not contain cuda90 and cudnn as dependencies and is meant to install an environment that does NOT have GPU support. You can install this environment by running:
conda env create -f environment-cpu.yml
Import Files
These files serve the sole purpose of importing other libraries into the namespace. By importing these files, you get to importing ALL the dependencies.
This file contains:
- imports of torch specific modules
- wrapper functions to Pytorch's save and load functions
- functions to load standard models with an option of using pretrained parameters
This file imports all non-pytorch related modules associated with:
- Images - PIL
- Jupyter - IPython
- File/path manipulation - glob, pathlib
- Pandas
- Scikit learn
- Plots - matplotlib, seaborn
- Progress bar - tqdm
Models available to load
The following are the models available to load. Clicking on the link will take you to the ArXiv paper about the model. First is the function name followed by the model name.
1) inception_4 - inceptionv4
2) inceptionresnet_2 - InceptionResnetV2
3) resnext50 - resnext_50_32x4d
4) resnext101 - resnext_101_32x4d
5) resnext101_64 - resnext_101_64x4d
6) wrn - wrn_50_2f
7) dn121 - densenet121
8) dn161 - densenet161
9) dn169 - densenet169
10) dn201 - densenet201
11) vgg16 - vgg16_bn
12) vgg19 - vgg19_bn
Environment Files
These files contain all the dependencies to set up the Anaconda environment for the FastAI library
Learners
The FastAI library contains different "learners" for different functionality. There is a base learner from which other learners inherit from.
Description
This file contains the main StructuredLearner and the CollabFilterLearner class both of which inherits from the Learner class.

All learners have an associated:
- model object
- dataset object  
- data model

This file also contains a pytorch model that handles continuous and categorical values known as MixedInputModel
Description
From the docstring:
"Combines a ModelData object with nn.Module object, such that you can train that module"

This file contains ONLY the Learner class that serves as a base class for other specific learners
Important Methods
List of important methods with a brief description:
- from_model_data: Alternate constructor to create instance from already defined model
Important Attributes
List of important attributes:
Properties
- self.model: returns the model
- self.data: returns the data_
- self.children
Training
- self.fit: Primary method called for training. 
- self.fit_opt_sched: This method uses the concept of different phases of training. This notebook explains how to use this.

Both these methods ultimately call fit_gen after setting everything up.
self.fit_gen() method
After adding any callbacks and doing a more prep work, this method calls the fit() function in model.py.

NOTE: This fit function should IS NOT the same as the self.fit method.
Description
fit() function
This function runs the main training loop that loops through the data for the number of given epochs, performs SGD with Pytorch and fits a model to the data. It calculates the training loss, validation loss, calls any callbacks and finally returns the validation loss
Learning Rate Finding
Helps find the optimal learning rate based on "Cyclical Learning Rates for Training Neural Networks"
- self.lr_find: Basic learning rate finder as implemented in the paper
- self.lr_find2: variant of lr_find where it runs for number of iterations vs number of epochs thus it is slower than lr_find
Layer Optimizer
Description
Prediction Methods
Methods to perform prediction. Most of the functions take an is_test boolean which when set to True predicts on the test set. Otherwise predictions are done on the training set.
- self.predict: 
Prediction Functions
Description
Columnar Data
Description
Collaboration Filter
Description
Data
The FastAI library comes two main classes to handle data split into two files. These classes package the data with other metadata about it (such as its location) along with providing functions to load and yield data batches in a convenient form to be processed by the learners and the GPU
Description
Contains helper functions and classes for manipulating Datasets and Models.
BaseDataset
Abstract class that inherits from Pytorch's Dataset class and provides a number of virtual methods that needs be overridden by the derived classes.
FilesDataset
Description
FilesArrayDataset
Description
FilesNhotArrayDataset
Description
FilesIndexArrayRegressionDataset
Defines a method which returns true if the task is a regression task.
ArraysDataset
Description
Functions
Description
ArraysIndexDataset
Description
ArraysNhotDataset
Description
ModelData
Description
ImageData
Description
ImageClassifierData
Description
   Login to remove ads X
Feedback | How-To