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

Refactoring LLama Attention and mlp layers #589

Merged
merged 3 commits into from
Dec 11, 2023
Merged

Refactoring LLama Attention and mlp layers #589

merged 3 commits into from
Dec 11, 2023

Conversation

bgoldberg-habana
Copy link
Collaborator

@bgoldberg-habana bgoldberg-habana commented Dec 8, 2023

Module for scope linearAllreduce
this change allows better memory consumption and better optimizations in synapse when running llama 70b on deepspeed

Module for scope linearAllreduce
this change allows better memory consumption and better optimizations in synapse

Change-Id: I3a30a09d6d61aece7ce605bb672e1485d3fbe1cc
@HuggingFaceDocBuilderDev

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.

@MrGeva
Copy link

MrGeva commented Dec 10, 2023

LGTM

Copy link
Collaborator

@regisss regisss left a comment

Choose a reason for hiding this comment

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

I just left a last comment that will be addressed quickly.

Besides, do you have numbers to see the kind of memory that is saved doing this?

optimum/habana/transformers/models/llama/modeling_llama.py Outdated Show resolved Hide resolved
@bgoldberg-habana
Copy link
Collaborator Author

bgoldberg-habana commented Dec 11, 2023

cmd line -
ENABLE_SYNAPSE_QUANTIZATION=false USE_DEFAULT_QUANT_PARAM=true UPDATE_GRAPH_OUTPUT_MME=false ENABLE_CALC_DYNAMIC_RANGE=false ENABLE_EXPERIMENTAL_FLAGS=true deepspeed --num_gpus 8 run_generation.py --model_name_or_path /mnt/weka/data/pytorch/llama2/Llama-2-70b-hf/ --use_hpu_graphs --use_kv_cache --kv_cache_fp8 --batch_size 50 --fp8 --reuse_cache --trim_logits --n_iterations 5 --attn_softmax_bf16 --limit_hpu_graphs --max_new_tokens 2048 --max_input_tokens 2048

pay attention i'm running already on 1.14 but i don't think the numbers changed much from 1.13

with change -
Throughput (including tokenization) = 1581.191910099665 tokens/second
Number of HPU graphs = 333
Memory allocated = 19.07 GB
Max memory allocated = 49.15 GB
Total memory available = 94.62 GB
Graph compilation duration = 524.4125659640013 seconds

reference
Throughput (including tokenization) = 1257.5571168775869 tokens/second
Number of HPU graphs = 333
Memory allocated = 27.33 GB
Max memory allocated = 87.02 GB
Total memory available = 94.62 GB
Graph compilation duration = 542.6321858290012 seconds

@regisss regisss merged commit afea217 into main Dec 11, 2023
9 checks passed
@regisss regisss deleted the scope branch December 11, 2023 13:46
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.

4 participants