Navigation Menu

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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Cannot load pre-trained policy #1233

Closed
4 tasks done
araffin opened this issue Dec 22, 2022 · 1 comment 路 Fixed by #1234
Closed
4 tasks done

[Bug]: Cannot load pre-trained policy #1233

araffin opened this issue Dec 22, 2022 · 1 comment 路 Fixed by #1234
Labels
bug Something isn't working

Comments

@araffin
Copy link
Member

araffin commented Dec 22, 2022

馃悰 Bug

Bug introduced in #1148

We might also want to check we are not saving the weights of the features extractor two times.

To Reproduce

Just load a pretrained PPO agent saved with SB3 v1.6.2 with a CNN policy.

python enjoy.py --algo a2c --env BreakoutNoFrameskip-v4

Found by updating the RL Zoo: https://github.com/DLR-RM/rl-baselines3-zoo/actions/runs/3760560053/jobs/6391404574

Relevant log output / Error message

RuntimeError: Error(s) in loading state_dict for ActorCriticCnnPolicy:
	Missing key(s) in state_dict: "pi_features_extractor.cnn.0.weight", "pi_features_extractor.cnn.0.bias", "pi_features_extractor.cnn.2.weight", "pi_features_extractor.cnn.2.bias", "pi_features_extractor.cnn.4.weight", "pi_features_extractor.cnn.4.bias", "pi_features_extractor.linear.0.weight", "pi_features_extractor.linear.0.bias", "vf_features_extractor.cnn.0.weight", "vf_features_extractor.cnn.0.bias", "vf_features_extractor.cnn.2.weight", "vf_features_extractor.cnn.2.bias", "vf_features_extractor.cnn.4.weight", "vf_features_extractor.cnn.4.bias", "vf_features_extractor.linear.0.weight", "vf_features_extractor.linear.0.bias".

System Info

No response

Checklist

  • I have checked that there is no similar issue in the repo
  • I have read the documentation
  • I have provided a minimal working example to reproduce the bug
  • I've used the markdown code blocks for both code and stack traces.
@araffin araffin added the bug Something isn't working label Dec 22, 2022
@araffin
Copy link
Member Author

araffin commented Dec 22, 2022

@qgallouedec one easy fix is to tell user to use exact_match=False and then save the policy again.
I'm working on a better one (or at least one that doesn't require user action).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant