Westlake-AI / MogaNet

[ICLR 2024] MogaNet: Efficient Multi-order Gated Aggregation Network
https://arxiv.org/abs/2211.03295
Apache License 2.0
162 stars 13 forks source link

About load pretrained models error #3

Closed Cxz-dev closed 1 year ago

Cxz-dev commented 1 year ago

Hi! Thanks for your code release! when I use moganet_base, I set pretrained=True, the error as follows:

RuntimeError: Error(s) in loading state_dict for MogaNet: Unexpected key(s) in state_dict: "head.weight", "head.bias" Can u give me some advice?

Cxz-dev commented 1 year ago

I dowload the pretrained model from https://github.com/Westlake-AI/MogaNet/releases/download/moganet-in1k-weights/moganet_base_sz224_8xbs128_ep300.pth.tar

Lupin1998 commented 1 year ago

Hi, @Cxz-dev, thanks for using MogaNet. Could you please describe your usage in detail? The RuntimeError you met is caused by no classification head in the built model. I provide two situations of loading pre-trained models and hope these will be helpful to you.

Lupin1998 commented 1 year ago

Thanks for your question. I will close this issue if you have no more questions. Please feel free to open a new issue when new problems occur.