Add mark step and inplace residual add in llama model code#833
Conversation
…memory consumption (HabanaAI#65) * Add mark step and inplace add. Mark step helping in reducing workspace memory by approx twice of (BS,seq len, hidden dim). Inplace add helping in reducing persistent tensors by approc twice of (BS, seq len, hidden dim). Signed-off-by: Puneesh Khanna <pkhanna@habana.ai> * Add lazy mode parameter * Move mark step within the loop * Move mark step before the loop * Fix indentation * update in place add only for inference --------- Signed-off-by: Puneesh Khanna <pkhanna@habana.ai>
|
As an example for the config of BS-172, seq len-2048, hidden dim-8192 (size is ~5.3 GB) for llama-70B on 8x. We can further go higher batch sizes because of reduced memory consumptions with the changes in this PR hence very important changes. @regisss - please review and merge. |
regisss
left a comment
There was a problem hiding this comment.
LGTM! Just need to run make style.
Quick question, the new mark_step in the forward of GaudiLlamaModel will also benefit training right?
|
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. |
|
@regisss - mark step has no side effect on training. It should help in reducing workspace memory mainly. |
|
@regisss - make style fixed. Just required an empty line after the import statement. It should pass now. |
Signed-off-by: Puneesh Khanna <pkhanna@habana.ai>
Mark step helping in reducing workspace memory by approx twice of (BS,seq len, hidden dim).
Inplace add helping in reducing persistent tensors by approx twice of (BS, seq len, hidden dim).
Add lazy mode parameter.
What does this PR do?
Fixes # (issue)
Before submitting