Instructions to use replicate/flash-attn2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Kernels
How to use replicate/flash-attn2 with Kernels:
# !pip install kernels from kernels import get_kernel kernel = get_kernel("replicate/flash-attn2") - Notebooks
- Google Colab
- Kaggle
File size: 1,276 Bytes
a741640 1eaaf31 a741640 c3f3c93 1eaaf31 3b8334d 1eaaf31 d6cc1b0 e47d818 d6cc1b0 e47d818 b21337a e47d818 0518250 1eaaf31 d6cc1b0 e47d818 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | ---
library_name: kernels
license: bsd-3-clause
---
> [!CAUTION]
> Starting from September 13, 2026, we will be removing the "model" type repositories of kernels (e.g., kernels-community/flash-attn3). Make sure you're using a latest version of kernels. If you face any disruption, please report them here: https://github.com/huggingface/kernels/issues/new.
This is the repository card of kernels-community/flash-attn2 that has been pushed on the Hub. It was built to be used with the [`kernels` library](https://github.com/huggingface/kernels). This card was automatically generated.
## How to use
```python
# make sure `kernels` is installed: `pip install -U kernels`
from kernels import get_kernel
kernel_module = get_kernel("kernels-community/flash-attn2", version=2)
flash_attn_func = kernel_module.flash_attn_func
flash_attn_func(...)
```
## Available functions
- `flash_attn_func`
- `flash_attn_kvpacked_func`
- `flash_attn_qkvpacked_func`
- `flash_attn_varlen_func`
- `flash_attn_varlen_kvpacked_func`
- `flash_attn_varlen_qkvpacked_func`
- `flash_attn_with_kvcache`
- `fwd`
- `varlen_fwd`
- `bwd`
- `varlen_bwd`
- `fwd_kvcache`
## Benchmarks
Benchmarking script is available for this kernel. Run `kernels benchmark kernels-community/flash-attn2 --version 2`.
|