Sasarkar/qwen optimization#1067
Closed
ssarkar2 wants to merge 11 commits into
Closed
Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
ssarkar2
commented
Jun 13, 2024
| q_len = query_layer.size(-2) | ||
| q_tiles = (q_len // q_block_size) if (q_len % q_block_size == 0) else math.ceil(q_len / q_block_size) | ||
| q_padding = q_tiles * q_block_size - q_len | ||
| q_tiles = (q_len // self.block_size) if (q_len % self.block_size == 0) else math.ceil(q_len / self.block_size) |
Contributor
Author
There was a problem hiding this comment.
note to self: changing signature of gaudi_flash_attn_v1 to match inputs of self.fused_scaled_dot_product_attention. that way the calling site is simplified
libinta
reviewed
Jun 14, 2024
libinta
reviewed
Jun 14, 2024
| else: | ||
| past_key_value = None | ||
|
|
||
| flash_attention_fast_softmax = True # TODO pass this along |
Contributor
Author
There was a problem hiding this comment.
there are other models with the same todo. i'll create a PR thsat fixes this todo for all of them in one go
|
Hello, I am very interested in knowing from which generation of Gaudi this test data originates, Gaudi 1/2 or 3? |
Contributor
Author
Gaudi 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Description
move fusedsdpa.apply into a separate module, so it can be quantized as documented here
similar to falcon opt here
Also add "no resue cache" change. similar to falcon optimization here. Originally from this
Tests
test 1 (for fp8)
TPS increases from 1278.0 to 1981.4. without flash flags, on main the tps is around 1833
If flash flags is not used, both main and this branch has TPS=1833.1
test 2 (no reuse cache)
HABANA_VISIBLE_MODULES=4,5,6,7 python ../gaudi_spawn.py --master 29502 --use_deepspeed --world_size 4 run_generation.py --model_name_or_path /mnt/weka/data/Qwen/Qwen2-72B --use_hpu_graphs --use_kv_cache --max_input_tokens 2048 --max_new_tokens 2048 --batch_size 64 --attn_softmax_bf16 --trim_logits --bf16 --warmup 2 --n_iterations 3 --limit_hpu_graphs --bucket_internal --bucket_size 128 --reuse_cachetest 3 (fp8)
same cmd as test 1, but with larger batches
test 4
fp8 and no reuse_cache
first few rows of data are from test 3
TODO .. should bs=192 fp8, without reusecache have OOM'ed?
same cmd as test 1, but with reuse_cache removed, and larger batchsize
Fixes # (issue)
Before submitting