How to load my pretrained vgg weight?


(손주형) #1

I have fine tuned vgg model.

and I want to apply this weight to my model.
how can i do this?


#2

You can just load your weights using model.load_state_dict(torch.load('PATH_TO_STATE_DICT')).


(손주형) #3

I forget to mention this the saved weight is just part of the model.
the model contains vgg and I want to load only weights fine tuned vgg parameters and not the rest of the model.
is it okay?


#4

If you’ve stored the vgg part as an attribute, you could load it via model.vgg.load_state_dict(...).
Would that work in your use case? If not, could you post your model architecture?