From 5c999609013a30c06e6fd28be8db5c2074bcc196 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Tue, 16 Jan 2024 20:59:31 +0200 Subject: [PATCH] py : remove unnecessary hasattr (#4903) --- convert-hf-to-gguf.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/convert-hf-to-gguf.py b/convert-hf-to-gguf.py index b133f3b49f719..1178d63a231fa 100755 --- a/convert-hf-to-gguf.py +++ b/convert-hf-to-gguf.py @@ -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)