Github url


by fastai

fastai /fastai

The fastai deep learning library, plus lessons and tutorials

18.3K Stars 6.5K Forks Last release: Not found Apache License 2.0 5.4K Commits 66 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

Build Statuspypi fastai versionConda fastai version

Anaconda-Server Badgefastai python compatibilityfastai license


The fastai library simplifies training fast and accurate neural nets using modern best practices. See the fastai website to get started. The library is based on research into deep learning best practices undertaken at, and includes "out of the box" support for [


](, [


](, [


](, and [


]( (collaborative filtering) models. For brief examples, see the examples folder; detailed examples are provided in the full documentation. For instance, here's how to train an MNIST model using resnet18 (from the vision example):

from import \* path = untar\_data(MNIST\_PATH) data = image\_data\_from\_folder(path) learn = cnn\_learner(data, models.resnet18, metrics=accuracy)

Note for students

This document is written for

fastai v1

, which we use for the current version the deep learning courses. If you're following along with a course at (i.e. the machine learning course, which isn't updated for v1) you need to use

fastai 0.7

; please follow the installation instructions here.


NB: _fastai v1 currently supports Linux only, and requires *_PyTorch v1** and Python 3.6 or later. Windows support is at an experimental stage: it should work fine but it's much slower and less well tested. Since Macs don't currently have good Nvidia GPU support, we do not currently prioritize Mac development.*


can be installed with either




package managers and also from source. At the moment you can't just run install, since you first need to get the correct


version installed - thus to get


installed choose one of the installation recipes below using your favorite python package manager. Note that PyTorch v1 and Python 3.6 are the minimal version requirements.

It's highly recommended you install


and its dependencies in a virtual environment ([


]( or others), so that you don't interfere with system-wide python packages. It's not that you must, but if you experience problems with any dependency packages, please consider using a fresh virtual environment just for



Starting with pytorch-1.x you no longer need to install a special pytorch-cpu version. Instead use the normal pytorch and it works with and without GPU. But you can install the cpu build too.

If you experience installation problems, please read about installation issues.

If you are planning on using


in the jupyter notebook environment, make sure to also install the corresponding packages.

More advanced installation issues, such as installing only partial dependencies are covered in a dedicated installation doc.

Conda Install

conda install -c pytorch -c fastai fastai

This will install the


build with the latest


version. If you need a higher or lower


build (e.g. CUDA 9.0), following the instructions here, to install the desired



Note that JPEG decoding can be a bottleneck, particularly if you have a fast GPU. You can optionally install an optimized JPEG decoder as follows (Linux):

conda uninstall --force jpeg libtiff -y conda install -c conda-forge libjpeg-turbo pillow==6.0.0 CC="cc -mavx2" pip install --no-cache-dir -U --force-reinstall --no-binary :all: --compile pillow-simd

If you only care about faster JPEG decompression, it can be




in the last command above, the latter speeds up other image processing operations. For the full story see Pillow-SIMD.

PyPI Install

pip install fastai

By default pip will install the latest


with the latest


. If your hardware doesn't support the latest


, follow the instructions here, to install a


build that fits your hardware.

Bug Fix Install

If a bug fix was made in git and you can't wait till a new release is made, you can install the bleeding edge version of



pip install git+

Developer Install

The following instructions will result in a pip editable install, so that you can

git pull

at any time and your environment will automatically get the updates:

git clone cd fastai tools/run-after-git-clone pip install -e ".[dev]"

Next, you can test that the build works by starting the jupyter notebook:

jupyter notebook

and executing an example notebook. For example load


and run it.

Please refer to and Notes For Developers for more details on how to contribute to the



Building From Source

If for any reason you can't use the prepackaged packages and have to build from source, this section is for you.

  1. To build


from source follow the complete instructions. Remember to first install CUDA, CuDNN, and other required libraries as suggested - everything will be very slow without those libraries built into


. 2.

Next, you will also need to build


from source:

git clone cd vision python install
  1. When both
    are installed, first test that you can load each of these libraries:
import torch import torchvision

to validate that they were installed correctly

Finally, proceed with


installation as normal, either through prepackaged pip or conda builds or installing from source ("the developer install") as explained in the sections above.

Installation Issues

If the installation process fails, first make sure your system is supported. And if the problem is still not addressed, please refer to the troubleshooting document.

If you encounter installation problems with conda, make sure you have the latest


client (

conda install

will do an update too):

bash conda install conda

Is My System Supported?

  1. Python: You need to have python 3.6 or higher

  2. CPU or GPU



binary package comes with its own CUDA, CuDNN, NCCL, MKL, and other libraries so you don't have to install system-wide NVIDIA's CUDA and related libraries if you don't need them for something else. If you have them installed already it doesn't matter which NVIDIA's CUDA version library you have installed system-wide. Your system could have CUDA 9.0 libraries, and you can still use


build with CUDA 10.0 libraries without any problem, since the


binary package is self-contained.

The only requirement is that you have installed and configured the NVIDIA driver correctly. Usually you can test that by running


. While it's possible that this application is not available on your system, it's very likely that if it doesn't work, then you don't have your NVIDIA drivers configured properly. And remember that a reboot is always required after installing NVIDIA drivers.

  1. Operating System:

Since fastai-1.0 relies on pytorch-1.0, you need to be able to install pytorch-1.0 first.

As of this moment's 1.0 version supports:

| Platform | GPU | CPU | |----------|--------|--------| | linux | binary | binary | | mac | source | binary | | windows | binary | binary |



= can be installed directly,


= needs to be built from source.

If there is no


preview conda or pip package available for your system, you may still be able to build it from source.

  1. How do you know which pytorch cuda version build to choose?

It depends on the version of the installed NVIDIA driver. Here are the requirements for CUDA versions supported by pre-built



| CUDA Toolkit | NVIDIA (Linux x86\_64) | |--------------|-----------------------| | CUDA 10.0 | \>= 410.00 | | CUDA 9.0 | \>= 384.81 | | CUDA 8.0 | \>= 367.48 |

So if your NVIDIA driver is less than 384, then you can only use CUDA 8.0. Of course, you can upgrade your drivers to more recent ones if your card supports it.

You can find a complete table with all variations here.

If you use NVIDIA driver 410+, you most likely want to install the


pytorch variant, via:

bash conda install -c pytorch pytorch cudatoolkit=10.0

or if you need a lower version, use one of:

bash conda install -c pytorch pytorch cudatoolkit=8.0 conda install -c pytorch pytorch cudatoolkit=9.0

For other options refer to the complete list of the available pytorch variants.


In order to update your environment, simply install


in exactly the same way you did the initial installation.

Top level files




belong to the old fastai (0.7).

conda env update

is no longer the way to update your


environment. These files remain because the fastai course-v2 video instructions rely on this setup. Eventually, once fastai course-v3 p1 and p2 will be completed, they will probably be moved to where they belong - under



Contribution guidelines

If you want to contribute to


, be sure to review the contribution guidelines. This project adheres to fastai's code of conduct. By participating, you are expected to uphold this code.

We use GitHub issues for tracking requests and bugs, so please see fastai forum for general questions and discussion.

The fastai project strives to abide by generally accepted best practices in open-source software development:


A detailed history of changes can be found here.


Copyright 2017 onwards,, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this project's files except in compliance with the License. A copy of the License is provided in the LICENSE file in this repository.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.