fix missing pad token (#5690)

Co-authored-by: Edenzzzz <wtan45@wisc.edu>
pull/5691/head
Edenzzzz 2024-05-06 18:17:26 +08:00 committed by GitHub
parent d3f34ee8cc
commit c25f83c85f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 1 deletions

View File

@ -243,7 +243,12 @@ def main():
# ==================================== # ====================================
# gpt2 pretrained model # gpt2 pretrained model
cfg = AutoConfig.from_pretrained(model_name, num_labels=data_builder.num_labels) cfg = AutoConfig.from_pretrained(
model_name,
num_labels=data_builder.num_labels,
pad_token=data_builder.tokenizer.pad_token,
pad_token_id=data_builder.tokenizer.pad_token_id,
)
if model_name == "gpt2": if model_name == "gpt2":
model = GPT2ForSequenceClassification.from_pretrained(model_name, config=cfg).cuda() model = GPT2ForSequenceClassification.from_pretrained(model_name, config=cfg).cuda()