Skip to content

Commit

Permalink
Some models have no tokenizers (huggingface#11064)
Browse files Browse the repository at this point in the history
  • Loading branch information
LysandreJik authored and Iwontbecreative committed Jul 15, 2021
1 parent 2866cbe commit 27e026b
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions tests/test_tokenization_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,14 @@ def merge_model_tokenizer_mappings(
model_tokenizer_mapping = OrderedDict([])

for configuration in configurations:
model = model_mapping[configuration]
tokenizer = tokenizer_mapping[configuration][0]
tokenizer_fast = tokenizer_mapping[configuration][1]

model_tokenizer_mapping.update({tokenizer: (configuration, model)})
if tokenizer_fast is not None:
model_tokenizer_mapping.update({tokenizer_fast: (configuration, model)})
if configuration in model_mapping and configuration in tokenizer_mapping:
model = model_mapping[configuration]
tokenizer = tokenizer_mapping[configuration][0]
tokenizer_fast = tokenizer_mapping[configuration][1]

model_tokenizer_mapping.update({tokenizer: (configuration, model)})
if tokenizer_fast is not None:
model_tokenizer_mapping.update({tokenizer_fast: (configuration, model)})

return model_tokenizer_mapping

Expand Down

0 comments on commit 27e026b

Please sign in to comment.