Skip to content

Commit

Permalink
improve check for batched
Browse files Browse the repository at this point in the history
  • Loading branch information
winglian committed Jan 7, 2025
1 parent df9abb3 commit 86de7fb
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/axolotl/prompt_strategies/chat_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,12 @@ def supports_batched(self) -> bool:
return True

def is_prompt_batched(self, prompt: dict[str, Any]) -> bool:
return all(isinstance(v, list) for v in prompt.values()) and all(
isinstance(v, list) for v in prompt[self.messages]
)
try:
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]):
"""
Expand Down

0 comments on commit 86de7fb

Please sign in to comment.