Skip to content

Commit

Permalink
fix next-tokens after update_model_kwargs_for_generation (#6919)
Browse files Browse the repository at this point in the history
  • Loading branch information
wj-Mcat authored Sep 5, 2023
1 parent 19a9207 commit 3a9d41b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions paddlenlp/experimental/transformers/generation_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ def update_model_kwargs_for_generation(self, cache, just_decoder, next_tokens, e
model_kwargs["seq_len_decoder"],
model_kwargs["seq_len_decoder"] + 1,
)

model_kwargs["next_tokens"] = next_tokens
return model_kwargs

def sample(
Expand Down Expand Up @@ -271,6 +273,7 @@ def _post_process_(outputs, top_p, temperature, step_idx_ori, model_kwargs):
model_kwargs = self.update_model_kwargs_for_generation(
cache, just_decoder, next_tokens, eos_token_id, model_kwargs
)
next_tokens = model_kwargs["next_tokens"]

save_with_output(
next_tokens,
Expand Down

0 comments on commit 3a9d41b

Please sign in to comment.