improve check for batched
This commit is contained in:
@@ -227,9 +227,12 @@ class ChatTemplateStrategy(PromptTokenizingStrategy):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def is_prompt_batched(self, prompt: dict[str, Any]) -> bool:
|
def is_prompt_batched(self, prompt: dict[str, Any]) -> bool:
|
||||||
return all(isinstance(v, list) for v in prompt.values()) and all(
|
try:
|
||||||
isinstance(v, list) for v in prompt[self.messages]
|
return all(isinstance(v, list) for v in prompt.values()) and all(
|
||||||
)
|
isinstance(v, list) for v in prompt[self.messages]
|
||||||
|
)
|
||||||
|
except KeyError:
|
||||||
|
return False
|
||||||
|
|
||||||
def tokenize_prompt(self, prompt: dict[str, Any]):
|
def tokenize_prompt(self, prompt: dict[str, Any]):
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user