[Bugfix] Access get_vocab instead of vocab in tool parsers (#9188)

This commit is contained in:
Cyrus Leung
2024-10-09 22:59:57 +08:00
committed by GitHub
parent 21906a6f50
commit cfaa6008e6
3 changed files with 11 additions and 6 deletions

View File

@@ -50,10 +50,9 @@ class Hermes2ProToolParser(ToolParser):
raise ValueError(
"The model tokenizer must be passed to the ToolParser "
"constructor during construction.")
self.tool_call_start_token_id: int = self.model_tokenizer.vocab.get(
self.tool_call_start_token, None)
self.tool_call_end_token_id: int = self.model_tokenizer.vocab.get(
self.tool_call_end_token, None)
self.tool_call_start_token_id = self.vocab.get(
self.tool_call_start_token)
self.tool_call_end_token_id = self.vocab.get(self.tool_call_end_token)
if not self.tool_call_start_token_id or not self.tool_call_end_token_id:
raise RuntimeError(
"Hermes 2 Pro Tool parser could not locate tool call start/end "