Skip to content

Commit

Permalink
add EOT at end of a chat
Browse files Browse the repository at this point in the history
  • Loading branch information
dmahan93 committed Jun 21, 2024
1 parent a950f8b commit e360e24
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tools/datasets/preprocess_data_with_chat_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ def build_chat(
mask.extend([-100] * len(chat_tokens))
else:
mask.extend(chat_tokens)
if tokenizer.eos_token_id is not None:
mask.append(tokenizer.eos_token_id if mask[-1] != -100 else -100)
tokens.append(tokenizer.eos_token_id)
return tokens, mask


Expand Down

0 comments on commit e360e24

Please sign in to comment.