esrnn_torch
esrnn_torch copied to clipboard
Save functionality broken; ESRNN Model Object structure not reflected in save & load
There seems to be an issue with the save function for the ESRNN model. When running
model = ESRNN()
model.save('esrnn_weights.model')
The following error occurs:
---------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-28-4822649eb25a> in <module>
----> 1 model.save('esrnn_weights.model')
~/.local/lib/python3.8/site-packages/ESRNN/ESRNN.py in save(self, model_dir, copy)
494
495 print('Saving model to:\n {}'.format(model_dir)+'\n')
--> 496 torch.save({'model_state_dict': self.es.state_dict()}, es_filepath)
497 torch.save({'model_state_dict': self.rnn.state_dict()}, rnn_filepath)
498
AttributeError: 'ESRNN' object has no attribute 'es'
While exploring this, the I found that the 'save' function is referencing es
, mc
and rnn
, none of which are in the top level of the ESRNN object (self) but in self.esrnn (this can be confirmed with dir(model)
and dir(model.esrnn)
.
In the present state of the project, saving models requires a fair bit of hacking