Skip to content

✨ allow single-shard paged attention #86

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions server/text_generation_server/inference_engine/tgis_native.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
TP_NONFLASH_TYPES = ["bloom", "t5", "gpt_neox"]
TP_FLASH_TYPES = NONTP_FLASH_TYPES # All flash types currently support TP
NONTP_NONFLASH_TYPES = ["bloom", "t5"]
PAGED_TYPES = ["llama", "gpt_bigcode"]


class InferenceEngine(BaseInferenceEngine):
Expand Down Expand Up @@ -52,6 +53,11 @@ def __init__(
raise NotImplementedError(
f"Flash attention currently only supported by the following model types: {NONTP_FLASH_TYPES}"
)
elif PAGED_ATTENTION:
Copy link
Member

Choose a reason for hiding this comment

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

I think right now we require both PAGED_ATTENTION and FLASH_ATTENTION to be set, so not sure if this should be elif.

if model_type not in PAGED_TYPES:
raise NotImplementedError(
f"Paged attention currently only supported by the following model types: {PAGED_TYPES}"
)
elif model_type not in NONTP_NONFLASH_TYPES:
raise ValueError("tgis_native engine must be used with FLASH_ATTENTION, num_shards > 1 and/or BLOOM or T5")

Expand Down