DailyGlimpse

fastai Models Now Easily Shareable on Hugging Face Hub with One Line of Code

AI
April 26, 2026 · 5:36 PM
fastai Models Now Easily Shareable on Hugging Face Hub with One Line of Code

The fastai deep learning library has officially integrated with the Hugging Face Hub, allowing practitioners to upload and share their trained models with a single line of Python code. This collaboration aims to democratize machine learning by making pre-trained models more accessible to the community.

fastai is an open-source library built on PyTorch that simplifies training neural networks for text, vision, and tabular data. The ecosystem also includes educational resources like the popular fastbook and courses. By joining the Hub, fastai users can now push their Learner objects—which bundle a model, data loaders, and loss function—to the platform effortlessly.

To share a model, users first create a Hugging Face account and log in via huggingface-cli login or notebook_login. Then they can use the new push_to_hub_fastai function, specifying the Learner and a repository ID. For example:

from huggingface_hub import push_to_hub_fastai

repo_id = "username/my-fastai-model"
push_to_hub_fastai(learner=learn, repo_id=repo_id)

The uploaded model automatically gets a model card and is listed on the Hub with the fastai library tag, making it discoverable by others. The Hub also provides version control via Git and large file storage (git-lfs).

This integration not only amplifies the reach of fastai models but also fosters collaboration. Users can leverage transfer learning by downloading and fine-tuning models shared by others. The fastai community, including Jeremy Howard and other contributors, provided feedback during development.

For a full tutorial, check out the accompanying Colab notebook. Start sharing your fastai models on the Hugging Face Hub today!