I have two models, let assume
Model_2 is pretrained and I want to use its output to compute loss and train
Looks something like this:
def train(model1,model2, *args): Model_1.train() Model_2.eval() out1 = Model_1(input) out2 = Model_2(out1) loss = criterion(out2) ... optimizer = torch.optim.SGD(Model_1.parameters(), *args)
Here is a similar question I’ve got some ideas.
My question is should I use
Model_2.eval() even when I am passing only
Model_1 parameters to the optimizer?
Thanks for any advice