Fix(tokenizer): Fix condition to add pad token (#477)
* Fix(tokenizer): Fix condition to add pad token * chore: fix lint
This commit is contained in:
@@ -55,10 +55,15 @@ def load_tokenizer(cfg):
|
|||||||
**tokenizer_kwargs,
|
**tokenizer_kwargs,
|
||||||
)
|
)
|
||||||
|
|
||||||
if tokenizer.__class__.__name__ in [
|
if (
|
||||||
"LlamaTokenizer",
|
tokenizer.__class__.__name__
|
||||||
"LlamaTokenizerFast",
|
in [
|
||||||
] and not hasattr(tokenizer, "pad_token"):
|
"LlamaTokenizer",
|
||||||
|
"LlamaTokenizerFast",
|
||||||
|
]
|
||||||
|
and hasattr(tokenizer, "pad_token")
|
||||||
|
and not tokenizer.pad_token
|
||||||
|
):
|
||||||
# set a pad_token, but use eos_token so we don't add a new token
|
# set a pad_token, but use eos_token so we don't add a new token
|
||||||
tokenizer.pad_token = LLAMA_DEFAULT_EOS_TOKEN
|
tokenizer.pad_token = LLAMA_DEFAULT_EOS_TOKEN
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user