- Notifications
You must be signed in to change notification settings - Fork 4
Add MQA #4
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
Merged
Merged
Add MQA #4
Changes from 35 commits
Commits
Show all changes
44 commits Select commit Hold shift + click to select a range
812a72c refactor
mayank31398 21713ac refactor
mayank31398 0ea738a refactor
mayank31398 6239fc6 refactor
mayank31398 01e9515 refactor
mayank31398 b5a29b8 test
mayank31398 e4a29b5 test
mayank31398 48f0aa0 test
mayank31398 646b63b test
mayank31398 3281d16 test
mayank31398 2fbb6c3 test
mayank31398 1090704 test
mayank31398 ef8ec7c test
mayank31398 b94ea81 fp32, bf16, int8
mayank31398 17534fd fp32, bf16, int8
mayank31398 e7230b5 fp32, bf16, int8
mayank31398 38c616b use_cache
mayank31398 15a2c80 use_cache
mayank31398 80ba9bb gc
mayank31398 f28f8ac benchmark
mayank31398 d04dc14 benchmark
mayank31398 9dc5268 benchmark
mayank31398 23a5eb1 fix
mayank31398 391e055 fix
mayank31398 856c77b fix
mayank31398 9d99f46 fp32
mayank31398 dfe8cb3 bf16
mayank31398 7344ae0 bf16
mayank31398 a4c3b81 ds-inference
mayank31398 a0f308d device map
mayank31398 0947688 device map
mayank31398 379bfd9 fix
mayank31398 6dc0c07 fp32
mayank31398 7dc67ea bf16
mayank31398 2ac761d int8
mayank31398 28e1e71 attention_type
mayank31398 b2c7de7 fp32
mayank31398 76b3b8d bf16
mayank31398 c149ee9 fp32
mayank31398 8427b94 int8
mayank31398 487954f fp16
mayank31398 0253839 total params
mayank31398 893c521 models
mayank31398 daea92d Add code to vary input length (#5)
minimario File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| batch_size := 1 | ||
| | ||
| install-mqa-transformers: | ||
| git clone https://github.com/bigcode-project/transformers.git; \ | ||
| cd transformers; \ | ||
| git checkout mayank/multi_query; \ | ||
| pip install .; \ | ||
| cd ..; \ | ||
| rm -rf transformers; | ||
| | ||
| # BLOOM AliBi | ||
| hf-1b-bloom-fp32: | ||
| python src/main.py --hidden_size 2048 --n_head 16 --n_layer 24 --pipeline_class HF_GPU_Pipeline --model_class BLOOM --dtype float32 --batch_size ${batch_size} | ||
| | ||
| hf-1b-bloom-bf16: | ||
| python src/main.py --hidden_size 2048 --n_head 16 --n_layer 24 --pipeline_class HF_GPU_Pipeline --model_class BLOOM --dtype bfloat16 --batch_size ${batch_size} | ||
| | ||
| hf-1b-bloom-int8: | ||
| python src/main.py --hidden_size 2048 --n_head 16 --n_layer 24 --pipeline_class HF_GPU_Pipeline --model_class BLOOM --dtype int8 --batch_size ${batch_size} | ||
| | ||
| ds-inference-1b-bloom-fp16: | ||
| deepspeed --num_gpus 1 src/main.py --hidden_size 2048 --n_head 16 --n_layer 24 --pipeline_class DS_Inference_Pipeline --model_class BLOOM --batch_size ${batch_size} | ||
| | ||
| # GPT2 MHA | ||
| hf-1b-GPT2-mha-fp32: | ||
| python src/main.py --hidden_size 2048 --n_head 16 --n_layer 24 --pipeline_class HF_GPU_Pipeline --model_class GPT2 --n_positions 2048 --attention_type 1 --dtype float32 --batch_size ${batch_size} | ||
| | ||
| hf-1b-GPT2-mha-bf16: | ||
| python src/main.py --hidden_size 2048 --n_head 16 --n_layer 24 --pipeline_class HF_GPU_Pipeline --model_class GPT2 --n_positions 2048 --attention_type 1 --dtype bfloat16 --batch_size ${batch_size} | ||
| | ||
| hf-1b-GPT2-mha-int8: | ||
| python src/main.py --hidden_size 2048 --n_head 16 --n_layer 24 --pipeline_class HF_GPU_Pipeline --model_class GPT2 --n_positions 2048 --attention_type 1 --dtype int8 --batch_size ${batch_size} | ||
| | ||
| ds-inference-1b-GPT2-mha-fp16: | ||
| deepspeed --num_gpus 1 src/main.py --hidden_size 2048 --n_head 16 --n_layer 24 --pipeline_class DS_Inference_Pipeline --model_class GPT2 --n_positions 2048 --attention_type 1 --batch_size ${batch_size} | ||
| | ||
| # GPT2 MQA | ||
| hf-1b-GPT2-mqa-fp32: | ||
| python src/main.py --hidden_size 2048 --n_head 16 --n_layer 24 --pipeline_class HF_GPU_Pipeline --model_class GPT2 --n_positions 2048 --attention_type 2 --dtype float32 --batch_size ${batch_size} | ||
| | ||
| hf-1b-GPT2-mqa-bf16: | ||
| python src/main.py --hidden_size 2048 --n_head 16 --n_layer 24 --pipeline_class HF_GPU_Pipeline --model_class GPT2 --n_positions 2048 --attention_type 2 --dtype bfloat16 --batch_size ${batch_size} | ||
| | ||
| hf-1b-GPT2-mqa-int8: | ||
| python src/main.py --hidden_size 2048 --n_head 16 --n_layer 24 --pipeline_class HF_GPU_Pipeline --model_class GPT2 --n_positions 2048 --attention_type 2 --dtype int8 --batch_size ${batch_size} | ||
| | ||
| ds-inference-1b-GPT2-mqa-fp16: | ||
| deepspeed --num_gpus 1 src/main.py --hidden_size 2048 --n_head 16 --n_layer 24 --pipeline_class DS_Inference_Pipeline --model_class GPT2 --n_positions 2048 --attention_type 2 --batch_size ${batch_size} | ||
| | ||
| # GPT2 MQA1 | ||
| hf-1b-GPT2-mqa1-fp32: | ||
| python src/main.py --hidden_size 2048 --n_head 16 --n_layer 24 --pipeline_class HF_GPU_Pipeline --model_class GPT2 --n_positions 2048 --attention_type 3 --dtype float32 --batch_size ${batch_size} | ||
| | ||
| hf-1b-GPT2-mqa1-bf16: | ||
| python src/main.py --hidden_size 2048 --n_head 16 --n_layer 24 --pipeline_class HF_GPU_Pipeline --model_class GPT2 --n_positions 2048 --attention_type 3 --dtype bfloat16 --batch_size ${batch_size} | ||
| | ||
| hf-1b-GPT2-mqa1-int8: | ||
| python src/main.py --hidden_size 2048 --n_head 16 --n_layer 24 --pipeline_class HF_GPU_Pipeline --model_class GPT2 --n_positions 2048 --attention_type 3 --dtype int8 --batch_size ${batch_size} | ||
| | ||
| ds-inference-1b-GPT2-mqa1-fp16: | ||
| deepspeed --num_gpus 1 src/main.py --hidden_size 2048 --n_head 16 --n_layer 24 --pipeline_class DS_Inference_Pipeline --model_class GPT2 --n_positions 2048 --attention_type 3 --batch_size ${batch_size} |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,61 @@ | ||
| # bigcode-inference-benchmark | ||
| # bigcode-inference-benchmark | ||
| A100 80GB | ||
| | ||
| BLOOM\ | ||
| ```python | ||
| hidden_size = 2048 | ||
| n_head = 16 | ||
| n_layer = 24 | ||
| ``` | ||
| | ||
| Throughput (tokens/sec | msec/token) | ||
| | batch_size | HF (fp32) | HF (bf16) | HF (int8) | DS-inference (fp16) | | ||
| |:----------:|:---------------:|:---------------:|:---------------:|:-------------------:| | ||
| | 1 | 51.59 \| 19.38 | 47.46 \| 21.07 | 16.53 \| 60.49 | 61.61 \| 16.23 | | ||
| | 2 | 103.92 \| 9.62 | 96.88 \| 10.32 | 33.79 \| 29.60 | 121.55 \| 8.23 | | ||
| | 4 | 211.96 \| 4.72 | 193.72 \| 5.16 | 67.38 \| 14.84 | 240.06 \| 4.17 | | ||
| | 8 | 411.79 \| 2.43 | 370.67 \| 2.70 | 134.34 \| 7.44 | 492.42 \| 2.03 | | ||
| | 16 | 804.55 \| 1.24 | 781.29 \| 1.28 | 275.69 \| 3.63 | 970.59 \| 1.03 | | ||
| | 32 | 1574.68 \| 0.64 | 1539.19 \| 0.65 | 537.14 \| 1.86 | 1999.04 \| 0.50 | | ||
| | 64 | 2712.46 \| 0.37 | 3038.01 \| 0.33 | 1070.50 \| 0.93 | 3971.09 \| 0.25 | | ||
| | 128 | 2974.36 \| 0.34 | 5795.97 \| 0.17 | 2055.34 \| 0.49 | 7514.59 \| 0.13 | | ||
| | 256 | 3695.44 \| 0.27 | 8216.27 \| 0.12 | 3523.77 \| 0.28 | 10226.50 \| 0.10 | | ||
| | 384 | 3591.13 \| 0.28 | 9328.18 \| 0.11 | 4585.33 \| 0.22 | 11094.27 \| 0.09 | | ||
| | 512 | 3708.54 \| 0.27 | 9446.34 \| 0.11 | 5416.48 \| 0.18 | 11390.85 \| 0.09 | | ||
| | 640 | 3859.43 \| 0.26 | 9572.53 \| 0.10 | 6113.65 \| 0.16 | 11625.71 \| 0.09 | | ||
| | 768 | 3804.82 \| 0.26 | 9464.75 \| 0.11 | 6582.52 \| 0.15 | 11814.31 \| 0.08 | | ||
| | 896 | 3652.42 \| 0.27 | 9482.11 \| 0.11 | 7111.08 \| 0.14 | 11744.38 \| 0.09 | | ||
| | 1024 | oom | 9710.46 \| 0.10 | 7486.36 \| 0.13 | 11534.95 \| 0.09 | | ||
| | 1152 | oom | 9712.39 \| 0.10 | 7544.99 \| 0.13 | oom | | ||
| | 1280 | oom | 9667.19 \| 0.10 | 7858.91 \| 0.13 | oom | | ||
| | 1408 | oom | 9771.91 \| 0.10 | 8116.30 \| 0.12 | oom | | ||
| | 1536 | oom | 9744.56 \| 0.10 | 8201.28 \| 0.12 | oom | | ||
| | 1664 | oom | 9719.82 \| 0.10 | 8227.56 \| 0.12 | oom | | ||
| | 1792 | oom | 9690.61 \| 0.10 | 8344.36 \| 0.12 | oom | | ||
| | 1920 | oom | oom | oom | oom | | ||
| | ||
| Latency (sec) | ||
| | batch_size | HF (fp32) | HF (bf16) | HF (int8) | DS-inference (fp16) | | ||
| |:----------:|:---------:|:---------:|:---------:|:-------------------:| | ||
| | 1 | 1.94 | 2.11 | 6.05 | 1.62 | | ||
| | 2 | 1.92 | 2.06 | 5.92 | 1.65 | | ||
| | 4 | 1.89 | 2.06 | 5.94 | 1.67 | | ||
| | 8 | 1.94 | 2.16 | 5.96 | 1.62 | | ||
| | 16 | 1.99 | 2.05 | 5.80 | 1.65 | | ||
| | 32 | 2.03 | 2.08 | 5.96 | 1.60 | | ||
| | 64 | 2.36 | 2.11 | 5.98 | 1.61 | | ||
| | 128 | 4.30 | 2.21 | 6.23 | 1.70 | | ||
| | 256 | 6.93 | 3.12 | 7.26 | 2.50 | | ||
| | 384 | 10.69 | 4.12 | 8.37 | 3.46 | | ||
| | 512 | 14.82 | 5.42 | 9.45 | 4.49 | | ||
| | 640 | 19.85 | 6.69 | 10.47 | 5.51 | | ||
| | 768 | 20.18 | 8.11 | 11.67 | 6.50 | | ||
| | 896 | 24.53 | 9.45 | 12.60 | 7.63 | | ||
| | 1024 | oom | 10.55 | 13.68 | 8.88 | | ||
| | 1152 | oom | 11.86 | 15.27 | oom | | ||
| | 1280 | oom | 13.24 | 16.29 | oom | | ||
| | 1408 | oom | 14.41 | 17.35 | oom | | ||
| | 1536 | oom | 15.76 | 18.73 | oom | | ||
| | 1664 | oom | 17.12 | 20.22 | oom | | ||
| | 1792 | oom | 18.49 | 21.48 | oom | | ||
| | 1920 | oom | oom | oom | oom | |
This file was deleted.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| export CUDA_VISIBLE_DEVICES=0 | ||
| | ||
| rm -rf ./tmp | ||
| | ||
| for bs in {1,2,4,8,16,32,64} | ||
| do | ||
| make $1 batch_size=$bs | ||
| done | ||
| | ||
| for i in {1..20} | ||
| do | ||
| bs=$(($i*128)) | ||
| make $1 batch_size=$bs | ||
| done |
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
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
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the fix for ds-inference