Merge pull request #1398 from jackapbutler/fix-tokenizer-match

Add tests and update docstring to tokenizer matching
This commit is contained in:
sanagnos
2023-02-10 11:37:00 +01:00
committed by GitHub
2 changed files with 24 additions and 2 deletions
+4 -1
View File
@@ -106,7 +106,10 @@ TOKENIZER_CONFIGS = {
def match_tokenizer_name(model_name: str) -> TokenizerConfig:
"""Match a partial model name to a tokenizer configuration"""
"""
Match a partial model name to a tokenizer configuration
i.e. model_name `Salesforce/codegen-2B-multi` has config name `codegen`
"""
tokenizer_config_matches = [config for name, config in TOKENIZER_CONFIGS.items() if name in model_name]
if not tokenizer_config_matches:
raise ValueError(f"Cannot find any tokeniser configuration to match {model_name=}")