Completions Only Loss is incompatible with use_liger_kernel set as true
Hi Team, discovered that completions only loss does not work when use_liger_kernel is set as true, since this line drops the completion_mask. Is this an expected behavior?
https://github.com/huggingface/trl/blob/65245f6be8dea3d559a58788eca439f9c2d0f1e2/trl/trainer/sft_trainer.py#L670
Has anyone solved this issue?
@qgallouedec or @kashif Can you help with this question? I think this came in from this change: https://github.com/huggingface/trl/commit/5b9236d1e8d062ad76f088b0730e36c724ec170c
I've been running into this issue too.
You can bypass it by processing your datasets manually, and passing dataset_kwargs={'skip_prepare_dataset': True} to SFTConfig:
training_args = SFTConfig(
...,
dataset_kwargs = {'skip_prepare_dataset': True}
)
Alternatively I believe you could edit
https://github.com/huggingface/trl/blob/6a6d4345c9e0ded5bdcfc67ca2d8d20ecb75d309/trl/trainer/sft_trainer.py#L794-L795
to include 'completion_mask' as well:
if args.use_liger_kernel:
dataset = dataset.select_columns({"input_ids", "position_ids", "completion_mask"}.intersection(dataset.column_names))
closing this issue in favor of the fix here #3674