Hi,
I have a model structured in small networks in a network. After training it, I save the model with torch.save(model.state_dict() … and it can be loaded it with model.load_state_dict without any errors. To transfer the weights & biases for the C++ implementation from python implementation I used the torch::jit to save them into a file. I traverse the network to get weight and bias values at each node.
To test if it works I load the weights & biases from the file in python-pytorch after instantiating the model, and continue to train the model but the loss value becomes very high and model parameters are not updating.
If I first load the trained model with model.load_state_dict and update the weights & biases from the file which was saved with torch::jit the model continues to train from where it was. To hold all the layers in the networks I used torch.ModuleLists.
To load the parameters directly from a file after instantiating the model is there any specific thing that I have to do?
Thanks.