kernels 0.12.3


pip install kernels

  Latest version

Released: Mar 20, 2026

Project Links

Meta
Author: Daniel de Kok, David Holtz
Requires Python: >=3.9

Classifiers

kernels

The Kernel Hub allows Python libraries and applications to load compute kernels directly from the Hub. To support this kind of dynamic loading, Hub kernels differ from traditional Python kernel packages in that they are made to be:

  • Portable: a kernel can be loaded from paths outside PYTHONPATH.
  • Unique: multiple versions of the same kernel can be loaded in the same Python process.
  • Compatible: kernels must support all recent versions of Python and the different PyTorch build configurations (various CUDA versions and C++ ABIs). Furthermore, older C library versions must be supported.

The kernels Python package is used to load kernels from the Hub.

๐Ÿš€ Quick Start

Install the kernels package with pip (requires torch>=2.5 and CUDA):

pip install kernels

Here is how you would use the activation kernels from the Hugging Face Hub:

import torch

from kernels import get_kernel

# Download optimized kernels from the Hugging Face hub
activation = get_kernel("kernels-community/activation", version=1)

# Random tensor
x = torch.randn((10, 10), dtype=torch.float16, device="cuda")

# Run the kernel
y = torch.empty_like(x)
activation.gelu_fast(y, x)

print(y)

You can search for kernels on the Hub.

๐Ÿ“š Documentation

Read the documentation of kernels.

Wheel compatibility matrix

Platform Python 3
any

Files in release

Extras:
Dependencies:
huggingface_hub (<2.0,>=0.26.0)
packaging (>=20.0)
pyyaml (>=6)
tomli (>=2.0)