---
title: flash-attn2
canonical_url: "https://www.modelscope.cn/models/RealmSky/flash-attn2"
md_url: "https://www.modelscope.cn/models/RealmSky/flash-attn2.md"
repository: RealmSky/flash-attn2
last_updated: 2026-07-07
license: bsd-3-clause
library_name:
  - pytorch
frameworks:
  - pytorch
downloads: 0
stars: 0
---

# flash-attn2

> flash-attn2 - RealmSky 在 ModelScope 开源的模型。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. This card was automatically generated.

RealmSky/flash-attn2 是 ModelScope 魔搭社区上的机器学习模型，采用 bsd-3-clause 许可。

- **Repository**: RealmSky/flash-attn2
- **License**: bsd-3-clause
- **Downloads**: 0
- **Stars**: 0
- **Last updated**: 2026-07-07

Source: https://www.modelscope.cn/models/RealmSky/flash-attn2

---

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