Hello,
Thank you again for your reply.
So myPyTorchModel currently has no parameters.
When I execute the code below, the code generates an error:
# add a fake parameter to prevent the StopIteration error        
myPyTorchModel = torch.nn.Parameter(torch.tensor([0.], requires_grad=True,
                               dtype=torch.float64))

loss = myPyTorchModel(input_ids = input, labels = labels)[0]
OUT:
Traceback (most recent call last):
File "<ipython-input-20-52d7dadcb74d>", line 1, in <module>
    mc_loss = model(input_ids = input, labels = labels)[0]

TypeError: 'Parameter' object is not callable

The error above is generated because myPyTorchModel = torch.nn.Parameter(torch.tensor([0.], requires_grad=True, dtype=torch.float64)) does not add a callable (fake) parameter to myPyTorchModel.
Is there any way that I can add a fake “callable” parameter to myPyTorchModel? If yes, how can I do it?
Thank you very much again for your help.