Skip to content

[Studio] Install flash attn at setup time for linux - #4979

Merged
rolandtannous merged 9 commits into
unslothai:mainfrom
Datta0:studio_flashattn
Apr 14, 2026
Merged

rolandtannous merged 9 commits into
unslothai:mainfrom
Datta0:studio_flashattn

Conversation

@Datta0

@Datta0 Datta0 commented Apr 12, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors wheel utility functions into a dedicated module and introduces an automated installer for flash-attn within the Python stack setup. The new installer supports prebuilt wheel detection for various Torch versions and falls back to source builds if necessary. Feedback includes a suggestion to use the _build_uv_cmd helper to ensure the --system flag is correctly applied when installing via uv, and a recommendation to avoid silent broad exception handling in URL probing.

Comment thread studio/install_python_stack.py Resolved
Comment thread studio/backend/utils/wheel_utils.py Resolved
@rolandtannous

Copy link
Copy Markdown
Contributor

This has the potential to increase setup time by up to 40 mins. Not something users would be happy to see imho, hence why i initially excluded it.

@Datta0
Datta0 force-pushed the studio_flashattn branch from 7aa1bf8 to 540171c Compare April 13, 2026 05:53
@rolandtannous

Copy link
Copy Markdown
Contributor

This has the potential to increase setup time by up to 40 mins. Not something users would be happy to see imho, hence why i initially excluded it.

resolved already .

@rolandtannous

Copy link
Copy Markdown
Contributor

tested

Screenshot 2026-04-14 at 3 16 03 PM

detected FA2=True, no longer complains that Flash attention is broken or missing or defaulting to xformers.

==((====))==  Unsloth 2026.4.4: Fast Qwen3_5 patching. Transformers: 5.3.0.
   \\   /|    NVIDIA H100 80GB HBM3. Num GPUs = 1. Max memory: 79.179 GB. Platform: Linux.
O^O/ \_/ \    Torch: 2.10.0+cu128. CUDA: 9.0. CUDA Toolkit: 12.8. Triton: 3.6.0
\        /    Bfloat16 = TRUE. FA [Xformers = 0.0.35. FA2 = True]
 "-____-"     Free license: http://github.com/unslothai/unsloth
Unsloth: Fast downloading is enabled - ignore downloading bars which are red colored!
The fast path is not available because one of the required library is not installed. Falling back to torch implementation. To install follow https://github.com/fla-org/flash-linear-attention#installation and https://github.com/Dao-AILab/causal-conv1d

note: FLA was fixed upstream.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 10625a1252

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +158 to +162
sys.executable,
pypi_spec,
]
else:
pypi_cmd = [sys.executable, "-m", "pip", "install", pypi_spec]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid dependency-resolving flash-attn runtime fallback

When the direct wheel path is unavailable (e.g., unsupported Torch/CUDA combo on Linux long-context jobs), this fallback installs flash-attn from PyPI without --no-deps or a pinned version. In that case pip/uv may resolve and change core packages (notably torch) inside the training environment before the job starts, which can introduce long resolver/download delays and ABI mismatches with already-installed extensions. The existing causal-conv1d/mamba flow explicitly uses dependency-isolated installs, so this new fallback should do the same.

Useful? React with 👍 / 👎.

@danielhanchen danielhanchen mentioned this pull request Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants