Skip to content

Commit

Permalink
Simplification.
Browse files Browse the repository at this point in the history
  • Loading branch information
justinxzhao committed Oct 17, 2023
1 parent e9b4666 commit 55d0da9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ludwig/utils/strings_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def _get_vocabulary(
if tokenizer_type == "hf_tokenizer":
try:
vocab = tokenizer.get_vocab()
vocab = list(vocab.keys())
return list(vocab.keys())
except NotImplementedError:
logger.warning(
"HuggingFace tokenizer does not have a get_vocab() method. "
Expand All @@ -286,7 +286,7 @@ def _get_vocabulary(
for idx in range(tokenizer.tokenizer.vocab_size):
vocab.append(tokenizer.tokenizer._convert_id_to_token(idx))
vocab += tokenizer.tokenizer.added_tokens_encoder.keys()
return vocab
return vocab

# The tokenizer has a preset vocabulary.
if hasattr(tokenizer, "get_vocab"):
Expand Down

0 comments on commit 55d0da9

Please sign in to comment.