I would first introduce that you are migrating from Chainer to PyTorch to add a context of your question.



 Safa_Mathlouthi:

File "train.py", line 94, in main
    optimizer.setup(vrn)



I don’t have experience with Chainer, but in PyTorch you we don’t have setup method on an optimizer, so you would need to remove what you have and create Adam optimizer in Pytorch 2 something like this:
from torch.optim import *
o = Adam(model.parameters(), lr=lr)

And in general you go step by step resolving all other errors.