Skip to content

Commit

Permalink
py : remove unnecessary hasattr (ggerganov#4903)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggerganov committed Jan 16, 2024
1 parent bee938d commit 5c99960
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions convert-hf-to-gguf.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,10 @@ def _set_vocab_gpt2(self):
toktypes.append(gguf.TokenType.USER_DEFINED)
elif reverse_vocab[i] in added_vocab:
tokens.append(reverse_vocab[i])
if hasattr(tokenizer, "added_tokens_decoder"):
if tokenizer.added_tokens_decoder[i].special:
toktypes.append(gguf.TokenType.CONTROL)
else:
toktypes.append(gguf.TokenType.USER_DEFINED)
if tokenizer.added_tokens_decoder[i].special:
toktypes.append(gguf.TokenType.CONTROL)
else:
toktypes.append(gguf.TokenType.USER_DEFINED)
else:
tokens.append(reverse_vocab[i])
toktypes.append(gguf.TokenType.NORMAL)
Expand Down

0 comments on commit 5c99960

Please sign in to comment.