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

When I run train_copo, I get an error during the run #41

Closed
thedieiscast opened this issue Jun 19, 2023 · 6 comments
Closed

When I run train_copo, I get an error during the run #41

thedieiscast opened this issue Jun 19, 2023 · 6 comments

Comments

@thedieiscast
Copy link

2023-06-19 21:22:48,277 ERROR trial_runner.py:1088 -- Trial CoPOTrainer_MultiAgentIntersectionEnv_0e9dd_00000: Error processing event.
ray.exceptions.RayTaskError(AttributeError): ray::CoPOTrainer.save() (pid=22984, ip=127.0.0.1, repr=CoPOTrainer)
File "python\ray_raylet.pyx", line 830, in ray._raylet.execute_task
File "python\ray_raylet.pyx", line 834, in ray._raylet.execute_task
File "python\ray_raylet.pyx", line 780, in ray._raylet.execute_task.function_executor
File "D:\Anaconda\envs\copo\lib\site-packages\ray_private\function_manager.py", line 674, in actor_method_executor
return method(__ray_actor, *args, **kwargs)
File "D:\Anaconda\envs\copo\lib\site-packages\ray\util\tracing\tracing_helper.py", line 466, in _resume_span
return method(self, *_args, **_kwargs)
File "D:\Anaconda\envs\copo\lib\site-packages\ray\tune\trainable\trainable.py", line 473, in save
checkpoint_dict_or_path = self.save_checkpoint(checkpoint_dir)
File "D:\Anaconda\envs\copo\lib\site-packages\ray\util\tracing\tracing_helper.py", line 466, in _resume_span
return method(self, *_args, **_kwargs)
File "D:\Anaconda\envs\copo\lib\site-packages\ray\rllib\algorithms\algorithm.py", line 1959, in save_checkpoint
state = self.getstate()
File "D:\Anaconda\envs\copo\lib\site-packages\ray\util\tracing\tracing_helper.py", line 466, in _resume_span
return method(self, *_args, **_kwargs)
File "D:\Anaconda\envs\copo\lib\site-packages\ray\rllib\algorithms\algorithm.py", line 2382, in getstate
state["worker"] = self.workers.local_worker().get_state()
File "D:\Anaconda\envs\copo\lib\site-packages\ray\rllib\evaluation\rollout_worker.py", line 1602, in get_state
policy_states[pid] = self.policy_map[pid].get_state()
File "D:\Anaconda\envs\copo\lib\site-packages\ray\rllib\policy\torch_mixins.py", line 98, in get_state
state = super().get_state()
File "D:\Anaconda\envs\copo\lib\site-packages\ray\rllib\policy\torch_policy_v2.py", line 907, in get_state
state = super().get_state()
File "D:\Anaconda\envs\copo\lib\site-packages\ray\rllib\policy\policy.py", line 917, in get_state
state["policy_spec"] = policy_spec.serialize()
File "D:\Anaconda\envs\copo\lib\site-packages\ray\rllib\policy\policy.py", line 133, in serialize
"action_space": space_to_dict(self.action_space),
File "D:\Anaconda\envs\copo\lib\site-packages\ray\rllib\utils\serialization.py", line 140, in space_to_dict
d = {"space": gym_space_to_dict(space)}
File "D:\Anaconda\envs\copo\lib\site-packages\ray\rllib\utils\serialization.py", line 119, in gym_space_to_dict
return _box(space)
File "D:\Anaconda\envs\copo\lib\site-packages\ray\rllib\utils\serialization.py", line 62, in _box
"shape": sp._shape, # shape is a tuple.
AttributeError: 'Box' object has no attribute '_shape'

Why this error occurs and how to correct it

@smallcatd
Copy link

hi @thedieiscast, I have met the same problem. Have you solved it?

@pengzhenghao
Copy link
Member

pengzhenghao commented Aug 3, 2023 via email

@pengzhenghao
Copy link
Member

image

@white-bubbleee
Copy link

hi, I've got the same problem with you. After making sure the gym == 1.19.0 and maetdrive==0.2.5, it still doesn't work. Have you successfully solved this problem?

@white-bubbleee
Copy link

white-bubbleee commented Nov 3, 2023

Hi, it seems that making gym==0.20.0 is effective.I don't the reason(Probably because there is something wrong with the gym library itself, and they fixed this bug in the later version SB3 breaks with gym==0.20.0 ), but it does solve the problem, here is the pip package version list of my conda env:
aiosignal 1.3.1
attrs 23.1.0
certifi 2023.7.22
charset-normalizer 3.3.2
click 8.1.7
click-plugins 1.1.1
cligj 0.7.2
cloudpickle 1.6.0
colorama 0.4.6
contourpy 1.1.1
cycler 0.12.1
distlib 0.3.7
dm-tree 0.1.8
exceptiongroup 1.1.3
Farama-Notifications 0.0.4
filelock 3.13.1
fiona 1.9.5
fonttools 4.43.1
frozenlist 1.4.0
geopandas 0.13.2
grpcio 1.59.2
gym 0.19.0
gym-notices 0.0.8
idna 3.4
imageio 2.31.6
importlib-metadata 6.8.0
importlib-resources 6.1.0
iniconfig 2.0.0
jax-jumpy 1.0.0
jsonschema 4.19.2
jsonschema-specifications 2023.7.1
kiwisolver 1.4.5
lazy_loader 0.3
lxml 4.9.3
lz4 4.3.2
markdown-it-py 3.0.0
matplotlib 3.6.3
mdurl 0.1.2
metadrive-simulator 0.2.5
msgpack 1.0.7
networkx 3.1
numpy 1.19.3
opencv-python 4.8.1.78
opencv-python-headless 4.8.1.78
packaging 23.2
Panda3D 1.10.13
panda3d-gltf 0.13
panda3d-simplepbr 0.10
pandas 1.4.4
Pillow 8.3.2
pip 23.3.1
pkgutil_resolve_name 1.3.10
platformdirs 3.11.0
pluggy 1.3.0
progressbar 2.5
protobuf 4.25.0
psutil 5.9.6
pygame 2.5.2
pyglet 1.5.15
Pygments 2.16.1
pyparsing 3.1.1
pyproj 3.5.0
pytest 7.4.3
python-dateutil 2.8.2
pytz 2023.3.post1
PyWavelets 1.4.1
PyYAML 6.0.1
ray 2.2.0
referencing 0.30.2
requests 2.31.0
rich 13.6.0
rpds-py 0.10.6
scikit-image 0.21.0
scipy 1.10.1
seaborn 0.12.2
setuptools 63.2.0
shapely 2.0.2
six 1.16.0
tabulate 0.9.0
tensorboardX 2.6.2.2
tifffile 2023.7.10
tomli 2.0.1
torch 1.13.1+cu116
torchaudio 0.13.1+cu116
tqdm 4.66.1
typer 0.9.0
typing_extensions 4.8.0
tzdata 2023.3
urllib3 2.0.7
virtualenv 20.24.6
wheel 0.36.0
yapf 0.40.2
zipp 3.17.0

@pengzhenghao
Copy link
Member

Hi I've updated the dependencies requirement. Our code support MetaDrive 0.2.5 instead of the latest version. Here is the result when I ran with MetaDrive-0.2.5:

https://github.com/decisionforce/CoPO/tree/main/benchmarks/MetaDrive-0.2.5

To provide more information to you, this is the environment that I succesfully run code:

Package                  Version    Editable project location
------------------------ ---------- -----------------------------
absl-py                  2.1.0
aiohttp                  3.8.6
aiohttp-cors             0.7.0
aioredis                 2.0.1
aiosignal                1.3.1
annotated-types          0.5.0
anyio                    3.7.1
astunparse               1.6.3
async-timeout            4.0.3
asynctest                0.13.0
atari-py                 0.2.6
attrs                    23.2.0
blessed                  1.20.0
cachetools               5.3.2
certifi                  2022.12.7
charset-normalizer       3.3.2
click                    8.1.7
cloudpickle              1.6.0
colorama                 0.4.6
colorful                 0.5.6
copo                     0.0.0      /home/zhenghao/CoPO/copo_code
cycler                   0.11.0
decorator                5.1.1
distlib                  0.3.8
dm-tree                  0.1.8
exceptiongroup           1.2.0
filelock                 3.12.2
Flask                    2.2.5
fonttools                4.38.0
frozenlist               1.3.3
gast                     0.3.3
google-api-core          2.15.0
google-auth              2.27.0
google-auth-oauthlib     0.4.6
google-pasta             0.2.0
googleapis-common-protos 1.62.0
gpustat                  1.1.1
grpcio                   1.60.0
gym                      0.23.1
gym-notices              0.0.8
h11                      0.14.0
h5py                     2.10.0
idna                     3.6
imageio                  2.31.2
importlib-metadata       6.7.0
importlib-resources      5.12.0
iniconfig                2.0.0
itsdangerous             2.1.2
Jinja2                   3.1.3
jsonschema               4.17.3
Keras-Preprocessing      1.1.2
kiwisolver               1.4.5
kubernetes               29.0.0
lz4                      4.3.2
Markdown                 3.4.4
markdown-it-py           2.2.0
MarkupSafe               2.1.4
matplotlib               3.5.3
mdurl                    0.1.2
metadrive-simulator      0.2.5
msgpack                  1.0.5
multidict                6.0.4
networkx                 2.6.3
numpy                    1.21.6
nvidia-cublas-cu11       11.10.3.66
nvidia-cuda-nvrtc-cu11   11.7.99
nvidia-cuda-runtime-cu11 11.7.99
nvidia-cudnn-cu11        8.5.0.96
nvidia-ml-py             12.535.133
oauthlib                 3.2.2
opencensus               0.11.4
opencensus-context       0.1.3
opt-einsum               3.3.0
packaging                23.2
Panda3D                  1.10.14
panda3d-gltf             0.14
panda3d-simplepbr        0.10
pandas                   1.3.5
Pillow                   9.5.0
pip                      22.3.1
pkgutil_resolve_name     1.3.10
platformdirs             4.0.0
pluggy                   1.2.0
prometheus-client        0.17.1
protobuf                 3.20.3
psutil                   5.9.8
py-spy                   0.3.14
pyasn1                   0.5.1
pyasn1-modules           0.3.0
pydantic                 1.9.0
pydantic_core            2.14.6
pygame                   2.5.2
Pygments                 2.17.2
pyparsing                3.1.1
pyrsistent               0.19.3
pytest                   7.4.4
python-dateutil          2.8.2
pytz                     2023.4
PyWavelets               1.3.0
PyYAML                   6.0.1
ray                      2.2.0
redis                    5.0.1
requests                 2.31.0
requests-oauthlib        1.3.1
rich                     13.7.0
rsa                      4.9
scikit-image             0.19.3
scipy                    1.7.3
seaborn                  0.12.2
setuptools               65.6.3
six                      1.16.0
sniffio                  1.3.0
starlette                0.29.0
tabulate                 0.9.0
tensorboard              2.11.2
tensorboard-data-server  0.6.1
tensorboard-plugin-wit   1.8.1
tensorboardX             2.6.2.2
tensorflow               2.3.1
tensorflow-estimator     2.3.0
tensorflow-probability   0.11.1
termcolor                2.3.0
tifffile                 2021.11.2
tomli                    2.0.1
torch                    1.13.1
tqdm                     4.66.1
typer                    0.9.0
typing_extensions        4.7.1
urllib3                  2.0.7
uvicorn                  0.22.0
virtualenv               20.25.0
wcwidth                  0.2.13
websocket-client         1.6.1
Werkzeug                 2.2.3
wheel                    0.38.4
wrapt                    1.16.0
yapf                     0.30.0
yarl                     1.9.4
zipp                     3.15.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants