Instructions to use kernels-community/activation with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Kernels
How to use kernels-community/activation with Kernels:
# !pip install kernels from kernels import get_kernel kernel = get_kernel("kernels-community/activation") - Notebooks
- Google Colab
- Kaggle
Download build/torch210-cxx11-cu128-aarch64-linux/__init__.py from kernels-community/activation: direct link, hf CLI and curl.
- Browser
- Download file 1.56 kB
-
https://huggingface.co/kernels-community/activation/resolve/0d7d8c79752c16ddb068d4dbf7790358c016635e/build/torch210-cxx11-cu128-aarch64-linux/__init__.py
- Command line
-
hf download hf://kernels-community/activation@0d7d8c79752c16ddb068d4dbf7790358c016635e/build/torch210-cxx11-cu128-aarch64-linux/__init__.py
-
curl -L -o __init__.py https://huggingface.co/kernels-community/activation/resolve/0d7d8c79752c16ddb068d4dbf7790358c016635e/build/torch210-cxx11-cu128-aarch64-linux/__init__.py
1.56 kB
| import torch | |
| from ._ops import ops | |
| from . import layers | |
| def silu_and_mul(out: torch.Tensor, x: torch.Tensor) -> torch.Tensor: | |
| ops.silu_and_mul(out, x) | |
| return out | |
| def mul_and_silu(out: torch.Tensor, x: torch.Tensor) -> torch.Tensor: | |
| ops.mul_and_silu(out, x) | |
| return out | |
| def gelu_and_mul(out: torch.Tensor, x: torch.Tensor) -> torch.Tensor: | |
| ops.gelu_and_mul(out, x) | |
| return out | |
| def gelu_tanh_and_mul(out: torch.Tensor, x: torch.Tensor) -> torch.Tensor: | |
| ops.gelu_tanh_and_mul(out, x) | |
| return out | |
| def fatrelu_and_mul(out: torch.Tensor, x: torch.Tensor, threshold: float = 0.0) -> torch.Tensor: | |
| ops.fatrelu_and_mul(out, x, threshold) | |
| return out | |
| def gelu(out: torch.Tensor, x: torch.Tensor) -> torch.Tensor: | |
| ops.gelu(out, x) | |
| return out | |
| def silu(out: torch.Tensor, x: torch.Tensor) -> torch.Tensor: | |
| ops.silu(out, x) | |
| return out | |
| def gelu_tanh(out: torch.Tensor, x: torch.Tensor) -> torch.Tensor: | |
| ops.gelu_tanh(out, x) | |
| return out | |
| def gelu_fast(out: torch.Tensor, x: torch.Tensor) -> torch.Tensor: | |
| ops.gelu_fast(out, x) | |
| return out | |
| def gelu_new(out: torch.Tensor, x: torch.Tensor) -> torch.Tensor: | |
| ops.gelu_new(out, x) | |
| return out | |
| def gelu_quick(out: torch.Tensor, x: torch.Tensor) -> torch.Tensor: | |
| ops.gelu_quick(out, x) | |
| return out | |
| __all__ = [ | |
| "silu_and_mul", | |
| "mul_and_silu", | |
| "gelu_and_mul", | |
| "gelu_tanh_and_mul", | |
| "fatrelu_and_mul", | |
| "gelu_fast", | |
| "gelu_new", | |
| "gelu_quick", | |
| "gelu_tanh", | |
| "silu", | |
| "gelu", | |
| "layers", | |
| ] | |