Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

[DOC] : Improved error message in SentencePiece tokenizer #1600

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/gluonnlp/data/tokenizers/sentencepiece.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,13 @@ def __init__(self, model_path: Optional[str] = None,
if k in special_tokens_kv:
if v != special_tokens_kv[k]:
raise ValueError(
'"vocab.{}" is already set to "{}" in the sentencepiece model. '
'Cannot reset it to "{}"'.format(k, special_tokens_kv[k], v))
'"vocab.{}" expects "{}" as a valid argument in the sentencepiece model. '
'"{}" is an invalid/unexpected argument'.format(k, special_tokens_kv[k], v))
continue
if v in existing_control_tokens:
if k != token_id_to_token_name[v]:
raise ValueError('"{}" is already registered as "vocab.{}". '
'We cannot rename it to "vocab.{}".'
raise ValueError('"{}" is registered to "vocab.{}". '
'"vocab.{}" is an invalid argument. '
.format(v, token_id_to_token_name[v], k))
continue
if v in other_control_tokens:
Expand Down
Loading