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.2

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.2
File Size Uploaded
kernels-0.16.2.tar.gz 75.8 kB Details

Built distribution (wheel)

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

Total release size: 142.3 kB

Release files / kernels-0.16.2.tar.gz

Download URL kernels-0.16.2.tar.gz
Size 75.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4cf3be5e133ff5c7f5114410bffd3eee1eb98c6abd71d6ccbeb8307170364d50
BLAKE2b-256 checksum
How to use checksums
3cab81b4ad7384bd2be82e303bd2da22346fc7f73d911b98f0d88c846923b202
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 Sep 15, 2026.

Transparency log

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

Download URL kernels-0.16.2-py3-none-any.whl
Size 66.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a8fe94fb9b630b7f14e63f15ff7f7579793aa3663ce800fffee6888e194b02ff
BLAKE2b-256 checksum
How to use checksums
5a4afdcf0702e5c830cf22e33c7b832054f418d3b65bd64e3b2be79d7ee8418a
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 Sep 15, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.16.2 This release

2 release files

0.16.1

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