Skip to main content

fastai makes deep learning with PyTorch faster, more accurate, and easier

Project description

fastai

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 in to deep learning best practices undertaken at fast.ai, and includes "out of the box" support for vision, text, tabular, and collab (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):

untar_data(MNIST_PATH)
data = image_data_from_folder(MNIST_PATH)
learn = ConvLearner(data, tvm.resnet18, metrics=accuracy)
learn.fit(1)

Note for course.fast.ai students

If you are using fastai for any course.fast.ai course, please do NOT install fastai from pip or conda using the instructions below; the instructions below are for fastai v1, but the courses use fastai 0.7. For the courses, you should simply follow the instructions in the course (i.e. clone this repo, cd to it, and conda env update), and the notebooks will work (there is a symlink to old/fastai/, which is fastai 0.7, in each course notebook directory), or else use pip install fastai==0.7.0 to install the version compatible with the course.

Note: If you want to learn how to use fastai v1 from its lead developer, Jeremy Howard, he will be teaching it in the Deep Learning Part I course at the University of San Francisco from Oct 22nd, 2018.

Conda Install

Follow the following 2 steps in this exact order:

  1. Install the nightly pytorch build, with cudaXX package version matching your system's setup. For example, for CUDA 9.2:

    conda install -c pytorch pytorch-nightly cuda92
    

    If you have a different CUDA version, find the right build here. Choose Preview/Your OS/Conda/Python3.6|Python3.7 and your CUDA version and it will give you the correct install instruction. Instructions to build pytorch from source are provided at the same location.

    If your system doesn't have CUDA, you can install the CPU-only pytorch build:

    conda install -c pytorch pytorch-nightly-cpu
    
  2. Install fastai:

    conda install -c fastai fastai
    

    NB: We are currently using a re-packaged torchvision as torchvision-nightly in order to support pytorch-nightly, which is required for using fastai.

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

conda update conda

If the issue persists, please read about installation issues.

PyPI Install

Follow the following 3 steps in this exact order:

  1. Install the nightly pytorch build, with cudaXX package version matching your system's setup. For example for CUDA 9.2:

    pip install torch_nightly -f https://download.pytorch.org/whl/nightly/cu92/torch_nightly.html
    

    If you have a different CUDA version, find the right build here. Choose Preview/Your OS/Pip/Python3.6|Python3.7 and your CUDA version and it will give you the correct install instruction. Instructions to build pytorch from source are provided at the same location.

  2. Install a custom torchvision build, that is built against torch_nightly.

    pip install torchvision-nightly
    

    previous approach:

    pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ torchvision
    
  3. Install fastai:

    pip install fastai
    

    On some setups, the last pip command still tries to get torch-0.4.1. If that happens to you, you may try:

    pip uninstall torchvision fastai
    pip install --no-deps torchvision
    pip install fastai
    

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

Developer Install

First, follow the instructions above for either PyPi or Conda. Then uninstall the fastai package using the same package manager you used to install it, i.e. pip uninstall fastai or conda uninstall fastai, and then, replace it with a pip editable install.

git clone https://github.com/fastai/fastai
cd fastai
tools/run-after-git-clone
pip install -e .[dev]

You can test that the build works by starting the jupyter notebook:

jupyter notebook

and executing an example notebook. For example load examples/tabular.ipynb and run it.

Alternatively, you can do a quick CLI test:

jupyter nbconvert --execute --ExecutePreprocessor.timeout=600 --to notebook examples/tabular.ipynb

If anything goes wrong please read and report installation issues.

Please refer to CONTRIBUTING.md and develop.md for more details on how to contribute to the fastai project.

Installation Issues

If the installation process fails, first make sure your system is supported. And if the problem is still not addressed, please see this installation issues thread.

Is My System Supported?

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

  2. 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 pytorch.org's pre-1.0.0 version (torch-nightly) supports:

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

    Legend: binary = can be installed directly, source = needs to be built from source.

    This will change once pytorch 1.0.0 is released and installable packages made available for your system, which could take some time after the official release is made. Please watch for updates here.

    If your system is currently not supported, please consider installing and using the very solid "v0" version of fastai. Please see the instructions.

Copyright

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

Changes

1.0.0 (2018-10-01)

  • First release

Project details


Release history Release notifications | RSS feed

This version

1.0.4

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastai-1.0.4.tar.gz (84.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fastai-1.0.4-py3-none-any.whl (94.3 kB view details)

Uploaded Python 3

File details

Details for the file fastai-1.0.4.tar.gz.

File metadata

  • Download URL: fastai-1.0.4.tar.gz
  • Upload date:
  • Size: 84.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.6

File hashes

Hashes for fastai-1.0.4.tar.gz
Algorithm Hash digest
SHA256 edea565ce436717df9bceb5bf3343375131ba1a0e210fd6e4b80fbbfb3a4d769
MD5 2787995d69c7cb47ab0a2713d67143e6
BLAKE2b-256 764c2f7ad6e2b6539cad56df60f36dc97a175db1b27c030bd81ce89526a45d18

See more details on using hashes here.

File details

Details for the file fastai-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: fastai-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 94.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.6

File hashes

Hashes for fastai-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f8a695c9cffa1ed1fb782c6dce675c457040163b3b0210c6d8fc39724783f9d1
MD5 e3480d0b7c06596aea5da0aa899cbc0c
BLAKE2b-256 d162d9c354bd2bf4211190f326fbc3d0ab37ccdc3fe62ef6cb0721e01934bff5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page