google-research / batch_rl

Offline Reinforcement Learning (aka Batch Reinforcement Learning) on Atari 2600 games
https://offline-rl.github.io/
Apache License 2.0
520 stars 73 forks source link

Data Generation KeyError #14

Closed muzerobot closed 3 years ago

muzerobot commented 3 years ago

I am using the following command to try and generate data:

python -um batch_rl.baselines.train \
  --base_dir=/tmp/batch_rl_data \
  --gin_files='batch_rl/baselines/configs/dqn.gin'

However, I am getting the following error:

WARNING:root:Argument blacklist is deprecated. Please use denylist.
WARNING:root:Argument blacklist is deprecated. Please use denylist.
/data/venv_dopamine/lib/python3.8/site-packages/flax/nn/__init__.py:35: DeprecationWarning: The `flax.nn` module is Deprecated, use `flax.linen` instead. Learn more and find an upgrade guide at https://github.com/google/flax/blob/master/flax/linen/README.md
  warnings.warn("The `flax.nn` module is Deprecated, use `flax.linen` instead. Learn more and find an upgrade guide at https://github.com/google/flax/blob/master/flax/linen/README.md", DeprecationWarning)
Traceback (most recent call last):
  File "/home/anaconda3/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/anaconda3/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/data/batch_rl/batch_rl/baselines/train.py", line 83, in <module>
    flags.mark_flag_as_required('base_dir')
  File "/data/venv_dopamine/lib/python3.8/site-packages/absl/flags/_validators.py", line 352, in mark_flag_as_required
    if flag_values[flag_name].default is not None:
  File "/data/venv_dopamine/lib/python3.8/site-packages/absl/flags/_flagvalues.py", line 470, in __getitem__
    return self._flags()[name]
KeyError: 'base_dir'

base_dir doesn't seem to be defined as a flag anywhere, yet it is a required flag. Any ideas what I am doing wrong?

agarwl commented 3 years ago

The base_dir flag needs to be passed and it is inherited from the FLAGS in train.py file in dopamine base training script. The base_dir is the directory where the data would be saved.

muzerobot commented 3 years ago

I see. But I was not able to run the code directly as is (with the command above), and my workaround was simply to define new flags in batch_rl/baselines/train.py essentially in the same way as done in the train.py you referenced -- could this be an installation issue on my side? Or something else that I am missing?

agarwl commented 3 years ago

Yes, this was a bug due to recent changes in dopamine. I updated the train.py file with the updated code. Thanks for spotting this issue.