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

Add mark step and inplace residual add in llama model code to reduce memory consumption #65

Merged
7 commits merged into from
Feb 29, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Move mark step before the loop
  • Loading branch information
Puneesh Khanna authored Feb 28, 2024
commit f34fae3e2e4238485a27161d10c0767ccce3080b
4 changes: 2 additions & 2 deletions optimum/habana/transformers/models/llama/modeling_llama.py
Original file line number Diff line number Diff line change
Expand Up @@ -686,10 +686,10 @@ def forward(
all_self_attns = () if output_attentions else None
next_decoder_cache = () if not use_new_cache else None

for layer_idx, decoder_layer in enumerate(self.layers):
if lazy_mode:
if lazy_mode:
htcore.mark_step()

for layer_idx, decoder_layer in enumerate(self.layers):
if output_hidden_states:
all_hidden_states += (hidden_states,)

Expand Down