google-research / ibc

Official implementation of Implicit Behavioral Cloning, as described in our CoRL 2021 paper, see more at https://implicitbc.github.io/
Apache License 2.0
313 stars 33 forks source link

Error running particle experiments #14

Open AllanYangZhou opened 2 years ago

AllanYangZhou commented 2 years ago

Hi, thanks for open sourcing this work! I tried running:

./ibc/ibc/configs/particle/run_mlp_ebm_langevin_best.sh 2

And got this error

  File "ibc/ibc/train_eval.py", line 397, in main                                                                        [122/528]
    strategy=strategy)                                                                                                              File "/iris/u/ayz/anaconda3/envs/ibc/lib/python3.7/site-packages/gin/config.py", line 1069, in gin_wrapper                          utils.augment_exception_message_and_reraise(e, err_str)                                                                         File "/iris/u/ayz/anaconda3/envs/ibc/lib/python3.7/site-packages/gin/utils.py", line 41, in augment_exception_message_and_rerais
e                                                                                                                                 
    raise proxy.with_traceback(exception.__traceback__) from None                                                                 
  File "/iris/u/ayz/anaconda3/envs/ibc/lib/python3.7/site-packages/gin/config.py", line 1046, in gin_wrapper                          return fn(*new_args, **new_kwargs)                                                                                            
  File "ibc/ibc/train_eval.py", line 279, in train_eval                                                                           
    name_scope_suffix=f'_{env_name}')                                                                                             
  File "ibc/ibc/train_eval.py", line 353, in evaluation_step                                                                          eval_actor.run()                                                                                                              
  File "/iris/u/ayz/anaconda3/envs/ibc/lib/python3.7/site-packages/tf_agents/train/actor.py", line 149, in run                    
    self._time_step, self._policy_state)                                                                                          
  File "/iris/u/ayz/anaconda3/envs/ibc/lib/python3.7/site-packages/tf_agents/drivers/py_driver.py", line 112, in run                  next_time_step = self.env.step(action_step.action)                                                                            
  File "/iris/u/ayz/anaconda3/envs/ibc/lib/python3.7/site-packages/tf_agents/environments/py_environment.py", line 233, in step   
    self._current_time_step = self._step(action)                                                                                  
  File "/iris/u/ayz/anaconda3/envs/ibc/lib/python3.7/site-packages/tf_agents/environments/wrappers.py", line 1015, in _step           time_step = self._env.step(action)                                                                                            
  File "/iris/u/ayz/anaconda3/envs/ibc/lib/python3.7/site-packages/tf_agents/environments/py_environment.py", line 233, in step   
    self._current_time_step = self._step(action)                                                                                  
  File "/iris/u/ayz/anaconda3/envs/ibc/lib/python3.7/site-packages/tf_agents/environments/gym_wrapper.py", line 215, in _step     
    observation, reward, self._done, self._info = self._gym_env.step(action)                                                      
  File "/iris/u/ayz/anaconda3/envs/ibc/lib/python3.7/site-packages/gym/wrappers/order_enforcing.py", line 37, in step             
    return self.env.step(action)                                                                                                  
  File "/iris/u/ayz/anaconda3/envs/ibc/lib/python3.7/site-packages/gym/wrappers/env_checker.py", line 39, in step                 
    return passive_env_step_check(self.env, action)                                                                               
  File "/iris/u/ayz/anaconda3/envs/ibc/lib/python3.7/site-packages/gym/utils/passive_env_checker.py", line 273, in passive_env_st$
p_check                                                                                                                           
    if np.any(np.isnan(obs)):                                                                                                     
TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types acc$
rding to the casting rule ''safe''

I'm not super familiar with tf-agents, but from some debugging it looks like obs is a dictionary type and np.isnan is having issue with it. Any thought on how one could fix this?

Thanks, Allan

peteflorence commented 2 years ago

Hi Allan, can you verify all your package versions match these exactly? https://github.com/google-research/ibc#prerequisites

AllanYangZhou commented 2 years ago

Hi Pete, thanks for the patience (just got back from various confs/travels). I verified the version numbers linked. Here's my entire pip list. Maybe a version update in some other package not listed in that link broke things?

EDIT: given the error, maybe the problem package is numpy itself. What version of numpy is working for you?

Package                 Version
----------------------- ---------
absl-py                 0.12.0
astunparse              1.6.3
backcall                0.2.0
cached-property         1.5.2
cachetools              5.2.0
certifi                 2022.6.15
charset-normalizer      2.0.12
clang                   5.0
cloudpickle             2.1.0
cycler                  0.11.0
decorator               5.1.1
dm-tree                 0.1.7
flatbuffers             1.12
gast                    0.4.0
gin-config              0.4.0
google-auth             2.8.0
google-auth-oauthlib    0.4.6
google-pasta            0.2.0
grpcio                  1.47.0
gym                     0.24.1
gym-notices             0.0.7
h5py                    3.1.0
idna                    3.3
importlib-metadata      4.12.0
ipython                 7.34.0
jedi                    0.18.1
keras                   2.6.0
Keras-Preprocessing     1.1.2
kiwisolver              1.4.3
Markdown                3.3.7
matplotlib              3.4.3
matplotlib-inline       0.1.3
mediapy                 1.0.3
numpy                   1.19.5
oauthlib                3.2.0
opencv-python           4.5.3.56
opt-einsum              3.3.0
parso                   0.8.3
pexpect                 4.8.0
pickleshare             0.7.5
Pillow                  9.1.1
pip                     22.1.2
prompt-toolkit          3.0.29
protobuf                3.19.4
ptyprocess              0.7.0
pyasn1                  0.4.8
pyasn1-modules          0.2.8
pybullet                3.1.6
Pygments                2.12.0
pyparsing               3.0.9
python-dateutil         2.8.2
requests                2.28.0
requests-oauthlib       1.3.1
rsa                     4.8
scipy                   1.7.1
setuptools              62.6.0
six                     1.15.0
tensorboard             2.9.1
tensorboard-data-server 0.6.1
tensorboard-plugin-wit  1.8.1
tensorflow              2.6.0
tensorflow-estimator    2.9.0
tensorflow-probability  0.14.1
termcolor               1.1.0
tf-agents               0.11.0rc0
tqdm                    4.62.2
traitlets               5.3.0
typing-extensions       3.7.4.3
urllib3                 1.26.9
wcwidth                 0.2.5
Werkzeug                2.1.2
wheel                   0.37.1
wrapt                   1.12.1
zipp                    3.8.0