You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/stable_baselines/ppo2/ppo2.py", line 318, in learn
runner = Runner(env=self.env, model=self, n_steps=self.n_steps, gamma=self.gamma, lam=self.lam)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/stable_baselines/ppo2/ppo2.py", line 442, in __init__
super().__init__(env=env, model=model, n_steps=n_steps)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/stable_baselines/common/runners.py", line 19, in __init__
self.obs[:] = env.reset()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/stable_baselines/common/vec_env/vec_check_nan.py", line 46, in reset
self._check_val(async_step=False, observations=observations)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/stable_baselines/common/vec_env/vec_check_nan.py", line 58, in _check_val
has_nan = any(np.isnan(val))
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
And I find that is cause by 2d array like following test:
importnumpyasnp#val = np.array([0, 0, 1, 0]) # it is run okval=np.array([[0, 0, 1, 0], [0, 0, 1, 0]]) # it is run same error as abovehas_nan=any(np.isnan(val))
print(has_nan)
and the stable-baselines at vec_check_nan like this:
def_check_val(self, *, async_step, **kwargs):
# if warn and warn once and have warned once: then stop checkingifnotself.raise_exceptionandself.warn_onceandself._user_warned:
returnfound= []
forname, valinkwargs.items():
has_nan=any(np.isnan(val))
has_inf=self.check_infandany(np.isinf(val))
ifhas_inf:
found.append((name, "inf"))
ifhas_nan:
found.append((name, "nan"))
To fix this problem, I think that need change from 'any' to 'np.any'.
System Info
Describe the characteristic of your environment:
Describe how the library was installed (pip)
GPU models and configuration Mac
Python version 3.6.8
Tensorflow version 1.4.0
The text was updated successfully, but these errors were encountered:
Thanks for reporting the bug.
In fact there was an (incomplete) PR for solving it: #386
We would appreciate if you could complete it ;) (especially writing a test)
when I enable the Nan Check env
the system will have a error like:
And I find that is cause by 2d array like following test:
and the stable-baselines at vec_check_nan like this:
To fix this problem, I think that need change from 'any' to 'np.any'.
System Info
Describe the characteristic of your environment:
The text was updated successfully, but these errors were encountered: