Skip to main content

Download compute kernels

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kernels-0.16.0.tar.gz (70.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kernels-0.16.0-py3-none-any.whl (63.6 kB view details)

Uploaded Python 3

File details

Details for the file kernels-0.16.0.tar.gz.

File metadata

  • Download URL: kernels-0.16.0.tar.gz
  • Upload date:
  • Size: 70.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for kernels-0.16.0.tar.gz
Algorithm Hash digest
SHA256 5a4118396b9866209e767973d697d3f2ee76f6ed1b2f72269b72f8cd4dc90a7f
MD5 48824663e6122a3e67c95d51f8105527
BLAKE2b-256 11e22a6cc28c75c85725fa1b4025cc6544fe2a0aaa01624411664b29fc697537

See more details on using hashes here.

Provenance

The following attestation bundles were made for kernels-0.16.0.tar.gz:

Publisher: publish_kernels.yml on huggingface/kernels

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kernels-0.16.0-py3-none-any.whl.

File metadata

  • Download URL: kernels-0.16.0-py3-none-any.whl
  • Upload date:
  • Size: 63.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for kernels-0.16.0-py3-none-any.whl
Algorithm Hash digest
SHA256 794af6a10fd888bb4f46ad1b9b2f4f61b5b0b104475a6415c5322b58a7bf02ed
MD5 fa3ee174837ad41c783c2912c6d96ada
BLAKE2b-256 0bf5ec0e49e5a6f28a346f94a7c5a8a90bc192da4d456e9b06ca5ed57c4e028d

See more details on using hashes here.

Provenance

The following attestation bundles were made for kernels-0.16.0-py3-none-any.whl:

Publisher: publish_kernels.yml on huggingface/kernels

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page