Fix flash-attn install

#4
by kashif HF Staff - opened
Files changed (3) hide show
  1. README.md +3 -1
  2. annotation_pipeline/README.md +3 -1
  3. requirements.txt +6 -2
README.md CHANGED
@@ -46,9 +46,11 @@ Then download this repository and install its requirements:
46
  pip install -U huggingface_hub
47
  hf download HuggingFaceBio/Carbon-A-1.2B --exclude model.safetensors --local-dir Carbon-A-1.2B
48
  pip install -r Carbon-A-1.2B/requirements.txt
49
- pip install --no-build-isolation flash-attn
50
  ```
51
 
 
 
52
  The weights (4.6 GB) are downloaded to the Hugging Face cache on first use.
53
 
54
  ### Annotate a genome
 
46
  pip install -U huggingface_hub
47
  hf download HuggingFaceBio/Carbon-A-1.2B --exclude model.safetensors --local-dir Carbon-A-1.2B
48
  pip install -r Carbon-A-1.2B/requirements.txt
49
+ pip install --no-build-isolation --no-cache-dir "flash-attn==2.8.3"
50
  ```
51
 
52
+ The requirements keep PyTorch below 2.9 because FlashAttention 2.8.3 has prebuilt wheels for these versions on Python 3.9–3.13; without a wheel, it compiles from source, which fails with recent PyTorch. PyTorch's default CUDA 12.8 build also runs with CUDA 13 drivers. To use a newer PyTorch, run without FlashAttention with `--attn-implementation sdpa`. Its probabilities differ slightly: on the yeast benchmark below, PyTorch 2.14 with SDPA gave a gene F1 of 0.9525 instead of 0.953.
53
+
54
  The weights (4.6 GB) are downloaded to the Hugging Face cache on first use.
55
 
56
  ### Annotate a genome
annotation_pipeline/README.md CHANGED
@@ -57,9 +57,11 @@ FlashAttention:
57
  pip install -U "huggingface_hub>=0.34"
58
  hf download HuggingFaceBio/Carbon-A-1.2B --exclude model.safetensors --local-dir Carbon-A-1.2B
59
  pip install -r Carbon-A-1.2B/requirements.txt
60
- pip install --no-build-isolation flash-attn
61
  ```
62
 
 
 
63
  Model inference loads Carbon-A with `from_pretrained`, which downloads the
64
  weights (4.6 GB) to the Hugging Face cache on first use. It runs in bfloat16
65
  with FlashAttention-2, the setting of all reported results. The requirements
 
57
  pip install -U "huggingface_hub>=0.34"
58
  hf download HuggingFaceBio/Carbon-A-1.2B --exclude model.safetensors --local-dir Carbon-A-1.2B
59
  pip install -r Carbon-A-1.2B/requirements.txt
60
+ pip install --no-build-isolation --no-cache-dir "flash-attn==2.8.3"
61
  ```
62
 
63
+ The requirements keep PyTorch below 2.9 because FlashAttention 2.8.3 has prebuilt wheels for these versions on Python 3.9–3.13; without a wheel, it compiles from source, which fails with recent PyTorch. PyTorch's default CUDA 12.8 build also runs with CUDA 13 drivers. To use a newer PyTorch, run without FlashAttention with `--attn-implementation sdpa`. Its probabilities differ slightly: on the yeast benchmark of the model card, PyTorch 2.14 with SDPA gave a gene F1 of 0.9525 instead of 0.953.
64
+
65
  Model inference loads Carbon-A with `from_pretrained`, which downloads the
66
  weights (4.6 GB) to the Hugging Face cache on first use. It runs in bfloat16
67
  with FlashAttention-2, the setting of all reported results. The requirements
requirements.txt CHANGED
@@ -1,4 +1,6 @@
1
- torch>=2.7,<3
 
 
2
  # Below 5: Transformers 5 does not load this model with flash_attention_2, the
3
  # annotation pipeline's default attention implementation.
4
  transformers>=4.56,<5
@@ -14,7 +16,9 @@ tqdm
14
  numba
15
  ninja
16
  # Its default attention implementation, flash_attention_2, also needs FlashAttention:
17
- # pip install --no-build-isolation flash-attn
18
  # (--attn-implementation sdpa runs without it.) The native Viterbi backends are
19
  # compiled on first use: the CPU backend needs a C++17 compiler with OpenMP and
20
  # the GPU backend a CUDA toolkit.
 
 
 
1
+ # Below 2.9: flash-attn 2.8.3 ships prebuilt wheels for these PyTorch versions
2
+ # on Python 3.9-3.13.
3
+ torch>=2.7,<2.9
4
  # Below 5: Transformers 5 does not load this model with flash_attention_2, the
5
  # annotation pipeline's default attention implementation.
6
  transformers>=4.56,<5
 
16
  numba
17
  ninja
18
  # Its default attention implementation, flash_attention_2, also needs FlashAttention:
19
+ # pip install --no-build-isolation --no-cache-dir "flash-attn==2.8.3"
20
  # (--attn-implementation sdpa runs without it.) The native Viterbi backends are
21
  # compiled on first use: the CPU backend needs a C++17 compiler with OpenMP and
22
  # the GPU backend a CUDA toolkit.
23
+ # Needed to install flash-attn:
24
+ psutil