Conversation
There was a problem hiding this comment.
Pull request overview
Adds an opt-in build flag to install FlashAttention-3 (FA3) as a flash_attn_3 package (for uv/pyproject.toml workflows) while keeping the default legacy layout unchanged.
Changes:
- Introduce
FLASH_ATTENTION_AS_PACKAGEbuild flag inhopper/setup.pyto install modules underflash_attn_3.*and force source builds (skip cached wheels) when enabled. - Ensure
flash_attn_config.pyis generated in AS_PACKAGE scenarios even when CUDA build is skipped. - Document
uvinstallation configuration inREADME.md.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
hopper/setup.py |
Adds AS_PACKAGE build mode and adjusts wheel build/config generation to support package-style installs. |
README.md |
Adds uv/pyproject.toml installation instructions using the new build flag. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Björn Buschkämper <bjoern.buschkaemper@gmail.com>
1ca83a3 to
894ab6a
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 5 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Björn Buschkämper <bjoern.buschkaemper@gmail.com>
|
@tridao This PR is supposed to be an easy, backwards-compatible change to allow clean fa3 builds with uv so that packages that require a "flash_attn_3" package instead of a single "flash_attn_interface" module will work with it. If you have a different plan for fa3 building let me know; I can adapt the PR as-needed. |
Motivation
FA3, even though in beta, is supported in many downstream frameworks, e.g. megatron-core. To streamline installation using
uvandpyproject.toml, the building of the FA3 beta needs to be adapted: Currently, building usinguvresults in all package files being dropped directly intosite-packages/, instead of the correspondingsite-packages/flash_attn_3subfolder.Existing downstream frameworks like
megatron-coreneed aflash_attn_3package to work (see here), preventing a clean building solution using a singlepyproject.tomland requiring custom build steps.Solution
To support projects to integrate FA3 correctly, I propose a backwards-compatible change to the package setup, allowing FA3 to be properly built into a package using a
pyproject.tomlwhile maintaining existing behaviour.This change outputs the
flash_attn_interface.pyandflash_attn_config.pyfiles into both thesite-packages/(for backwards compatibility) andsite-packages/flash_attn_3folders.