timm

PyTorch Image Models (timm)

A huge collection of vision architectures and their pretrained weights for PyTorch, from CNNs to Vision Transformers.

ActiveMediumv1.0.31Apache-2.0Computer Vision & Image Processing

Official documentationTry the examples

Basic information

Nametimm
Full namePyTorch Image Models (timm)
CategoryComputer Vision & Image Processing
DeveloperRoss Wightman, hosted by Hugging Face
Release yearNot specified
Official websitegithub.com/huggingface/pytorch-image-models
GitHub repositoryhuggingface/pytorch-image-models
Official documentationhuggingface.co/docs/timm/en/index
Package on PyPItimm
LicenseApache-2.0 (PyPI license)
Project statusActive Had a release in the last 12 months
Latest version3 November 2026 (version 1.0.31)
Programming languagePython
Operating systemsNot specified
Required Python version>=3.10
Difficulty levelMedium

Data last checked: 21 November 2026 — source: PyPI JSON API (2026-11-21)

Overview

timm includes hundreds of architectures (ResNet, EfficientNet, ConvNeXt, ViT, Swin, DeiT and others) behind a unified timm.create_model API, with pretrained weights on the Hugging Face Hub, plus training tools, optimizers and learning-rate schedulers.

It is the practical reference for trying vision transformers and swapping the backbone in models.

When to choose it? Choose it to try modern vision architectures and vision transformers with ready weights.

Uses

Main uses

  • Transfer learning with modern architectures
  • Transfer learning with modern architectures
  • Trying vision transformers
  • Trying vision transformers
  • Feature extraction as a backbone for other models
  • Feature extraction as a backbone for other models

Scientific fields

  • Computer vision
  • Computer vision
  • Medical imaging
  • Medical imaging

Suitable project types

  • An image classifier with ViT or ConvNeXt
  • An image classifier with ViT or ConvNeXt

Research applications

  • Comparing vision architectures under unified settings
  • Comparing vision architectures under unified settings

Image classificationVision transformersConvolutional networks

Technical features

A feature is shown as "Supported" only if it is documented in the library's official documentation; anything we have not verified is shown as "Not specified".

CPU supportSupported
GPU supportSupported
CUDA compatibilitySupported
Distributed training or computingPartial or through an add-onThe included training script supports distribution.
Automatic differentiation (Autodiff)SupportedThrough PyTorch.
Model deploymentPartial or through an add-on
Pre-trained modelsSupported
Supported data typesPyTorch tensors
Integration with other librariesPyTorch, TorchVision, Hugging Face Transformers
Flexibility (editorial estimate)High
Performance (editorial estimate)High
Community (editorial estimate)Large
Documentation quality (editorial estimate)Documentation on Hugging Face

Installation and running

Shell
pip install timm

Compatibility: Python >=3.10 — according to the package data on PyPI, checked on 21 November 2026

Compatibility: Python >=3.10 — according to the package data on PyPI, checked on 21 November 2026

Installing inside a virtual environment (venv or conda) is recommended. If you need compatibility with a specific CUDA version or operating system, refer to the official documentation, because this information changes with every release.

Code examples

Examples marked "Run and tested" were actually run, with their output, test date and library versions recorded; the others need a GPU or model downloads, so they were not run in the test environment.

MediumCreating a Vision Transformer with timmRun and tested

Goal: Listing the available models and creating a small ViT with a custom number of classes.

Python — example.py
import timm, torch

print("Number of registered ViT models:", len(timm.list_models("vit_*")))
model = timm.create_model("vit_tiny_patch16_224", pretrained=False, num_classes=3).eval()
x = torch.randn(2, 3, 224, 224)
with torch.no_grad():
    feats = model.forward_features(x)
    logits = model(x)
print("Feature shape (batch, patches+CLS, dims):", tuple(feats.shape))
print("Output shape:", tuple(logits.shape))

Code explanation

list_models searches model names by pattern, and create_model creates the model. We use pretrained=False because the weights are downloaded from the Hugging Face Hub; in your project set it to True for transfer learning. forward_features returns the patch representation before the classification head.

Requirements

Shell
pip install timm torch

How to run

Save the code in a file example.py then run it:

Shell
python example.py

Output recorded during testing

Number of registered ViT models: 214
Feature shape (batch, patches+CLS, dims): (2, 197, 192)
Output shape: (2, 3)

This example was actually run and tested on 21 November 2026 on a CPU — timm 1.0.31, torch 2.15.0, python 3.13.18

Example page

All timm examples in the Code Explorer

Pros

  • The largest collection of vision architectures behind a unified API
  • Many pretrained weights

Limitations

  • Downloading weights requires access to the Hugging Face Hub
  • The many options can confuse beginners

References and verification

  • Package page on PyPI (source of the version, licence and release date) Checked directly

    https://pypi.org/project/timm/

    Checked on: 21 November 2026 — version checked: 1.0.31 — reviewed by: the DLArabic team

  • Official website A link the package officially declares on PyPI

    https://github.com/huggingface/pytorch-image-models

    Checked on: 21 November 2026 — reviewed by: the DLArabic team

  • Official documentation A link the package officially declares on PyPI

    https://huggingface.co/docs/timm/en/index

    Checked on: 21 November 2026 — reviewed by: the DLArabic team

  • Official repository A link the package officially declares on PyPI

    https://github.com/huggingface/pytorch-image-models

    Checked on: 21 November 2026 — reviewed by: the DLArabic team

  • Package page on PyPI (source of the version, licence and release date) Checked directly

    https://pypi.org/project/timm/

    Checked on: 21 November 2026 — version checked: 1.0.31 — reviewed by: the DLArabic team

  • Official website A link the package officially declares on PyPI

    https://github.com/huggingface/pytorch-image-models

    Checked on: 21 November 2026 — reviewed by: the DLArabic team

  • Official documentation A link the package officially declares on PyPI

    https://huggingface.co/docs/timm/en/index

    Checked on: 21 November 2026 — reviewed by: the DLArabic team

  • Official repository A link the package officially declares on PyPI

    https://github.com/huggingface/pytorch-image-models

    Checked on: 21 November 2026 — reviewed by: the DLArabic team

History of verified versions

VersionRelease dateChecked on
1.0.313 November 202621 November 2026

Page information last reviewed: 21 November 2026. The description was written originally for the encyclopedia and is not copied from the official websites.

Report information that needs updating