Skip to content

Commit

Permalink
Fix for some tokenizer_config formats
Browse files Browse the repository at this point in the history
  • Loading branch information
turboderp committed Mar 31, 2024
1 parent a203a0b commit 6691c91
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion exllamav2/tokenizer/tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,16 @@ def get_default_token_id(config_key: str, current: int | None, default: int):
if self.tokenizer_config_dict is not None and config_key in self.tokenizer_config_dict:
st = self.tokenizer_config_dict[config_key]
if st is None: return None
return self.tokenizer_model.piece_to_id(st)
if isinstance(st, dict):
stc: str | None = st.get("content", None)
if stc is None:
return None
else:
return self.tokenizer_model.piece_to_id(stc)
elif isinstance(st, str):
return self.tokenizer_model.piece_to_id(st)
else:
return None
else:
return default

Expand Down

0 comments on commit 6691c91

Please sign in to comment.