Skip to content
This repository has been archived by the owner on May 19, 2021. It is now read-only.

DDPG ValueError: name for name_scope must be a string. #2

Open
inarikami opened this issue Jun 13, 2019 · 4 comments
Open

DDPG ValueError: name for name_scope must be a string. #2

inarikami opened this issue Jun 13, 2019 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@inarikami
Copy link
Owner

While running either DDPG agent, I encounter a value error in a Tensorflow 2 ops.py method. The problem appears to be recreated whenever the AdditionalUpdatesOptimizer class is initialized.

Error:

ValueError: name for name_scope must be a string.

The potential error causing class in Keras-rl2 utils.py:

class AdditionalUpdatesOptimizer(optimizers.Optimizer):
    def __init__(self, optimizer, additional_updates):
        super().__init__(optimizer)
        self.optimizer = optimizer
        self.additional_updates = additional_updates

    def get_updates(self, params, loss):
        updates = self.optimizer.get_updates(params=params, loss=loss)
        updates += self.additional_updates
        self.updates = updates
        return self.updates

    def get_config(self):
        return self.optimizer.get_config()

Traceback list:

File "/Users/taylormcnally/.vscode/extensions/ms-python.python-2019.5.18875/pythonFiles/ptvsd_launcher.py", line 43, in <module> main(ptvsdArgs) File "/Users/taylormcnally/.vscode/extensions/ms-python.python-2019.5.18875/pythonFiles/lib/python/ptvsd/__main__.py", line 434, in main run() File "/Users/taylormcnally/.vscode/extensions/ms-python.python-2019.5.18875/pythonFiles/lib/python/ptvsd/__main__.py", line 312, in run_file runpy.run_path(target, run_name='__main__') File "/anaconda3/envs/tf2/lib/python3.6/runpy.py", line 263, in run_path pkg_name=pkg_name, script_name=fname) File "/anaconda3/envs/tf2/lib/python3.6/runpy.py", line 96, in _run_module_code mod_name, mod_spec, pkg_name, script_name) File "/anaconda3/envs/tf2/lib/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) File "/Users/taylormcnally/Documents/GitHub/keras-rl2/examples/ddpg_pendulum.py", line 58, in <module> agent.compile(Adam(lr=.001, clipnorm=1.), metrics=['mae']) File "/Users/taylormcnally/Documents/GitHub/keras-rl2/rl/agents/ddpg.py", line 122, in compile critic_optimizer = AdditionalUpdatesOptimizer(critic_optimizer, critic_updates) File "/Users/taylormcnally/Documents/GitHub/keras-rl2/rl/util.py", line 84, in __init__ super().__init__(optimizer) File "/anaconda3/envs/tf2/lib/python3.6/site-packages/tensorflow/python/keras/optimizer_v2/optimizer_v2.py", line 263, in __init__ with backend.name_scope(self._name) as name_scope: File "/anaconda3/envs/tf2/lib/python3.6/site-packages/tensorflow/python/keras/backend.py", line 739, in name_scope return ops.name_scope_v2(name) File "/anaconda3/envs/tf2/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 6248, in __init__ raise ValueError("name for name_scope must be a string.") ValueError: name for name_scope must be a string.

@inarikami inarikami added the bug Something isn't working label Jun 13, 2019
@inarikami inarikami self-assigned this Jun 13, 2019
@mshlis
Copy link

mshlis commented Sep 11, 2019

Any fix to this yet?

@inarikami
Copy link
Owner Author

inarikami commented Sep 14, 2019

No fix yet, I recommend https://github.com/danaugrs/huskarl for newer algorithms and a cleaner implementation. That repo has a functional ddpg working with Tensorflow 2.

@rxa254
Copy link

rxa254 commented Jul 9, 2020

that link just points back at this project

@inarikami
Copy link
Owner Author

Fixed the link

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants