Package: fastai-bottleneck-1-1-1
fastaiThe fastai library simplifies training fast and accurate neural nets using modern best practices. See thefastai websiteto get started. The library is based on research into deep learning best practices undertaken atfast.ai, and includes "out of the box" support forvision,text,tabular, andcollab(collaborative filtering) models. For brief examples, see theexamplesfolder; detailed examples are provided in the fulldocumentation. For instance, here's how to train an MNIST model usingresnet18(from thevision example):untar_data(MNIST_PATH)data=image_data_from_folder(MNIST_PATH)learn=cnn_learner(data,tvm.resnet18,metrics=accuracy)learn.fit(1)Note forcourse.fast.aistudentsThis document is written forfastai v1, which we use for the current, third version of part 1 of thecourse.fast.aideep learning course. If you're following along with a course atcourse18.fast.ai—that is, part 2 of the deep learning course, or the machine learning course (which aren't yet updated for v1)—you need to usefastai 0.7;  please follow the installation instructionshere.Note: If you want to dive deep into fastai, Jeremy Howard, its lead developer, will be showing internals and advanced features inDeep Learning Part IIat the University of San Francisco from March 18th, 2018.InstallationNB:fastai v1 currently supports Linux only, and requiresPyTorch v1andPython 3.6or later. Windows support is at an experimental stage: it should work fine but we haven't thoroughly tested it. Since Macs don't currently have good Nvidia GPU support, we do not currently prioritize Mac development.fastai-1.xcan be installed with eithercondaorpippackage managers and also from source. At the moment you can't just runinstall, since you first need to get the correctpytorchversion installed - thus to getfastai-1.xinstalled choose one of the installation recipes below using your favorite python package manager. Note thatPyTorch v1andPython 3.6are the minimal version requirements.It's highly recommended you installfastaiand its dependencies in a virtual environment (condaor 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 forfastai.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. Butyou can install the cpu build too.If you experience installation problems, please read aboutinstallation issues.If you are planning on usingfastaiin the jupyter notebook environment, make sure to also install the correspondingpackages.More advanced installation issues, such as installing only partial dependencies are covered in a dedicatedinstallation doc.Conda Installcondainstall-cpytorch-cfastaifastaiThis will install thepytorchbuild with the latestcudatoolkitversion. If you need a higher or lowerCUDA XXbuild (e.g. CUDA 9.0), following the instructionshere, to install the desiredpytorchbuild.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):condauninstall--forcejpeglibtiff-y
condainstall-cconda-forgelibjpeg-turboCC="cc -mavx2"pipinstall--no-cache-dir-U--force-reinstall--no-binary:all:--compilepillow-simdIf you only care about faster JPEG decompression, it can bepilloworpillow-simdin the last command above, the latter speeds up other image processing operations. For the full story seePillow-SIMD.PyPI InstallpipinstallfastaiBy default pip will install the latestpytorchwith the latestcudatoolkit. If your hardware doesn't support the latestcudatoolkit, follow the instructionshere, to install apytorchbuild that fits your hardware.Bug Fix InstallIf 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 offastaiwith:pip install git+https://github.com/fastai/fastai.gitDeveloper InstallThe following instructions will result in apip editable install, so that you cangit pullat any time and your environment will automatically get the updates:gitclonehttps://github.com/fastai/fastaicdfastai
tools/run-after-git-clone
pipinstall-e".[dev]"Next, you can test that the build works by starting the jupyter notebook:jupyternotebookand executing an example notebook. For example loadexamples/tabular.ipynband run it.Please refer toCONTRIBUTING.mdandNotes For Developersfor more details on how to contribute to thefastaiproject.Building From SourceIf for any reason you can't use the prepackaged packages and have to build from source, this section is for you.To buildpytorchfrom source follow thecomplete instructions. Remember to first install CUDA, CuDNN, and other required libraries as suggested - everything will be very slow without those libraries built intopytorch.Next, you will also need to buildtorchvisionfrom source:gitclonehttps://github.com/pytorch/visioncdvision
pythonsetup.pyinstallWhen bothpytorchandtorchvisionare installed, first test that you can load each of these libraries:importtorch
importtorchvisionto validate that they were installed correctlyFinally, proceed withfastaiinstallation as normal, either through prepackaged pip or conda builds or installing from source ("the developer install") as explained in the sections above.Installation IssuesIf the installation process fails, first make sureyour system is supported. And if the problem is still not addressed, please refer to thetroubleshooting document.If you encounter installation problems with conda, make sure you have the latestcondaclient (conda installwill do an update too):condainstallcondaIs My System Supported?Python: You need to have python 3.6 or higherCPU or GPUThepytorchbinary 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 usepytorchbuild with CUDA 10.0 libraries without any problem, since thepytorchbinary package is self-contained.The only requirement is that you have installed and configured the NVIDIA driver correctly. Usually you can test that by runningnvidia-smi. While it's possible that this application is not available on your system, it's very likely that if it doesn't work, than your don't have your NVIDIA drivers configured properly. And remember that a reboot is always required after installing NVIDIA drivers.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 1.0 version supports:PlatformGPUCPUlinuxbinarybinarymacsourcebinarywindowsbinarybinaryLegend:binary= can be installed directly,source= needs to be built from source.If there is nopytorchpreview conda or pip package available for your system, you may still be able tobuild it from source.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-builtpytorchreleases:CUDA ToolkitNVIDIA (Linux x86_64)CUDA 10.0>= 410.00CUDA 9.0>= 384.81CUDA 8.0>= 367.48So 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 variationshere.If you use NVIDIA driver 410+, you most likely want to install thecudatoolkit=10.0pytorch variant, via:condainstall-cpytorchpytorchcudatoolkit=10.0or if you need a lower version, use one of:condainstall-cpytorchpytorchcudatoolkit=8.0
condainstall-cpytorchpytorchcudatoolkit=9.0For other options refer to the complete list ofthe available pytorch variants.UpdatesIn order to update your environment, simply installfastaiin exactly the same way you did the initial installation.Top level filesenvironment.ymlandenvironment-cpu.ymlbelong to the old fastai (0.7).conda env updateis no longer the way to update yourfastai-1.xenvironment. 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 - underold/.Contribution guidelinesIf you want to contribute tofastai, be sure to review thecontribution guidelines. This project adheres to fastai'scode of conduct. By participating, you are expected to uphold this code.We use GitHub issues for tracking requests and bugs, so please seefastai forumfor general questions and discussion.The fastai project strives to abide by generally accepted best practices in open-source software development:HistoryA detailed history of changes can be foundhere.CopyrightCopyright 2017 onwards, fast.ai, 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.