Skip to content

Commit

Permalink
Set pad_token in run_glue_no_trainer.py #28534 (#30234)
Browse files Browse the repository at this point in the history
  • Loading branch information
JINO-ROHIT authored and ArthurZucker committed Apr 22, 2024
1 parent 45a03b4 commit cd57355
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions examples/pytorch/text-classification/run_glue_no_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,9 @@ def main():
tokenizer = AutoTokenizer.from_pretrained(
args.model_name_or_path, use_fast=not args.use_slow_tokenizer, trust_remote_code=args.trust_remote_code
)
if tokenizer.pad_token is None:
tokenizer.pad_token = tokenizer.eos_token
config.pad_token_id = tokenizer.pad_token_id
model = AutoModelForSequenceClassification.from_pretrained(
args.model_name_or_path,
from_tf=bool(".ckpt" in args.model_name_or_path),
Expand Down

0 comments on commit cd57355

Please sign in to comment.