tofu icon indicating copy to clipboard operation
tofu copied to clipboard

One of the inputs missing for DPO loss

Open chrisliu298 opened this issue 11 months ago • 4 comments

When I use dpo as the forget loss, I encountered the following error:

Traceback (most recent call last):
  File "/root/tofu/forget.py", line 187, in main
    trainer.train()
  File "/usr/local/lib/python3.10/dist-packages/transformers/trainer.py", line 1780, in train
    return inner_training_loop(
  File "/usr/local/lib/python3.10/dist-packages/transformers/trainer.py", line 2118, in _inner_training_loop
    tr_loss_step = self.training_step(model, inputs)
  File "/usr/local/lib/python3.10/dist-packages/transformers/trainer.py", line 3036, in training_step
    loss = self.compute_loss(model, inputs)
  File "/root/tofu/dataloader.py", line 149, in compute_loss
    idk_inputs, forget_inputs, retain_inputs = inputs
ValueError: not enough values to unpack (expected 3, got 2)

After some inspection, I noticed that the inputs variable only contains 2 elements instead of 3, leading to the error. I made no code modification and double-checked that TextForgetDatasetDPOQA is used and has three items returned by __getitem__. However, I wasn't able to trace the source of this error.

chrisliu298 avatar Mar 28 '24 17:03 chrisliu298