About registry error
niuliyuan opened this issue · 1 comments
niuliyuan commented
When I run the main_train.py with my pc in the local mode, an error occurred as shown below:
2019-11-25 20:16:56,521 INFO resource_spec.py:205 -- Starting Ray with 5.42 GiB memory available for workers and up to 2.73 GiB for objects. You can adjust these settings with ray.init(memory=<bytes>, object_store_memory=<bytes>).
Traceback (most recent call last):
File "/home/meta/anaconda3/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2862, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-2-230f46c907de>", line 1, in <module>
runfile('/home/meta/code/asd/tesp2/main_train.py', wdir='/home/meta/code/asd/tesp2')
File "/opt/pycharm-2019.2.4/helpers/pydev/_pydev_bundle/pydev_umd.py", line 197, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "/opt/pycharm-2019.2.4/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/home/meta/code/asd/tesp2/main_train.py", line 75, in <module>
register_trainable(agent_cls._agent_name, agent_cls)
File "/home/meta/code/asd/ray1/tune/registry.py", line 37, in register_trainable
raise TypeError("Second argument must be convertable to Trainable",trainable)
TypeError: ('Second argument must be convertable to Trainable', <class 'tesp2.tesp3.tesp.TESPAgent'>)
And the relevant code is as follows:
def register_trainable(name, trainable):
"""Register a trainable function or class.
Args:
name (str): Name to register.
trainable (obj): Function or tune.Trainable class. Functions must
take (config, status_reporter) as arguments and will be
automatically converted into a class during registration.
"""
from ray1.tune.trainable import Trainable, wrap_function
if isinstance(trainable, FunctionType):
trainable = wrap_function(trainable)
if not issubclass(trainable, Trainable):
**raise TypeError("Second argument must be convertable to Trainable",trainable)**
_global_registry.register(TRAINABLE_CLASS, name, trainable)
It seems type error. For the first time, I tried to recreate the project of reinforcement learning, so I didn't quite understand it, Do you have any idea?
niuliyuan commented
Sorry, it's because I didn't run it in a correct way....