Skip to content

Commit b1abcc0

Browse files
committed
slim install section, move details to INSTALL.md
1 parent 77b3df9 commit b1abcc0

2 files changed

Lines changed: 89 additions & 50 deletions

File tree

‎INSTALL.md‎

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Installation
2+
3+
`fla` ships as two PyPI packages: `fla-core` (kernels in `fla/ops`,
4+
`fla/modules`, `fla/utils`) and `flash-linear-attention` (everything in
5+
`fla/layers` + `fla/models`, plus `fla-core` as a dep). Both follow the same
6+
backend-extras layout.
7+
8+
## Pick a backend
9+
10+
`torch` and the matching `triton` flavor live in backend extras, not in the
11+
base deps. Wheel metadata is the same across backends; `pip` only pulls the
12+
flavor you ask for.
13+
14+
| Backend | Extra | Wheel index | `triton` flavor |
15+
| ------- | -------- | ------------------------------------------ | ------------------------ |
16+
| CUDA | `[cuda]` | `https://download.pytorch.org/whl/cu128` | `triton` |
17+
| ROCm | `[rocm]` | `https://download.pytorch.org/whl/rocm7.2` | `pytorch-triton-rocm` |
18+
| XPU | `[xpu]` | `https://download.pytorch.org/whl/xpu` | `pytorch-triton-xpu` |
19+
| NPU | `[npu]` | (use your CANN-matched `torch` / `torch_npu`) | `triton-ascend` |
20+
| CPU | `[cpu]` | `https://download.pytorch.org/whl/cpu` | `triton` (import-only) |
21+
22+
## From PyPI
23+
24+
```sh
25+
pip install flash-linear-attention[cuda]
26+
pip install flash-linear-attention[rocm] --extra-index-url https://download.pytorch.org/whl/rocm7.2
27+
pip install flash-linear-attention[xpu] --extra-index-url https://download.pytorch.org/whl/xpu
28+
pip install flash-linear-attention[cpu] --extra-index-url https://download.pytorch.org/whl/cpu
29+
```
30+
31+
## Ascend NPU
32+
33+
NPUs use [`triton-ascend`](https://github.com/triton-lang/triton-ascend), not
34+
upstream `triton`. Since `triton` is in backend extras (not base deps), the
35+
old "install fla, then `pip uninstall triton`, then install `triton-ascend`"
36+
dance is no longer needed.
37+
38+
```sh
39+
# 1. install CANN + source set_env.sh
40+
# 2. install torch + torch_npu that match your CANN
41+
pip install torch==2.7.1 torch_npu==2.7.1
42+
# 3. install fla with the npu extra
43+
pip install flash-linear-attention[npu]
44+
```
45+
46+
## From source
47+
48+
```sh
49+
pip uninstall fla-core flash-linear-attention -y
50+
pip install -U "git+https://github.com/fla-org/flash-linear-attention#egg=flash-linear-attention[cuda]"
51+
# replace [cuda] with [rocm] / [xpu] / [npu] / [cpu] and add the matching --extra-index-url for non-CUDA
52+
```
53+
54+
Or with submodules:
55+
```sh
56+
git submodule add https://github.com/fla-org/flash-linear-attention.git 3rdparty/flash-linear-attention
57+
ln -s 3rdparty/flash-linear-attention/fla fla
58+
```
59+
60+
## Behavior change vs. pre-v0.5
61+
62+
Before v0.5, `pip install flash-linear-attention` resolved a CUDA-built
63+
`torch` + `triton` from the default PyPI index even on ROCm / XPU / NPU
64+
machines, which silently overlaid the wrong wheels. Now the base install
65+
contains no `torch` / `triton` at all: you pick a backend extra. Bare
66+
`pip install flash-linear-attention` no longer imports.
67+
68+
## Notes
69+
70+
- Already have a working `torch` for your backend? `pip install -e .[rocm]`
71+
(or the matching extra) leaves it alone because the `torch>=2.7.0` pin is
72+
satisfied.
73+
- For AMD GPUs the `[rocm]` extra pulls `pytorch-triton-rocm`. For Intel GPUs
74+
the `[xpu]` extra pulls `pytorch-triton-xpu`. See [FAQs](FAQs.md) for
75+
backend-specific issues.
76+
77+
## Skipping the dep resolver
78+
79+
`torch` pre-release / `triton-nightly` setups can sidestep resolution
80+
entirely:
81+
```sh
82+
pip install transformers einops
83+
pip uninstall fla-core flash-linear-attention -y
84+
pip install -U --no-deps git+https://github.com/fla-org/flash-linear-attention
85+
```

‎README.md‎

Lines changed: 4 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -116,64 +116,18 @@
116116

117117
[![nvidia-h100-ci](https://github.com/fla-org/flash-linear-attention/actions/workflows/nvidia-h100.yml/badge.svg?branch=main&event=push)](https://github.com/fla-org/flash-linear-attention/actions/workflows/nvidia-h100.yml)
118118

119-
The following requirements should be satisfied
120-
- [PyTorch](https://pytorch.org/) >= 2.7.0
121-
- [Triton](https://github.com/triton-lang/triton) >= 3.3 (or nightly version, see [FAQs](FAQs.md))
122-
- [einops](https://einops.rocks/)
123-
- [transformers](https://github.com/huggingface/transformers) >=4.45.0
124-
- [datasets](https://github.com/huggingface/datasets) >=3.3.0
119+
`torch` and the matching `triton` flavor live in a backend extra (`[cuda]` / `[rocm]` / `[xpu]` / `[npu]` / `[cpu]`), so wheel metadata is the same across backends and `pip` only pulls the flavor you ask for.
125120

126-
Starting from v0.3.2, the packages published on PyPI are `fla-core` and `flash-linear-attention`. The former contains all our customized kernels and only depends on PyTorch, Triton, and einops. The latter is an extension package of the former, containing `fla/layers` and `fla/models`, and depends on transformers. We also provide Triton implementations for conv1d operations, so causal-conv1d is not required.
127-
128-
### Pick a backend
129-
130-
`torch` and the matching `triton` flavor live in backend extras (they are *not* in the base dependencies), so wheel metadata is the same across backends and `pip` only pulls the flavor you ask for. Pick the row that matches your hardware:
131-
132-
| Backend | Extra | Wheel index | `triton` flavor |
133-
| ------- | --------- | -------------------------------------------------------- | ------------------------ |
134-
| CUDA | `[cuda]` | `https://download.pytorch.org/whl/cu128` (or your CUDA) | `triton` |
135-
| ROCm | `[rocm]` | `https://download.pytorch.org/whl/rocm7.2` (or your ROCm)| `pytorch-triton-rocm` |
136-
| XPU | `[xpu]` | `https://download.pytorch.org/whl/xpu` | `pytorch-triton-xpu` |
137-
| NPU | `[npu]` | (use your CANN-matched `torch` / `torch_npu`) | `triton-ascend` |
138-
| CPU | `[cpu]` | `https://download.pytorch.org/whl/cpu` | `triton` (import-only) |
139-
140-
PyPI install:
141121
```sh
142-
# CUDA (the typical PyPI default)
143122
pip install flash-linear-attention[cuda]
144-
145-
# ROCm
146123
pip install flash-linear-attention[rocm] --extra-index-url https://download.pytorch.org/whl/rocm7.2
147-
148-
# XPU
149-
pip install flash-linear-attention[xpu] --extra-index-url https://download.pytorch.org/whl/xpu
150-
```
151-
152-
From source (latest):
153-
```sh
154-
pip uninstall fla-core flash-linear-attention -y
155-
pip install -U "git+https://github.com/fla-org/flash-linear-attention#egg=flash-linear-attention[rocm]" \
156-
--extra-index-url https://download.pytorch.org/whl/rocm7.2
157-
```
158-
159-
Or with submodules:
160-
```sh
161-
git submodule add https://github.com/fla-org/flash-linear-attention.git 3rdparty/flash-linear-attention
162-
ln -s 3rdparty/flash-linear-attention/fla fla
124+
pip install flash-linear-attention[xpu] --extra-index-url https://download.pytorch.org/whl/xpu
163125
```
164126

165-
> [!NOTE]
166-
> Already have a working `torch` for your backend? `pip install -e .[rocm]` (or the matching extra) will leave it alone because the extra's pin (`torch>=2.7.0`) is satisfied. The base install has no `torch` dep at all, so bare `pip install -e .` won't import. Pick an extra.
127+
See [INSTALL.md](INSTALL.md) for the full backend table, NPU (Ascend) flow, source installs, and the `--no-deps` path for `torch` pre-release / `triton-nightly`.
167128

168129
> [!NOTE]
169-
> For AMD GPUs the `[rocm]` extra pulls `pytorch-triton-rocm`. For Intel GPUs the `[xpu]` extra pulls `pytorch-triton-xpu`. See [FAQs](FAQs.md) for backend-specific issues.
170-
171-
If you're on a `torch` pre-release / `triton-nightly` you can also skip the dep resolver. Install the base deps yourself, then drop `fla` in with `--no-deps`:
172-
```sh
173-
pip install transformers einops
174-
pip uninstall fla-core flash-linear-attention -y
175-
pip install -U --no-deps git+https://github.com/fla-org/flash-linear-attention
176-
```
130+
> Behavior change vs. pre-v0.5: bare `pip install flash-linear-attention` no longer pulls `torch` / `triton`. Pick a backend extra. This fixes ROCm / XPU / NPU users silently getting CUDA wheels.
177131
178132

179133
## Usage

0 commit comments

Comments
 (0)