DLR-RM / rl-baselines3-zoo

A training framework for Stable Baselines3 reinforcement learning agents, with hyperparameter optimization and pre-trained agents included.
https://rl-baselines3-zoo.readthedocs.io
MIT License
1.89k stars 494 forks source link

[Error]: I got unexpected error using enjoy() with pretrain model #428

Closed tiencapham closed 7 months ago

tiencapham commented 7 months ago

🐛 Bug

I just install as in README.md file and try to 'enjoy' the pretrained model with Atari games. But I got and error as below, it seems sb3-zoo fail to register the environment.

To Reproduce

python enjoy.py --algo a2c --env BreakoutNoFrameskip-v4 --folder rl-trained-agents/ -n 5000

Relevant log output / Error message

rl-baselines3-zoo\enjoy.py", line 4, in <module> enjoy()
rl-baselines3-zoo\rl_zoo3\enjoy.py", line 138, in enjoy
    is_atari = ExperimentManager.is_atari(env_name.gym_id)
rl-baselines3-zoo\rl_zoo3\exp_manager.py", line 533, in is_atari
    return "AtariEnv" in ExperimentManager.entry_point(env_id)
rl-baselines3-zoo\rl_zoo3\exp_manager.py", line 528, in entry_point
    return str(gym.envs.registry[env_id].entry_point)
KeyError: 'BreakoutNoFrameskip-v4'

System Info

Checklist

qgallouedec commented 7 months ago

Hi, make sure to install atari envs.

pip install stable-baselines3[extra]

Answer in the doc: https://stable-baselines3.readthedocs.io/en/master/guide/examples.html#id2

tiencapham commented 7 months ago

Hi, make sure to install atari envs.

pip install stable-baselines3[extra]

Answer in the doc: https://stable-baselines3.readthedocs.io/en/master/guide/examples.html#id2

Hi, Thank for your response.

I actually modified the stable-baseline3 and installed it from source. Maybe that is the reason I missed this step.

How can I install the atari envs in this case?

Best, Tien Pham

qgallouedec commented 7 months ago

The answer is still in the doc, in the exact same paragraph :)

pip install gymnasium[atari, accept-rom-license]

Command out-of-date in the doc, fixed by https://github.com/DLR-RM/stable-baselines3/pull/1773

tiencapham commented 7 months ago

Silly me, but I solved it by:

pip install -e .[docs,tests,extra] in stable baseline.

Thanks for your help