Hi all,
Do models that are saved during fit_one_cycle savemodelcallback have to be loaded differently than those just regularly saved?
I have the following code:
learn_c.fit_one_cycle(100, slice(1e-3/(2.6**4),1e-3), moms=(0.8,0.7),callbacks=[SaveModelCallback(learn_c, every='improvement',monitor='accuracy', name='best_class_'+trans)])
which creates the best_class_niv.pth
But when I try to load this model I get this:
learn_c.load('best_class_'+trans)
/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py in load_state_dict(self, state_dict, strict)
835 if len(error_msgs) > 0:
836 raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
--> 837 self.__class__.__name__, "\n\t".join(error_msgs)))
838 return _IncompatibleKeys(missing_keys, unexpected_keys)
839
RuntimeError: Error(s) in loading state_dict for SequentialRNN:
Missing key(s) in state_dict: "0.module.encoder.weight", "0.module.encoder_dp.emb.weight", "0.module.rnns.0.weight_hh_l0_raw", "0.module.rnns.0.module.weight_ih_l0", "0.module.rnns.0.module.weight_hh_l0", "0.module.rnns.0.module.bias_ih_l0", "0.module.rnns.0.module.bias_hh_l0", "0.module.rnns.1.weight_hh_l0_raw", "0.module.rnns.1.module.weight_ih_l0", "0.module.rnns.1.module.weight_hh_l0", "0.module.rnns.1.module.bias_ih_l0", "0.module.rnns.1.module.bias_hh_l0", "0.module.rnns.2.weight_hh_l0_raw", "0.module.rnns.2.module.weight_ih_l0", "0.module.rnns.2.module.weight_hh_l0", "0.module.rnns.2.module.bias_ih_l0", "0.module.rnns.2.module.bias_hh_l0", "1.layers.0.weight", "1.layers.0.bias", "1.layers.0.running_mean", "1.layers.0.running_var", "1.layers.2.weight", "1.layers.2.bias", "1.layers.4.weight", "1.layers.4.bias", "1.layers.4.running_mean", "1.layers.4.running_var", "1.layers.6.weight", "1.layers.6.bias".
Unexpected key(s) in state_dict: "0.encoder.weight", "0.encoder_dp.emb.weight", "0.rnns.0.weight_hh_l0_raw", "0.rnns.0.module.weight_ih_l0", "0.rnns.0.module.weight_hh_l0", "0.rnns.0.module.bias_ih_l0", "0.rnns.0.module.bias_hh_l0", "0.rnns.1.weight_hh_l0_raw", "0.rnns.1.module.weight_ih_l0", "0.rnns.1.module.weight_hh_l0", "0.rnns.1.module.bias_ih_l0", "0.rnns.1.module.bias_hh_l0", "0.rnns.2.weight_hh_l0_raw", "0.rnns.2.module.weight_ih_l0", "0.rnns.2.module.weight_hh_l0", "0.rnns.2.module.bias_ih_l0", "0.rnns.2.module.bias_hh_l0", "1.decoder.weight", "1.decoder.bias". ```
Thanks in advance
Randy