Skip to content

Update pallas doc with paged_attention#7591

Merged
wonjoo-wj merged 2 commits intomasterfrom
wonjoo/pallas-doc
Jun 28, 2024
Merged

Update pallas doc with paged_attention#7591
wonjoo-wj merged 2 commits intomasterfrom
wonjoo/pallas-doc

Conversation

@wonjoo-wj
Copy link
Copy Markdown
Collaborator

@wonjoo-wj wonjoo-wj commented Jun 28, 2024

  • Add paged_attention example and integration example

Preview changes at https://github.com/pytorch/xla/blob/bc70b366d5a5c9fc06cb5e41d782329c3170174f/docs/pallas.md

@wonjoo-wj wonjoo-wj requested a review from JackCaoG June 28, 2024 22:06
Comment thread docs/pallas.md Outdated

You can just use it like any other torch.ops.
#### Integration Example
We have a fork of HuggingFace Llama 3 to demonstrate [a potential integration for FlashAttention here](https://github.com/pytorch-tpu/transformers/tree/alanwaketan/flash_attention).
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Updated

Comment thread docs/pallas.md Outdated
#### Example usage
```python3
# Use built-in kernels
from torch_xla.experimental.custom_kernel import paged_attention
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

can you just do import torch_xla.experimental.custom_kernel, I will soon move the paged attention to https://github.com/pytorch/xla/blob/master/torch_xla/core/custom_kernel.py which will be auto-registered

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Updated

@wonjoo-wj wonjoo-wj requested a review from JackCaoG June 28, 2024 22:21
@wonjoo-wj wonjoo-wj merged commit 3bdca4d into master Jun 28, 2024
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