We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 42a0a25 commit 1e5b0b7Copy full SHA for 1e5b0b7
unsloth_zoo/dataset_utils.py
@@ -364,8 +364,12 @@ def _train_on_responses_only(examples):
364
365
# Edit data collator as well if not DataCollatorForSeq2Seq
366
from transformers import DataCollatorForSeq2Seq
367
- if hasattr(trainer, "data_collator") and \
368
- not isinstance(trainer.data_collator, DataCollatorForSeq2Seq):
+ packing_enabled = getattr(trainer.args, "packing", False)
+ if (
369
+ hasattr(trainer, "data_collator")
370
+ and not isinstance(trainer.data_collator, DataCollatorForSeq2Seq)
371
+ and not packing_enabled
372
+ ):
373
trainer.data_collator = DataCollatorForSeq2Seq(tokenizer = tokenizer)
374
375
# Check if all labels randomnly got masked to nothing - maybe wrong chat template?
0 commit comments