Search code examples
pythontensorflowmachine-learningdeep-learningchainer

Loading a pre-trained model in Chainer Deep Learning Framework


I need to load a pre-trained model in Chainer framework, but as I understood, the saved (.npz) file only contains the weights and I have to reconstruct the model then load the weights into it, and there is no way to load the full model in one command like Tensorflow.

Is this true? I so, anyone with Chainer framework experience can provide some guidance? If not, what is the proper way to load a pre-trained model in the mentioned framework?


Solution

  • Yes, only npz files only contain weights. You need to first construct an instance of the model (a subclass of chainer.Chain), then load weights on it using load_npz. https://docs.chainer.org/en/stable/guides/serializers.html