Update convert-hf-to-gguf.py
Replacing with a less risky alternative to the 'assert' statement
This commit is contained in:
parent
9c77ec1d74
commit
620633e9d8
1 changed files with 3 additions and 1 deletions
|
@ -967,7 +967,9 @@ class XverseModel(Model):
|
|||
from transformers import AutoTokenizer
|
||||
tokenizer = AutoTokenizer.from_pretrained(dir_model)
|
||||
vocab_size = hparams.get("vocab_size", len(tokenizer.vocab))
|
||||
assert max(tokenizer.vocab.values()) < vocab_size
|
||||
if max(tokenizer.get_vocab().values()) >= vocab_size:
|
||||
raise ValueError("Vocabulary size exceeds expected maximum size.")
|
||||
|
||||
|
||||
reverse_vocab: dict[int, str] = {id_: encoded_tok for encoded_tok, id_ in tokenizer.vocab.items()}
|
||||
added_vocab = tokenizer.get_added_vocab()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue