exalearn / EXARL

Scalable Framework for Reinforcement Learning
Other
10 stars 5 forks source link

TD3 does not work ('ExaGlobal' is not defined) #246

Open aik7 opened 1 year ago

aik7 commented 1 year ago

In the ddpg_debug branch, I ran the following command.

python exarl/driver/ --env Pendulum-v0 --n_episodes 50 --n_steps 200 --learner_procs 1 --workflow sync --agent TD3-v1 --model_type AC  

However, I got the following error. The TD3 code need to be updated.

Traceback (most recent call last):
  File "/home/kagawa/anaconda3/envs/exarl/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/kagawa/anaconda3/envs/exarl/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "exarl/driver/__main__.py", line 29, in <module>
    exa_learner = exarl.ExaLearner()
  File "/home/kagawa/Projects/EXARL/exarl/base/learner_base.py", line 46, in __init__
    self.agent, self.env, self.workflow = self.make(agent_id, env_id, workflow_id)
  File "/home/kagawa/Projects/EXARL/exarl/base/learner_base.py", line 95, in make
    agent = exarl.agents.make(agent_id, env=env, is_learner=ExaComm.is_learner())
  File "/home/kagawa/Projects/EXARL/exarl/agents/registration.py", line 98, in make
    return registry.make(id, **kwargs)
  File "/home/kagawa/Projects/EXARL/exarl/agents/registration.py", line 58, in make
    agent = spec.make(**kwargs)
  File "/home/kagawa/Projects/EXARL/exarl/agents/registration.py", line 42, in make
    cls = load(self.entry_point)
  File "/home/kagawa/Projects/EXARL/exarl/agents/registration.py", line 20, in load
    mod = importlib.import_module(mod_name)
  File "/home/kagawa/anaconda3/envs/exarl/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/kagawa/Projects/EXARL/exarl/agents/agent_vault/__init__.py", line 16, in <module>
    from exarl.agents.agent_vault.keras_td3 import KerasTD3
  File "/home/kagawa/Projects/EXARL/exarl/agents/agent_vault/keras_td3.py", line 36, in <module>
    logger = ExaGlobal.setup_logger(__name__)
NameError: name  'ExaGlobal' is not defined
aik7 commented 1 year ago

I fixed the above error by replacing ExaGlobal by ExaGlobals, but I got another error as shown below. @Jodasue, how should I fix this error?

Traceback (most recent call last):                                                                                                                                                                            
  File "/home/kagawa/anaconda3/envs/exarl/lib/python3.7/runpy.py", line 193, in _run_module_as_main                                                                                                           
    "__main__", mod_spec)                                                                                                                                                                                     
  File "/home/kagawa/anaconda3/envs/exarl/lib/python3.7/runpy.py", line 85, in _run_code                                                                                                                      
    exec(code, run_globals)                                                                                                                                                                                   
  File "exarl/driver/__main__.py", line 29, in <module>                                                                                                                                                       
    exa_learner = exarl.ExaLearner()                                                                                                                                                                          
  File "/home/kagawa/Projects/EXARL/exarl/base/learner_base.py", line 46, in __init__                                                                                                                         
    self.agent, self.env, self.workflow = self.make(agent_id, env_id, workflow_id)                                                                                                                            
  File "/home/kagawa/Projects/EXARL/exarl/base/learner_base.py", line 95, in make                                                                                                                             
    agent = exarl.agents.make(agent_id, env=env, is_learner=ExaComm.is_learner())                                                                                                                             
  File "/home/kagawa/Projects/EXARL/exarl/agents/registration.py", line 98, in make                                                                                                                           
    return registry.make(id, **kwargs)                                                                                                                                                                        
  File "/home/kagawa/Projects/EXARL/exarl/agents/registration.py", line 58, in make                                                                                                                           
    agent = spec.make(**kwargs)                                                                                                                                                                               
  File "/home/kagawa/Projects/EXARL/exarl/agents/registration.py", line 43, in make                                                                                                                           
    agent = cls(**_kwargs)                                                                                                                                                                                    
TypeError: Can't instantiate abstract class KerasTD3 with abstract methods set_priorities