如本教程所述运行PPOTrainer时出现UnboundLocalError
当我仅在rllib教程中运行教程2时,就会发生这种情况。
agent = PPOTrainer(config, 'CartPole-v0')
我得到以下
---------------------------------------------------------------------------
UnboundLocalError Traceback (most recent call last)
<ipython-input-5-1146d5f802a5> in <module>
6 config['num_cpus_per_worker'] = 0 # This avoids running out of resources in the notebook environment when this cell is re-executed
7
----> 8 agent = PPOTrainer(config, 'CartPole-v0')
~/anaconda3/lib/python3.7/site-packages/ray/rllib/agents/trainer.py in __init__(self, config, env, logger_creator)
309 logger_creator = default_logger_creator
310
--> 311 Trainable.__init__(self, config, logger_creator)
312
313 @classmethod
tensorflow/python/framework/fast_tensor_util.pyx in tensorflow.python.framework.fast_tensor_util.AppendBoolArrayToTensorProto()
~/anaconda3/lib/python3.7/site-packages/numpy/lib/type_check.py in asscalar(***failed resolving arguments***)
545 warnings.warn('np.asscalar(a) is deprecated since NumPy v1.16, use '
546 'a.item() instead', DeprecationWarning, stacklevel=1)
--> 547 return a.item()
548
549 #-----------------------------------------------------------------------------
UnboundLocalError: local variable 'a' referenced before assignment