Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion torchtitan/hf_datasets/text_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@ def __iter__(self):
]

input = x[:-1]
label = x[1:]
label = x[1:].clone()
# Mask EOS tokens in the label to avoid predicting from
# next-document context.
label[input == self._tokenizer.eos_id] = IGNORE_INDEX
positions = pos[:-1]
yield {"input": input, "positions": positions}, label

Expand Down