entity-neural-network / incubator

Collection of in-progress libraries for entity neural networks.
Apache License 2.0
29 stars 10 forks source link

Better error message when action mask has wrong type #181

Closed cswinter closed 2 years ago

cswinter commented 2 years ago

This is not good error message:

(incubator-BZ1MCGMS-py3.9) ➜  enn_ppo git:(microrts) ✗ python test_microrts.py
[4, 5, 6, 7, 8, 9, 10, 11]
Traceback (most recent call last):
  File "/home/costa/Documents/go/src/github.com/vwxyzjn/incubator/enn_ppo/enn_ppo/test_microrts.py", line 15, in <module>
    meanrew = train.train(cfg)
  File "/home/costa/Documents/go/src/github.com/vwxyzjn/incubator/enn_ppo/enn_ppo/train.py", line 753, in train
    next_obs, next_done, metrics = rollout.run(
  File "/home/costa/Documents/go/src/github.com/vwxyzjn/incubator/enn_ppo/enn_ppo/train.py", line 321, in run
    next_obs = self.envs.reset(self.obs_space)
  File "/home/costa/Documents/go/src/github.com/vwxyzjn/incubator/entity_gym/entity_gym/environment/env_list.py", line 46, in reset
    return self._batch_obs([e.reset_filter(obs_space) for e in self.envs])
  File "/home/costa/Documents/go/src/github.com/vwxyzjn/incubator/entity_gym/entity_gym/environment/env_list.py", line 120, in _batch_obs
    return batch_obs(obs, self.cls.obs_space(), self.cls.action_space())
  File "/home/costa/Documents/go/src/github.com/vwxyzjn/incubator/entity_gym/entity_gym/environment/vec_env.py", line 245, in batch_obs
    vec_action.mask.push(amask)
TypeError: argument 'items': Shape Mismatch:
 from=(dim=2, dtype=Float64), to=(dim=_, dtype=Bool)