From 87f895b2901179cd98ea9340c4161a684f2d7a86 Mon Sep 17 00:00:00 2001 From: Sen Fang <38727343+TomasAndersonFang@users.noreply.github.com> Date: Tue, 10 Sep 2024 15:42:54 -0400 Subject: [PATCH] FIx "Cannot set a non-string value as the PAD token" problem --- model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model.py b/model.py index fb76ae3..6df7af0 100644 --- a/model.py +++ b/model.py @@ -38,7 +38,7 @@ def __init__(self, pretrained: str = "", weight=None, batch_size=1): print("Max length: {}".format(self.max_length)) self.model = self.model.to(self.device) self.tokenizer = AutoTokenizer.from_pretrained(pretrained) - self.tokenizer.pad_token = 0 + self.tokenizer.pad_token_id = 0 self.tokenizer.padding_side = "left" self.batch_size = batch_size print("Batch size: {}".format(batch_size))