Skip to content

Commit 5e5e74e

Browse files
committed
convert-hf-to-gguf.py: print() --> logger
1 parent 2d2bc99 commit 5e5e74e

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

convert-hf-to-gguf.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -441,9 +441,7 @@ def _set_vocab_sentencepiece(self):
441441

442442
if vocab_size > len(tokens):
443443
pad_count = vocab_size - len(tokens)
444-
print(
445-
f"Padding vocab with {pad_count} token(s) - [PAD1] through [PAD{pad_count}]"
446-
)
444+
logger.debug(f"Padding vocab with {pad_count} token(s) - [PAD1] through [PAD{pad_count}]")
447445
for i in range(1, pad_count + 1):
448446
tokens.append(f"[PAD{i}]")
449447
scores.append(-1000.0)
@@ -2065,8 +2063,7 @@ def set_vocab(self):
20652063
tokenizer_path = self.dir_model / 'tokenizer.model'
20662064

20672065
if not tokenizer_path.is_file():
2068-
print(f'Error: Missing {tokenizer_path}', file=sys.stderr)
2069-
sys.exit(1)
2066+
raise ValueError(f'Error: Missing {tokenizer_path}')
20702067

20712068
tokenizer = SentencePieceProcessor(str(tokenizer_path))
20722069

@@ -2104,7 +2101,7 @@ def set_vocab(self):
21042101
for key in added_tokens_json:
21052102
token_id = added_tokens_json[key]
21062103
if (token_id >= vocab_size):
2107-
print(f'ignore token {token_id}: id is out of range, max={vocab_size - 1}')
2104+
logger.debug(f'ignore token {token_id}: id is out of range, max={vocab_size - 1}')
21082105
continue
21092106

21102107
tokens[token_id] = key.encode("utf-8")

0 commit comments

Comments
 (0)