Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DMC env.id error containing multiple "_" separator #221

Closed
belerico opened this issue Feb 27, 2024 · 0 comments · Fixed by #222
Closed

DMC env.id error containing multiple "_" separator #221

belerico opened this issue Feb 27, 2024 · 0 comments · Fixed by #222
Assignees
Labels
bug Something isn't working

Comments

@belerico
Copy link
Member

Running an experiment with a DMC environment like the following:

HYDRA_FULL_ERROR=1MUJOCO_GL=egl python sheeprl.py exp=dreamer_v3_dmc_walker_walk.yaml fabric.accelerator=gpu fabric.precision=bf16-mixed env.id=dmc_cartpole_swingup_sparse env.num_envs=1

raises the following error:

Error executing job with overrides: ['exp=dreamer_v3_dmc_walker_walk.yaml', 'fabric.accelerator=gpu', 'fabric.precision=bf16-mixed', 'env.id=dmc_cartpole_swingup_sparse', 'env.num_envs=1', 'buffer.size=2000000']
Traceback (most recent call last):
  File "/home/belerico/miniconda3/envs/sheeprl-p10/lib/python3.10/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 92, in _call_target
    return _target_(*args, **kwargs)
  File "/home/belerico/projects/sheeprl/sheeprl/envs/dmc.py", line 115, in __init__
    domain_name, task_name = id.split("_")
ValueError: too many values to unpack (expected 2)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/belerico/projects/sheeprl/sheeprl.py", line 4, in <module>
    run()
  File "/home/belerico/miniconda3/envs/sheeprl-p10/lib/python3.10/site-packages/hydra/main.py", line 90, in decorated_main
    _run_hydra(
  File "/home/belerico/miniconda3/envs/sheeprl-p10/lib/python3.10/site-packages/hydra/_internal/utils.py", line 394, in _run_hydra
    _run_app(
  File "/home/belerico/miniconda3/envs/sheeprl-p10/lib/python3.10/site-packages/hydra/_internal/utils.py", line 457, in _run_app
    run_and_report(
  File "/home/belerico/miniconda3/envs/sheeprl-p10/lib/python3.10/site-packages/hydra/_internal/utils.py", line 222, in run_and_report
    raise ex
  File "/home/belerico/miniconda3/envs/sheeprl-p10/lib/python3.10/site-packages/hydra/_internal/utils.py", line 219, in run_and_report
    return func()
  File "/home/belerico/miniconda3/envs/sheeprl-p10/lib/python3.10/site-packages/hydra/_internal/utils.py", line 458, in <lambda>
    lambda: hydra.run(
  File "/home/belerico/miniconda3/envs/sheeprl-p10/lib/python3.10/site-packages/hydra/_internal/hydra.py", line 132, in run
    _ = ret.return_value
  File "/home/belerico/miniconda3/envs/sheeprl-p10/lib/python3.10/site-packages/hydra/core/utils.py", line 260, in return_value
    raise self._return_value
  File "/home/belerico/miniconda3/envs/sheeprl-p10/lib/python3.10/site-packages/hydra/core/utils.py", line 186, in run_job
    ret.return_value = task_function(task_cfg)
  File "/home/belerico/projects/sheeprl/sheeprl/cli.py", line 330, in run
    run_algorithm(cfg)
  File "/home/belerico/projects/sheeprl/sheeprl/cli.py", line 169, in run_algorithm
    fabric.launch(command, cfg, **kwargs)
  File "/home/belerico/miniconda3/envs/sheeprl-p10/lib/python3.10/site-packages/lightning/fabric/fabric.py", line 839, in launch
    return self._wrap_and_launch(function, self, *args, **kwargs)
  File "/home/belerico/miniconda3/envs/sheeprl-p10/lib/python3.10/site-packages/lightning/fabric/fabric.py", line 925, in _wrap_and_launch
    return to_run(*args, **kwargs)
  File "/home/belerico/miniconda3/envs/sheeprl-p10/lib/python3.10/site-packages/lightning/fabric/fabric.py", line 930, in _wrap_with_setup
    return to_run(*args, **kwargs)
  File "/home/belerico/projects/sheeprl/sheeprl/algos/dreamer_v3/dreamer_v3.py", line 389, in main
    envs = vectorized_env(
  File "/home/belerico/miniconda3/envs/sheeprl-p10/lib/python3.10/site-packages/gymnasium/vector/sync_vector_env.py", line 53, in __init__
    self.envs = [env_fn() for env_fn in env_fns]
  File "/home/belerico/miniconda3/envs/sheeprl-p10/lib/python3.10/site-packages/gymnasium/vector/sync_vector_env.py", line 53, in <listcomp>
    self.envs = [env_fn() for env_fn in env_fns]
  File "/home/belerico/projects/sheeprl/sheeprl/envs/wrappers.py", line 83, in __init__
    super().__init__(self._env_fn())
  File "/home/belerico/projects/sheeprl/sheeprl/utils/env.py", line 72, in thunk
    env = hydra.utils.instantiate(cfg.env.wrapper, **instantiate_kwargs, _convert_="all")
  File "/home/belerico/miniconda3/envs/sheeprl-p10/lib/python3.10/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 226, in instantiate
    return instantiate_node(
  File "/home/belerico/miniconda3/envs/sheeprl-p10/lib/python3.10/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 347, in instantiate_node
    return _call_target(_target_, partial, args, kwargs, full_key)
  File "/home/belerico/miniconda3/envs/sheeprl-p10/lib/python3.10/site-packages/hydra/_internal/instantiate/_instantiate2.py", line 97, in _call_target
    raise InstantiationException(msg) from e
hydra.errors.InstantiationException: Error in call to target 'sheeprl.envs.dmc.DMCWrapper':
ValueError('too many values to unpack (expected 2)')

Since domain and task could contain multiple "_" separator we need to find another way to specify the DMC env.id.

cc @michele-milesi

@belerico belerico added the bug Something isn't working label Feb 27, 2024
@michele-milesi michele-milesi self-assigned this Feb 28, 2024
@michele-milesi michele-milesi linked a pull request Feb 28, 2024 that will close this issue
4 tasks
@michele-milesi michele-milesi mentioned this issue Feb 28, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants