Skip to content

DACbench example from README does not run (JOSS blocking) #123

Description

@janikmu

Hi maintainers,

similarly to #122, while reviewing for JOSS (openjournals/joss-reviews#10439), I realized that the DACbench example (https://github.com/automl/Mighty/tree/joss_paper#learning-a-configuration-policy-via-dac) does not run as well.
Installed dacbench v0.4.0 from PyPI.

Full trace:

(Mighty) janik@Mac Mighty % python mighty/run_mighty.py 'algorithm=ppo' 'environment=dacbench/function_approximation'
/Users/janik/source/Mighty/.venv/lib/python3.11/site-packages/torch/cuda/__init__.py:63: FutureWarning: The pynvml package is deprecated. Please install nvidia-ml-py instead. If you did not install pynvml directly, please report this to the maintainers of the package that installed pynvml for you.
  import pynvml  # type: ignore[import]
Gym has been unmaintained since 2022 and does not support NumPy 2.0 amongst other critical functionality.
Please upgrade to Gymnasium, the maintained drop-in replacement of Gym, or contact the authors of your software and request that they upgrade.
See the migration guide at https://gymnasium.farama.org/introduction/migration_guide/ for additional information.
Using default wandb logging. If you prefer trackio, please install it with `pip install trackio`.
Error executing job with overrides: ['algorithm=ppo', 'environment=dacbench/function_approximation']
Traceback (most recent call last):
  File "/Users/janik/source/Mighty/mighty/run_mighty.py", line 30, in <module>
    run_mighty()
  File "/Users/janik/source/Mighty/.venv/lib/python3.11/site-packages/hydra/main.py", line 94, in decorated_main
    _run_hydra(
  File "/Users/janik/source/Mighty/.venv/lib/python3.11/site-packages/hydra/_internal/utils.py", line 394, in _run_hydra
    _run_app(
  File "/Users/janik/source/Mighty/.venv/lib/python3.11/site-packages/hydra/_internal/utils.py", line 457, in _run_app
    run_and_report(
  File "/Users/janik/source/Mighty/.venv/lib/python3.11/site-packages/hydra/_internal/utils.py", line 223, in run_and_report
    raise ex
  File "/Users/janik/source/Mighty/.venv/lib/python3.11/site-packages/hydra/_internal/utils.py", line 220, in run_and_report
    return func()
           ^^^^^^
  File "/Users/janik/source/Mighty/.venv/lib/python3.11/site-packages/hydra/_internal/utils.py", line 458, in <lambda>
    lambda: hydra.run(
            ^^^^^^^^^^
  File "/Users/janik/source/Mighty/.venv/lib/python3.11/site-packages/hydra/_internal/hydra.py", line 132, in run
    _ = ret.return_value
        ^^^^^^^^^^^^^^^^
  File "/Users/janik/source/Mighty/.venv/lib/python3.11/site-packages/hydra/core/utils.py", line 260, in return_value
    raise self._return_value
  File "/Users/janik/source/Mighty/.venv/lib/python3.11/site-packages/hydra/core/utils.py", line 186, in run_job
    ret.return_value = task_function(task_cfg)
                       ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/janik/source/Mighty/mighty/run_mighty.py", line 14, in run_mighty
    runner = runner_cls(cfg)
             ^^^^^^^^^^^^^^^
  File "/Users/janik/source/Mighty/mighty/mighty_runners/mighty_runner.py", line 63, in __init__
    self.agent = agent_class(  # type: ignore
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/janik/source/Mighty/mighty/mighty_agents/ppo.py", line 126, in __init__
    super().__init__(
  File "/Users/janik/source/Mighty/mighty/mighty_agents/base_agent.py", line 299, in __init__
    json.dump(self.env.instance_set, f)
  File "/Users/janik/.local/share/uv/python/cpython-3.11.15-macos-aarch64-none/lib/python3.11/json/__init__.py", line 179, in dump
    for chunk in iterable:
  File "/Users/janik/.local/share/uv/python/cpython-3.11.15-macos-aarch64-none/lib/python3.11/json/encoder.py", line 430, in _iterencode
    yield from _iterencode_list(o, _current_indent_level)
  File "/Users/janik/.local/share/uv/python/cpython-3.11.15-macos-aarch64-none/lib/python3.11/json/encoder.py", line 326, in _iterencode_list
    yield from chunks
  File "/Users/janik/.local/share/uv/python/cpython-3.11.15-macos-aarch64-none/lib/python3.11/json/encoder.py", line 406, in _iterencode_dict
    yield from chunks
  File "/Users/janik/.local/share/uv/python/cpython-3.11.15-macos-aarch64-none/lib/python3.11/json/encoder.py", line 439, in _iterencode
    o = _default(o)
        ^^^^^^^^^^^
  File "/Users/janik/.local/share/uv/python/cpython-3.11.15-macos-aarch64-none/lib/python3.11/json/encoder.py", line 180, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type FunctionApproximationInstance is not JSON serializable
Exception ignored in: <function MightyAgent.__del__ at 0x128d89800>
Traceback (most recent call last):
  File "/Users/janik/source/Mighty/mighty/mighty_agents/base_agent.py", line 442, in __del__
  File "/Users/janik/source/Mighty/mighty/mighty_utils/wrappers.py", line 240, in close
  File "/Users/janik/source/Mighty/.venv/lib/python3.11/site-packages/dacbench/envs/function_approximation.py", line 107, in close
AttributeError: 'FunctionApproximationEnv' object has no attribute 'instance_set'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions