fastai2
- Version:
2.5.1
- Category:
ai
- Cluster:
Loki
Description
fastai2 (also known as fastai v2) is a high-level deep learning library built on top of PyTorch, offering concise APIs for training models quickly and efficiently. Version 2.5.1 is the last release of the fastai v2 branch before returning to the fastai naming convention.
Key features:
Simplified training loops with powerful callbacks and schedulers
High-level wrappers for computer vision, text, tabular, and time-series models
Automatically handles data preprocessing, augmentation, and model fitting
Deep integration with PyTorch and NumPy
Jupyter-friendly API for experimentation and reproducibility
Documentation
$ python -c "import fastai; print(fastai.__version__)"
Common submodules:
fastai.vision - Computer vision
fastai.text - NLP workflows
fastai.tabular - Structured/tabular data
fastai.callback - Training callbacks
fastai.learner - Model training engine
Check GPU availability:
>>> from fastai.torch_core import default_device
>>> default_device()
Full documentation:
https://docs.fast.ai/
Examples/Usage
Load the module:
$ module load fastai2-py37-cuda10.2-gcc8/2.5.1
Start Python and import fastai2:
from fastai.vision.all import *
from fastai.tabular.all import *
from fastai.text.all import *
Run a training example:
path = untar_data(URLs.PETS)
files = get_image_files(path/"images")
dls = ImageDataLoaders.from_name_func(
path, files, label_func=lambda x: x[0].isupper(), item_tfms=Resize(224))
learn = cnn_learner(dls, resnet34, metrics=error_rate)
learn.fine_tune(1)
Unload the module:
$ module unload fastai2-py37-cuda10.2-gcc8/2.5.1