PWhiddy / PokemonRedExperiments

Playing Pokemon Red with Reinforcement Learning

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot run trained model

ambrosekwok opened this issue · comments

Hello,

I got below error when try to run trained model.

UserWarning: Using SDL2 binaries from pysdl2-dll 2.28.0
2802     pyboy.pyboy                    WARNING  The emulation speed might not be accurate when speed-target is higher than 5

loading checkpoint
Wrapping the env with a `Monitor` wrapper
Wrapping the env in a DummyVecEnv.
Wrapping the env in a VecTransposeImage.
Traceback (most recent call last):
  File "/PokemonRedExperiments/baselines/run_pretrained_interactive.py", line 47, in <module>
    model = PPO.load(file_name, env=env, custom_objects={'lr_schedule': 0, 'clip_range': 0})
  File "/usr/local/lib/python3.10/dist-packages/stable_baselines3/common/base_class.py", line 716, in load
    check_for_correct_spaces(env, data["observation_space"], data["action_space"])
  File "/usr/local/lib/python3.10/dist-packages/stable_baselines3/common/utils.py", line 231, in check_for_correct_spaces
    raise ValueError(f"Action spaces do not match: {action_space} != {env.action_space}")
ValueError: Action spaces do not match: Discrete(6) != Discrete(8)

I am using fast-version branch
Trained using run_baseline_parallel_fast.py and it generated session directory session_ef5c8b08 with poke_655360_steps.zip
After that I modified the below line in run_pretrained_interactive.py and run it. But I got the mentioned error above.

# file_name = 'session_4da05e87_main_good/poke_439746560_steps'
file_name = 'session_ef5c8b08/poke_655360_steps'

Am I missing any steps to reproduce the training?

Thank you.

Ambrose

Hi!
Change the extra_buttons env config flag in the run_pretrained_interactive.py script to False and it should work with the models trained with the fast script!

Thank you, this work.

Hi! Change the extra_buttons env config flag in the run_pretrained_interactive.py script to False and it should work with the models trained with the fast script!

I am also running into this issue. I have modified the extra_buttons config flag to false but still encounter this error. Wondering if anyone else has dealt with this. Below is the console output.
Screenshot from 2024-02-14 23-28-29

I am also running into this issue. I have modified the extra_buttons config flag to false but still encounter this error. Wondering if anyone else has dealt with this. Below is the console output. Screenshot from 2024-02-14 23-28-29

Your issue is you're pointing to a file that doesn't exist. Verify the path to poke_439765460_steps.zip and update the code if necessary to reflect the actual location of the file. The Discord help channel https://discord.com/channels/1163946237242908757/1166418574290727083 may be able to assist you further.