RobertTLange / gymnax-blines

Baselines for gymnax 🤖
Apache License 2.0
58 stars 13 forks source link

python3 train.py -config agents/CartPole-v1/es.yaml Error #11

Open xiezhipeng-git opened 1 year ago

xiezhipeng-git commented 1 year ago

run python3 train.py -config agents/CartPole-v1/es.yaml then

发生异常: KeyError 'Gym' File "/home/xzpwsl2/my/work/gymnax/gymnax-blines/utils/es.py", line 16, in train_es train_evaluator = ProblemMapper["Gym"]( File "/home/xzpwsl2/my/work/gymnax/gymnax-blines/train.py", line 24, in main log_steps, log_return, network_ckpt = train_fn( File "/home/xzpwsl2/my/work/gymnax/gymnax-blines/train.py", line 76, in main( KeyError: 'Gym'

I found it only Gymnax.So I change it.But Module.apply() missing 1 required positional argument: 'variables' File "/home/xzpwsl2/my/work/gymnax/gymnax-blines/train.py", line 76, in main( File "/home/xzpwsl2/my/work/gymnax/gymnax-blines/train.py", line 24, in main log_steps, log_return, network_ckpt = train_fn( File "/home/xzpwsl2/my/work/gymnax/gymnax-blines/utils/es.py", line 84, in train_es fitness = train_evaluator.rollout(rng_eval, reshaped_params).mean( jax._src.traceback_util.UnfilteredStackTrace: TypeError: Module.apply() missing 1 required positional argument: 'variables' The stack trace below excludes JAX-internal frames. The preceding is the original exception that occurred, unmodified.

The above exception was the direct cause of the following exception: File "/home/xzpwsl2/my/work/gymnax/gymnax-blines/utils/es.py", line 84, in train_es fitness = train_evaluator.rollout(rng_eval, reshaped_params).mean( File "/home/xzpwsl2/my/work/gymnax/gymnax-blines/train.py", line 24, in main log_steps, log_return, network_ckpt = train_fn( File "/home/xzpwsl2/my/work/gymnax/gymnax-blines/train.py", line 76, in main( TypeError: Module.apply() missing 1 required positional argument: 'variables'

xiezhipeng-git commented 1 year ago

And run ppo can success.but use visualizer the Frame is [] len = 0

MovieWriter ffmpeg unavailable; using Pillow instead. Traceback (most recent call last): File "/home/xzpwsl2/.local/lib/python3.10/site-packages/matplotlib/animation.py", line 233, in saving yield self File "/home/xzpwsl2/.local/lib/python3.10/site-packages/matplotlib/animation.py", line 1090, in save anim._init_draw() # Clear the initial frame File "/home/xzpwsl2/.local/lib/python3.10/site-packages/matplotlib/animation.py", line 1750, in _init_draw self._drawn_artists = self._init_func() File "/home/xzpwsl2/.local/lib/python3.10/site-packages/gymnax/visualize/visualizer.py", line 64, in init assert gym.version == "0.19.0" AssertionError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/home/xzpwsl2/.vscode-server/extensions/ms-python.python-2023.16.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/main.py", line 39, in cli.main() File "/home/xzpwsl2/.vscode-server/extensions/ms-python.python-2023.16.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 430, in main run() File "/home/xzpwsl2/.vscode-server/extensions/ms-python.python-2023.16.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 284, in run_file runpy.run_path(target, run_name="main") File "/home/xzpwsl2/.vscode-server/extensions/ms-python.python-2023.16.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 321, in run_path return _run_module_code(code, init_globals, run_name, File "/home/xzpwsl2/.vscode-server/extensions/ms-python.python-2023.16.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 135, in _run_module_code _run_code(code, mod_globals, init_globals, File "/home/xzpwsl2/.vscode-server/extensions/ms-python.python-2023.16.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 124, in _run_code exec(code, run_globals) File "/home/xzpwsl2/my/work/gymnax/gymnax-blines/visualize.py", line 107, in vis.animate(f"docs/{args.env_name}.gif") File "/home/xzpwsl2/.local/lib/python3.10/site-packages/gymnax/visualize/visualizer.py", line 45, in animate ani.save(save_fname) File "/home/xzpwsl2/.local/lib/python3.10/site-packages/matplotlib/animation.py", line 1085, in save with mpl.rc_context({'savefig.bbox': None}), \ File "/usr/lib/python3.10/contextlib.py", line 153, in exit self.gen.throw(typ, value, traceback) File "/home/xzpwsl2/.local/lib/python3.10/site-packages/matplotlib/animation.py", line 235, in saving self.finish() File "/home/xzpwsl2/.local/lib/python3.10/site-packages/matplotlib/animation.py", line 501, in finish self._frames[0].save( IndexError: list index out of range