mirror of
https://github.com/huggingface/transformers.git
synced 2025-08-02 19:21:31 +06:00
Fix DataCollatorForLanguageModeling (#8621)
This commit is contained in:
parent
f6fe41c96b
commit
8fcb6935a1
@ -261,7 +261,7 @@ class DataCollatorForLanguageModeling:
|
||||
batch["input_ids"], special_tokens_mask=special_tokens_mask
|
||||
)
|
||||
else:
|
||||
labels = batch["input_ids"]
|
||||
labels = batch["input_ids"].clone()
|
||||
if self.tokenizer.pad_token_id is not None:
|
||||
labels[labels == self.tokenizer.pad_token_id] = -100
|
||||
batch["labels"] = labels
|
||||
|
Loading…
Reference in New Issue
Block a user