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)
| File | Size | Uploaded | |
|---|---|---|---|
| kernels-0.16.2.tar.gz | 75.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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 logRelease 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