Build compute kernels and load them from the Hub.
740
stars
632
commits
Python
primary language
Sep 11, 2026
updated
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:
PYTHONPATH.kernels Python package.Install the kernels Python 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)
Browse available kernels at huggingface.co/kernels.
Python
52.2%
Rust
21.6%
Nix
14.3%
CMake
5.9%
Shell
3.8%
PowerShell
1.2%
Build compute kernels and load them from the Hub.
740
stars
632
commits
Python
primary language
Sep 11, 2026
updated
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:
PYTHONPATH.kernels Python package.Install the kernels Python 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)
Browse available kernels at huggingface.co/kernels.
Python
52.2%
Rust
21.6%
Nix
14.3%
CMake
5.9%
Shell
3.8%
PowerShell
1.2%