truskovskiyk / nima.pytorch

NIMA: Neural IMage Assessment
MIT License
330 stars 79 forks source link

The dict obtained from pretrained-model.pth had no the key "model_type" #26

Open MichaelWU0726 opened 4 years ago

MichaelWU0726 commented 4 years ago

Hi, in inference_model.py", line 20, in init self.model = create_model(model_type=model_state['model_type'], drop_out=0) called by in cli.py line89 model = InferenceModel(path_to_model_state=path_to_model_state). I used pretrained-model.pth that you provided to validate it, and caused that KeyError: 'model_type'. I also printed the keys of dict obtained from loaded model you provided and it didn't have the key "model_type". Then, can you explain it for me? Thanks.

Zijian007 commented 1 year ago

I met the same problem. Have you solved it?

MichaelWU0726 commented 1 year ago

I met the same problem. Have you solved it?

It had been too long and I forgot whether it was solved. For that, I guess it can be caused by the saved way of model file. There is a my article about it for referring No module named ‘models‘. If any question about this article, please ask me again.

Cashel-000 commented 1 year ago

Thanks for your sharing! I met this problem too. May any solutions? Thank a lot!