Instructions to use replicate/flash-attn4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Kernels
How to use replicate/flash-attn4 with Kernels:
# !pip install kernels from kernels import get_kernel # a version (or an explicit revision) is required; see the "Files and versions" tab for the available ones kernel = get_kernel("replicate/flash-attn4", version=1) - Notebooks
- Google Colab
- Kaggle
Download build/torch-cuda/_ops.py from replicate/flash-attn4: direct link, hf CLI and curl.
- Browser
- Download file 183 Bytes
-
https://huggingface.co/replicate/flash-attn4/resolve/main/build/torch-cuda/_ops.py
- Command line
-
hf download hf://replicate/flash-attn4/build/torch-cuda/_ops.py
-
curl -L -o _ops.py https://huggingface.co/replicate/flash-attn4/resolve/main/build/torch-cuda/_ops.py
183 Bytes
| import torch | |
| ops = torch.ops._flash_attn4_06b9ab8 | |
| def add_op_namespace_prefix(op_name: str): | |
| """ | |
| Prefix op by namespace. | |
| """ | |
| return f"_flash_attn4_06b9ab8::{op_name}" |