Skip to content

Commit

Permalink
fix windows bug (#4431)
Browse files Browse the repository at this point in the history
  • Loading branch information
gongenlei committed Jan 11, 2023
1 parent c0134dd commit 31b5e19
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion paddlenlp/transformers/pegasus/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ def shift_tokens_right(input_ids, pad_token_id, decoder_start_token_id):
if pad_token_id is None:
raise ValueError("self.model.config.pad_token_id has to be defined.")

shifted_input_ids = paddle.where(shifted_input_ids == -100, pad_token_id, shifted_input_ids)
shifted_input_ids = paddle.where(
shifted_input_ids == -100, paddle.full_like(shifted_input_ids, pad_token_id), shifted_input_ids
)
return shifted_input_ids


Expand Down

0 comments on commit 31b5e19

Please sign in to comment.