a-PyTorch-Tutorial-to-Image-Captioning
a-PyTorch-Tutorial-to-Image-Captioning copied to clipboard
pretrained model can't be read
I used these source code on google colab by porting. But these codes can't read the pretrained model. The error message is as follows:
`
AttributeError Traceback (most recent call last)
1 frames /usr/local/lib/python3.6/dist-packages/torch/serialization.py in _legacy_load(f, map_location, pickle_module, **pickle_load_args) 772 unpickler = pickle_module.Unpickler(f, **pickle_load_args) 773 unpickler.persistent_load = persistent_load --> 774 result = unpickler.load() 775 776 deserialized_storage_keys = pickle_module.load(f, **pickle_load_args)
AttributeError: Can't get attribute 'Encoder' on <module 'models' (namespace)> `
Please provide a correct pretrain model.
@sgrvinod @kpis-msa - Getting a similar issue. Is there a solution to this? Migrating to an old pytorch version will work here?
772 unpickler = pickle_module.Unpickler(f, **pickle_load_args)
773 unpickler.persistent_load = persistent_load
--> 774 result = unpickler.load()
775
776 deserialized_storage_keys = pickle_module.load(f, **pickle_load_args)
ModuleNotFoundError: No module named 'models'
It seems that models.py is required to be in the same folder as the trained model while loading the pytorch model in the old way. This link was helpful for me: https://github.com/pytorch/pytorch/issues/3678