Skip to main content

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.

Test coverage

To reproduce the coverage number reported on PRs locally:

uv run pytest --cov=kernels --cov-report=term-missing tests

CI measures coverage on a single canonical matrix cell (Python 3.10 / Torch 2.12.0) and posts a sticky comment on the PR; the threshold is 80% (warn-only — the check stays green either way).

Release files for kernels 0.16.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kernels 0.16.1
File Size Uploaded
kernels-0.16.1.tar.gz 73.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kernels 0.16.1
File Interpreter ABI Platform
kernels-0.16.1-py3-none-any.whl Python 3 none any Details

Total release size: 139.4 kB

Release files / kernels-0.16.1.tar.gz

Download URL kernels-0.16.1.tar.gz
Size 73.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b4a3fe0980dd1a3089920242e41b1551acabfea50d03bffbe63a5ce34449e6ae
BLAKE2b-256 checksum
How to use checksums
251fcc20cd3c18d823eac4adb9d279a674cd7a79954530df474b04775b865498
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 24, 2026.

Transparency log

Release files / kernels-0.16.1-py3-none-any.whl

Download URL kernels-0.16.1-py3-none-any.whl
Size 65.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
db3a1dc1760e86ef97c04e97a9ed6cf2ad833b244213319f12b93bd4b0d58597
BLAKE2b-256 checksum
How to use checksums
9183303cd703ffc1740ae16798377364db97ad372dd383d25f49d41e4db142cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 24, 2026.

Transparency log

Release history Release notifications | RSS feed

0.16.2

2 release files

This release

0.16.1 This release

2 release files

0.16.0

2 release files

0.15.1

2 release files

0.14.1

2 release files

0.13.0

2 release files

0.12.3

2 release files

0.12.1

2 release files

0.12.0

2 release files

0.11.5

2 release files

0.11.4

2 release files

0.11.1

2 release files

0.11.0

2 release files

0.10.4

2 release files

0.10.3

2 release files

0.10.2

2 release files

0.10.1

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.5

1 release file

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.3

2 release files

0.3.2

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.7

2 release files

0.0.0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page