lcswillems/rl-starter-files

Bug with fully observable small enviroments

NixGD opened this issue · 2 comments

NixGD commented

The size of the observation space of mini-gridworlds now depends on the size of the environment for fully observational spaces instead of always being (7,7,3). This causes errors for environments which have a dimension of 6 or smaller due to this line:

self.image_embedding_size = ((n-1)//2-2)*((m-1)//2-2)*64
since the embedding size is set to zero. This results in a division by zero error:

  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Users/nix/cirl/scripts/train.py", line 121, in <module>
    acmodel = ACModel(obs_space, envs[0].action_space, args.mem, args.text)
  File "/Users/nix/cirl/model.py", line 63, in __init__
    nn.Linear(self.embedding_size, 64),
  File "/Users/nix/cirl/env/lib/python3.7/site-packages/torch/nn/modules/linear.py", line 56, in __init__
    self.reset_parameters()
  File "/Users/nix/cirl/env/lib/python3.7/site-packages/torch/nn/modules/linear.py", line 59, in reset_parameters
    init.kaiming_uniform_(self.weight, a=math.sqrt(5))
  File "/Users/nix/cirl/env/lib/python3.7/site-packages/torch/nn/init.py", line 291, in kaiming_uniform_
    std = gain / math.sqrt(fan)
ZeroDivisionError: float division by zero

Hi,

  1. Minigrid or miniworld?

  2. Can you give me a precise observation space shape?

  3. Is this error new? I mean: is it caused by some modifications I made recently?

Note: If by "dimension of 6 or smaller", you mean (6, 6, 3) for example, it is normal it doesn't work. You have to change the network architecture.

Hi,
I close your issue because of lack of details. Don't hesitate to open it again with the additional details.