py : remove unnecessary hasattr (#4903)

This commit is contained in:
Georgi Gerganov 2024-01-16 20:59:31 +02:00
parent bee938da74
commit 5c99960901
No known key found for this signature in database
GPG Key ID: 449E073F9DC10735

View File

@ -266,11 +266,10 @@ class Model:
toktypes.append(gguf.TokenType.USER_DEFINED) toktypes.append(gguf.TokenType.USER_DEFINED)
elif reverse_vocab[i] in added_vocab: elif reverse_vocab[i] in added_vocab:
tokens.append(reverse_vocab[i]) tokens.append(reverse_vocab[i])
if hasattr(tokenizer, "added_tokens_decoder"): if tokenizer.added_tokens_decoder[i].special:
if tokenizer.added_tokens_decoder[i].special: toktypes.append(gguf.TokenType.CONTROL)
toktypes.append(gguf.TokenType.CONTROL) else:
else: toktypes.append(gguf.TokenType.USER_DEFINED)
toktypes.append(gguf.TokenType.USER_DEFINED)
else: else:
tokens.append(reverse_vocab[i]) tokens.append(reverse_vocab[i])
toktypes.append(gguf.TokenType.NORMAL) toktypes.append(gguf.TokenType.NORMAL)