DataLoader object not callable when given as function argument

Hi everyone!

I recently tried to use a public repo that you can find here:
USAD

I have an issue when using the training function. I first create my own train and val loaders that I give as arguments:
training(epochs, model, train_loader, val_loader, opt_func=torch.optim.Adam)

It raises an error TypeError: 'DataLoader' object is not callable.

The thing is that this error is supposed to be raised by the line:
optimizer1 = opt_func(list(model.encoder.parameters()) + list(model.decoder1.parameters()))

Even weirder, when I try to call these lines in a notebook (not with the training function), this error won’t occur.

Does anyone have an idea about what could be happening when calling the function?

Thanks a lot for your help!

You are most likely passing the wrong number of arguments to this function and the DataLoader objects is mapped to the opt_func argument thus raising this error.

You are right, this was simply this: the training function was called with an additional argument which was not defined in the version I had.

Thank you very much!