Skip to content

Refactoring LLama Attention and mlp layers#589

Merged
regisss merged 3 commits into
mainfrom
scope
Dec 11, 2023
Merged

Refactoring LLama Attention and mlp layers#589
regisss merged 3 commits into
mainfrom
scope

Conversation

@bgoldberg-habana
Copy link
Copy Markdown
Contributor

@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
Copy link
Copy Markdown

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.

Comment thread optimum/habana/transformers/models/llama/modeling_llama.py Outdated
Comment thread optimum/habana/transformers/models/llama/modeling_llama.py Outdated
Comment thread optimum/habana/transformers/models/modeling_all_models.py Outdated
@MrGeva
Copy link
Copy Markdown

MrGeva commented Dec 10, 2023

LGTM

Copy link
Copy Markdown
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?

Comment thread optimum/habana/transformers/models/llama/modeling_llama.py
@bgoldberg-habana
Copy link
Copy Markdown
Contributor 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

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