huggingface/deep-rl-class

[HANDS-ON BUG] unit 3: cannot find dqn.yml file

valleyh opened this issue · 7 comments

Describe the bug

I am doing the hands-on of Unit 3. In section "Train our deep Q-learning agent to ply space Invaders", an error appeared when I am running "!python -m rl_zoo3.train --algo dqn --env SpaceInvadersNoFrameskip-v4 -f logs/ -c dqn.yml". It states that

"
Loading hyperparameters from: dqn.yml
Traceback (most recent call last):
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.10/dist-packages/rl_zoo3/train.py", line 274, in
train()
File "/usr/local/lib/python3.10/dist-packages/rl_zoo3/train.py", line 256, in train
results = exp_manager.setup_experiment()
File "/usr/local/lib/python3.10/dist-packages/rl_zoo3/exp_manager.py", line 187, in setup_experiment
hyperparams, saved_hyperparams = self.read_hyperparameters()
File "/usr/local/lib/python3.10/dist-packages/rl_zoo3/exp_manager.py", line 291, in read_hyperparameters
with open(self.config) as f:
FileNotFoundError: [Errno 2] No such file or directory: 'dqn.yml'
"
I found this dqn.yml file in the folder hyperparams/ and also I copied it from hyperparams/ to its upper folder rl_zoo3/, the error is still there.

I am wondering if anyone also met such problem? Can anyone help solve it? Thanks a lot.

I am using Google Colab

Hey there 👋 in this tutorial you need to create your own dqn.yml. "1. Create a hyperparameter config file that will contain our training hyperparameters called dqn.yml."

Train our Deep Q-Learning Agent to Play Space Invaders 👾

To train an agent with RL-Baselines3-Zoo, we just need to do two things:

  1. Create a hyperparameter config file that will contain our training hyperparameters called dqn.yml.

This is a template example:

SpaceInvadersNoFrameskip-v4:
  env_wrapper:
    - stable_baselines3.common.atari_wrappers.AtariWrapper
  frame_stack: 4
  policy: 'CnnPolicy'
  n_timesteps: !!float 1e7
  buffer_size: 100000
  learning_rate: !!float 1e-4
  batch_size: 32
  learning_starts: 100000
  target_update_interval: 1000
  train_freq: 4
  gradient_steps: 1
  exploration_fraction: 0.1
  exploration_final_eps: 0.01
  # If True, you need to deactivate handle_timeout_termination
  # in the replay_buffer_kwargs
  optimize_memory_usage: False

Thanks, I followed the tutorial and created one dqn.yml file and also changed the n_timesteps to 1e6 according to the suggestion. The current problem is: I put this "dqn.yml" file to the folder "/usr/local/lib/python3.10/dist-packages/rl_zoo3/", then the error comes and states it cannot find dqn.yml file. Moreover, I read the code of "exp_manager.py" and find another "dqn.yml" in "/usr/local/lib/python3.10/dist-packages/rl_zoo3/hyperparams/". So I am very confusing even there are two "dqn.yml" files, why it still has the error: FileNotFoundError: [Errno 2] No such file or directory: 'dqn.yml'

You don't need to put it in the package. Put it in the root folder directly.

image

You define the path of your dqn in -c "where the hyperparameter config is after -c."

You don't need to put it in the package. Put it in the root folder directly.

image

Thank you, it works now.

Thanks again, the problem is solved and I will close this stack