Skip to content

Commit

Permalink
update type annotation per PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
winglian committed Sep 19, 2023
1 parent e136a7b commit 7571db3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/axolotl/prompt_tokenizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,13 @@ def _get_assistant_token(self):
pass
return False

def _tokenize(self, prompt: str, add_eos_token=True, strip_bos_token=False):
result: Union[Dict[str, List[Union[bool, int]]], BatchEncoding]
def _tokenize(
self, prompt: str, add_eos_token: bool = True, strip_bos_token: bool = False
) -> BatchEncoding:
result: BatchEncoding
if not prompt.strip():
LOG.warning("Empty text requested for tokenization.")
result = {"input_ids": [], "attention_mask": []}
result = BatchEncoding(data={"input_ids": [], "attention_mask": []})
else:
result = self.tokenizer(
prompt,
Expand Down

0 comments on commit 7571db3

Please sign in to comment.