tevatron icon indicating copy to clipboard operation
tevatron copied to clipboard

Trainer compute_loss signature mismatch with newer transformers version

Open maxjeblick opened this issue 1 year ago • 3 comments

Current transformers version 4.46.1 def compute_loss signature changed causing issues when importing and using from tevatron.retriever.trainer import TevatronTrainer as Trainer (The transformers code change is probably due to the recent fix w.r.t. gradient accumulation).

Changing the loss signature to def compute_loss(self, model, inputs, return_outputs=False, num_items_in_batch=None): in the trainer fixes the issue. This seems to be backward compatible to older transformer versions.

maxjeblick avatar Nov 04 '24 18:11 maxjeblick

Thanks, I submitted a pull request #161 here, and I hope it can be merged asap.

liyongkang123 avatar Nov 25 '24 22:11 liyongkang123

Done

liyongkang123 avatar Nov 26 '24 18:11 liyongkang123

sorry for the late response. Thank you @liyongkang123 for fixing the issue.

MXueguang avatar Nov 26 '24 18:11 MXueguang