Hey guys. I am running some code in a novel class created that inherits from Huggingface Seq2SeqTrainer, which in turn inherits from HF transformers trainer. In this class, I am trying to modify the evaluation_loop method of the trainer class to move inputs to a cuda device.
Here is the code in my evaluate method that calls evaluation_loop (eval_loop is just evaluation_loop in this case)
output = eval_loop(
eval_dataloader,
description="Evaluation",
# No point gathering the predictions if there are no metrics, otherwise we defer to
# self.args.prediction_loss_only
prediction_loss_only=True if compute_metrics is None else None,
ignore_keys=ignore_keys,
)
However, when I literally copy the code for evaluation_loop straight from the HF trainer.py docs on GitHub and paste it into my class (making no changes whatsoever just to test it out), it gives the following error: TypeError: _wrap_model() got an unexpected keyword argument 'dataloader'
. If I don’t add the code for evaluation_loop to my class and instead let self.evaluation_loop refer to the inherited method (which should be the exact same), I don’t get this error (although I do get the error later regarding the devices thing - precisely why I need to modify the method in the first place).
Anyone have any ideas why this could be happening? It has to be some sort of class inheritance thing somewhere…