Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Questions about model validation #19

Open
oceanzhf opened this issue Sep 25, 2024 · 3 comments
Open

Questions about model validation #19

oceanzhf opened this issue Sep 25, 2024 · 3 comments

Comments

@oceanzhf
Copy link

RuntimeError: Error(s) in loading state_dict for Linear:
Missing key(s) in state_dict: "weight", "bias".
Unexpected key(s) in state_dict: "model", "optimizer", "total_steps".
When I use my trained epoch.pth for validate.py, it throws an error. How can I resolve this?

@Bytebender3
Copy link

Hello,I have the same problem too.Have you solve it?

@SilkyFinish
Copy link

Hello,I have the same problem too.Have you solve it?
I have the same problem too.Have you solve it?

@SilkyFinish
Copy link

I have already solved this problem.In the original code the valideate.py needs the pth which only contains two keys:"weight" and "bias",which are the parameters of the final linear layer of the model.However ,after our own training, the pth we saved has three keys:"model", "optimizer", "total_steps",and the "model" contains the paramerters of all the layers in the model.Therfore,you can delete all the other things except the last two parameters of "model" in your pth,which are the needed "weight" and "bias".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants