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/__init__.py from replicate/flash-attn4: direct link, hf CLI and curl.
- Browser
- Download file 493 Bytes
-
https://huggingface.co/replicate/flash-attn4/resolve/main/build/torch-cuda/__init__.py
- Command line
-
hf download hf://replicate/flash-attn4/build/torch-cuda/__init__.py
-
curl -L -o __init__.py https://huggingface.co/replicate/flash-attn4/resolve/main/build/torch-cuda/__init__.py
493 Bytes
| """Flash Attention CUTE (CUDA Template Engine) implementation.""" | |
| from importlib.metadata import PackageNotFoundError, version | |
| # Update when syncing again. | |
| __version__ = "4.0.0.beta4" | |
| import cutlass.cute as cute | |
| from .interface import ( | |
| flash_attn_func, | |
| flash_attn_varlen_func, | |
| ) | |
| from .cute_dsl_utils import cute_compile_patched | |
| # Patch cute.compile to optionally dump SASS | |
| cute.compile = cute_compile_patched | |
| __all__ = [ | |
| "flash_attn_func", | |
| "flash_attn_varlen_func", | |
| ] | |