I am trying to deep copy models
Are there any recommended methods to clone a model? and Copying weights from one net to another
recommends to use copy.deepcopy() which works, but shouldn’t I need to deep copy optimizer as well?
I am confused between following tow -
model2 = copy.deepcopy(model1) opt2 = torch.optim.Adam(model2.parameters(), lr = 0.0001)
model2 = copy.deepcopy(model1) opt2 = copy.deepcopy(opt1) # we are deepcopying model1 so, deep copy it's optimizer
Which approach is better? or incorrect?