Python deep learning libraries

Updated Nov 2026

Python deep learning libraries define neural networks, compute their gradients, and train them on GPUs and other accelerators. These libraries train and run the models behind language, vision, and speech features in apps.

Popularity

PyTorch has the most monthly downloads in this comparison, at 59.4M.

LibraryMonthly downloadsStarsLast releaseLicense
Transformers
119.8M
169.2KNov 2026Apache 2.0 License
PyTorch
59.7M
105.7KOct 2026Apache-2.0 AND Apache-2.0 WITH LLVM-exception AND BSD-2-Clause AND BSD-3-Clause AND BSL-1.0 AND ISC AND MIT AND Zlib
JAX
12.6M
36.6KNov 2026Apache-2.0
TensorFlow
12.4M
201.6KMar 2026Apache-2.0
Keras
12.0M
64.4KJul 2026Apache-2.0
PyTorch Lightning
11.6M
31.4KSep 2026Apache-2.0
Flax
2.7M
7.4KOct 2026Apache-2.0
Equinox
1.7M
3.0KMay 2026Apache-2.0
Downloads: PyPI, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

Libraries and code examples

Transformers defines model architectures for text, vision, audio, video, and multimodal tasks, and loads pretrained weights for them from the Hugging Face Hub. pipeline wraps a model and its preprocessing into one call for a task such as text classification or zero-shot classification. Training frameworks and inference engines such as vLLM reuse the same model definitions. The library runs on PyTorch.

Downloads / mo
119.8M
Stars
169.2K
Last release
5.23.0
License
Apache 2.0 License

Strengths

  • Models by name. A task and a model name from the Hub are enough for pipeline to download and run a model.

Limitations

  • Weights download on first use. Each model fetches its weights the first time it loads, and large models need a GPU with enough memory to hold them.

Quickstart

From pipelines.md
$ pip install transformers torch
from transformers import pipeline
classifier = pipeline('zero-shot-classification', model='facebook/bart-large-mnli')
result = classifier('A guide to neural network training', candidate_labels=['machine learning', 'cooking'])
print(result['labels'][0])

Transformers examples

From open-source projects on GitHub

PyTorch provides tensors, arrays that compute on GPUs as well as CPUs, and neural networks built on a tape-based autograd system. The tape records operations as Python code runs, so a model's structure can change from one input to the next, and backward() computes the gradients. torch.nn supplies layers and losses, and DistributedDataParallel synchronizes gradients across training processes. Extensions can reuse NumPy, SciPy, and Cython code.

Downloads / mo
59.7M
Stars
105.7K
Last release
2.15.0
License
Apache-2.0 AND Apache-2.0 WITH LLVM-exception AND BSD-2-Clause AND BSD-3-Clause AND BSL-1.0 AND ISC AND MIT AND Zlib

Strengths

  • Builds dynamic autograd networks. Build neural networks on a tape-based automatic differentiation system.
  • Synchronizes distributed training gradients. Use DistributedDataParallel to synchronize gradients across training processes.

Limitations

  • Saved weights need the model class. A state dictionary holds weights only, so loading one requires the model class defined in code first.

Quickstart

From autograd.html
$ pip install torch
import torch
x = torch.tensor(3.0, requires_grad=True)
(x * x).backward()
print(x.grad)

PyTorch examples

From open-source projects on GitHub

JAX is a library for array computation and program transformation, with an API modeled on NumPy. jax.grad differentiates a Python function, including its loops, branches, and recursion, and jax.jit compiles it with XLA for GPUs and TPUs. The transformations compose, so a compiled function can also be differentiated. Neural network layers come from libraries built on JAX, such as Flax and Equinox.

Downloads / mo
12.6M
Stars
36.6K
Last release
0.12.1
License
Apache-2.0

Strengths

  • Composes gradients with compilation. Compile and differentiate pure Python numerical functions.
  • Partitions array computations across devices. Shard arrays and partition computations across multiple devices.

Limitations

  • Pure functions only. Transformed functions keep no hidden state, so state passes in as arguments and comes back as return values.
  • Research project. Google describes JAX as a research project rather than an official product, and its docs list sharp edges.

Quickstart

From README.md
$ pip install jax
import jax
print(jax.grad(lambda x: x * x)(3.0))

JAX examples

From open-source projects on GitHub

TensorFlow is an open source platform for machine learning, first developed at Google Brain. Tensors and variables compute on CPUs, GPUs, and TPUs, and tf.GradientTape records the operations inside its block to compute gradients. Distribution strategies spread existing training code across GPUs, machines, or TPUs. Stable APIs cover Python and C++.

Downloads / mo
12.4M
Stars
201.6K
Last release
2.21.0
License
Apache-2.0

Strengths

  • Trains with automatic gradients. Use GradientTape to compute derivatives for training.
  • Distributes existing training code. Use distribution strategies across GPUs, machines, or TPUs.

Limitations

  • Windows GPU training needs WSL. GPU builds on Windows run inside WSL, the Windows Subsystem for Linux.

Quickstart

From tf.GradientTape
$ pip install tensorflow
import tensorflow as tf
x = tf.Variable(3.0)
with tf.GradientTape() as tape:
    y = x * x
print(tape.gradient(y, x).numpy())

TensorFlow examples

From open-source projects on GitHub

Keras is a high-level API for building and training deep learning models on JAX, TensorFlow, or PyTorch, with OpenVINO available for inference only. A model is a stack of layers, as in keras.Sequential, and the KERAS_BACKEND environment variable selects the engine. The keras package holds the current version, and the previous version remains available as tf-keras.

Downloads / mo
12.0M
Stars
64.4K
Last release
3.15.1
License
Apache-2.0

Strengths

  • Offers multiple training backends. Train through JAX, TensorFlow, or PyTorch backends.
  • Provides a high-level modeling API. Build and train models across vision, language, audio, and forecasting tasks.

Limitations

  • Backend installed separately. Keras needs TensorFlow, JAX, or PyTorch installed alongside it.
  • OpenVINO runs inference only. Training needs the JAX, TensorFlow, or PyTorch backend.

Quickstart

From sequential.md
$ pip install keras torch
import os
os.environ['KERAS_BACKEND'] = 'torch'
import keras
model = keras.Sequential([keras.layers.Dense(1)])
print(model(keras.ops.ones((1, 3))))

Keras examples

From open-source projects on GitHub

PyTorch Lightning

PyTorch Lightning organizes PyTorch code so that the library handles the training loop, backpropagation, mixed precision, and multi-GPU or distributed training. Model code goes in a LightningModule, and a Trainer runs it on anything from a CPU to several GPU nodes without changes to that code. Lightning Fabric offers the same scaling while the program keeps its own training loop.

Downloads / mo
11.6M
Stars
31.4K
Last release
2.6.6
License
Apache-2.0

Strengths

  • Training loop included. The Trainer runs training and prediction, with logging and checkpoints as options.

Limitations

  • Code follows its structure. Model code moves into LightningModule methods instead of a plain PyTorch loop.

Quickstart

From lightning_module.html
$ pip install pytorch-lightning torch
import torch
import pytorch_lightning as pl
from torch.utils.data import DataLoader

class Model(pl.LightningModule):
    def forward(self, x):
        return x + 1

model = Model()
trainer = pl.Trainer(accelerator='cpu', logger=False, enable_checkpointing=False)
print(trainer.predict(model, dataloaders=DataLoader(torch.zeros(2, 3), batch_size=1)))

PyTorch Lightning examples

From open-source projects on GitHub
@torch.no_grad()
def validation_step(self, batch, batch_idx):
    _, loss_dict_no_ema = self.shared_step(batch)
    with self.ema_scope():
        _, loss_dict_ema = self.shared_step(batch)
        loss_dict_ema = {key + '_ema': loss_dict_ema[key] for key in loss_dict_ema}
    self.log_dict(loss_dict_no_ema, prog_bar=False, logger=True, on_step=False, on_epoch=True)
    self.log_dict(loss_dict_ema, prog_bar=False, logger=True, on_step=False, on_epoch=True)

Flax is a neural network library for JAX. Its current API, Flax NNX, defines models as regular Python objects with mutable state and shared references, and layers such as nnx.Linear draw their random keys from nnx.Rngs. Models built this way pass through JAX transformations for compilation and gradients. The older Linen API keeps its own documentation site.

Downloads / mo
2.7M
Stars
7.4K
Last release
0.12.12
License
Apache-2.0

Strengths

  • Models as Python objects. Flax NNX models are regular Python objects that can share references and change in place.
  • Training utilities included. Checkpointing, serialization, metrics, and on-device prefetching come with the library.

Limitations

  • Two APIs. Code written for Linen differs from NNX code, and the docs include a guide for moving between them.

Quickstart

From nnx_basics.html
$ pip install flax
from flax import nnx
import jax.numpy as jnp
model = nnx.Linear(3, 2, rngs=nnx.Rngs(0))
print(model(jnp.ones((1, 3))))

Flax examples

From open-source projects on GitHub

Equinox is a JAX library for neural networks and for utilities that core JAX lacks, such as filtered transformations, PyTree manipulation, and runtime errors. Models subclass eqx.Module with PyTorch-like syntax, and each model is a PyTree, the nested container type JAX transforms, so it passes through jax.jit and jax.grad directly. Equinox models work with the rest of the JAX ecosystem.

Downloads / mo
1.7M
Stars
3.0K
Last release
0.13.8
License
Apache-2.0

Strengths

  • Models are PyTrees. Models cross compilation and gradient boundaries like any other JAX data.

Limitations

  • Explicit random keys. Each layer takes a random key when it is built, passed by the program.

Quickstart

From linear.md
$ pip install equinox
import equinox as eqx
import jax
import jax.numpy as jnp
model = eqx.nn.Linear(3, 2, key=jax.random.PRNGKey(0))
print(model(jnp.ones(3)))

Equinox examples

From open-source projects on GitHub

FAQ

Start from the engine. PyTorch records operations on a tape as Python code runs, JAX transforms pure functions with grad and jit, and TensorFlow records gradients with GradientTape. Keras adds a high-level API over any of the three, and Transformers supplies pretrained models.

Both compute tensors on GPUs and differentiate them automatically. PyTorch records operations as Python code runs. TensorFlow records gradients inside a GradientTape block and also offers a stable C++ API. On Windows, TensorFlow's GPU builds run through WSL, the Windows Subsystem for Linux.

JAX transforms functions: jax.grad differentiates a function, jax.jit compiles it with XLA, and the two compose. Those transforms require pure functions, so model state passes in and out as arguments. PyTorch keeps state inside module objects and records gradients as the code runs.

Keras is a high-level API for building and training models, and TensorFlow is one of the engines it runs on. The current Keras also runs on JAX and PyTorch, and the previous version remains available as the tf-keras package.

Keras defines a model as layers and trains it through its own API, and it can use PyTorch as its backend. Plain PyTorch leaves the training loop to the program, which controls each step.

Flax is a neural network library for JAX. Its NNX API defines models as regular Python objects with mutable state, and JAX transforms then compile and differentiate them.

For coding agents

Found your deep learning library? Help your agent use it.

Connect Exa so your coding agent can find the library’s documentation, check its API, and look up implementations while you build.

Run in your terminal

claude plugin install exa@claude-plugins-official