Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow installation/use without flash attention dependency #3

Merged
merged 4 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@

# Table of Contents

- [FAESM: A Drop-in Efficient Pytorch Implementation of ESM2](#faesm-a-drop-in-efficient-pytorch-implementation-of-esm)
- [Installation](#installation)
- [Usage](#usage)
- [FAESM: A Drop-in Efficient Pytorch Implementation of ESM2](#faesm-a-drop-in-efficient-pytorch-implementation-of-esm2)
- [Table of Contents](#table-of-contents)
- [Installation](#installation)
- [Usage](#usage)
- [Training \[WIP\]](#training-wip)
- [Benchmarking](#benchmarking)
- [Appreciation](#appreciation)
- [Citation](#citation)
- [Benchmarking](#benchmarking)
- [TODOs](#todos)
- [Appreciation](#appreciation)
- [Citation](#citation)

# Installation

Expand All @@ -39,6 +41,12 @@ Having trouble installing flash attention but still want to use it? A workaround
3. Install FAESM from github:

```bash
# if you want to use flash attention
pip install faesm[flash_attn]
```

```bash
# if you want to forego flash attention and just use SDPA
pip install faesm
```

Expand Down
4 changes: 2 additions & 2 deletions faesm/esm.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
flash_attn_installed = True
try:
from flash_attn import flash_attn_varlen_qkvpacked_func
from faesm.rotary import RotaryEmbedding as FAEsmRotaryEmbedding
from faesm.utils import unpad
except ImportError:
flash_attn_installed = False
print(
Expand Down Expand Up @@ -42,8 +44,6 @@
EsmSelfOutput,
)

from faesm.rotary import RotaryEmbedding as FAEsmRotaryEmbedding
from faesm.utils import unpad

logger = logging.getLogger(__name__)

Expand Down
6 changes: 5 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@
"setuptools",
"torch",
"einops",
"flash_attn",
"transformers",
]

extras_require = {
'flash_attn': ['flash_attn'],
}


setup(
name="faesm",
Expand All @@ -23,5 +26,6 @@
include_package_data=True,
zip_safe=True,
install_requires=requirements,
extras_require=extras_require,
test_suite="tests",
)
Loading