mirror of
https://github.com/wassname/Open-Assistant.git
synced 2026-07-26 13:07:22 +08:00
Merge pull request #1398 from jackapbutler/fix-tokenizer-match
Add tests and update docstring to tokenizer matching
This commit is contained in:
@@ -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=}")
|
||||
|
||||
Reference in New Issue
Block a user