PyTorch implementations of the Vision Transformer and dozens of its variants
open sourceMITfree
vit-pytorch is Phil Wang's PyTorch implementation of the Vision Transformer (ViT), which classifies images with a single transformer encoder, together with many of its variants and follow-ups: Simple ViT, NaViT, distillation, Deep ViT, CaiT, Token-to-Token ViT, CCT, Cross ViT, PiT, LeViT, CvT, MaxViT, MobileViT and others, plus masked image modelling for self-supervised pretraining. It installs from PyPI.
Problems it solves
- train a vision transformer image classifier in PyTorch without writing the architecture myself
- try different vision transformer variants on my image dataset
- pretrain a vision model on unlabelled images with masked image modelling
Features
- Vision Transformer (ViT) in PyTorch
- many ViT variants (NaViT, CaiT, CvT, MaxViT, MobileViT and more)
- distillation from a convolutional teacher
- masked autoencoder and simple masked image modelling pretraining
Alternatives
The same job
These do what vit-pytorch does.
- timm (PyTorch Image Models) Large collection of PyTorch image models and backbones with pretrained weights and training scripts
- Transformers Hugging Face's Python library of model definitions for text, vision, audio and multimodal models
