PKU-Alignment / omnisafe

JMLR: OmniSafe is an infrastructural framework for accelerating SafeRL research.
https://www.omnisafe.ai
Apache License 2.0
931 stars 132 forks source link

[Question] How to get the result of the example? #331

Closed wayne-weiwei closed 5 months ago

wayne-weiwei commented 6 months ago

Required prerequisites

Questions

After I trained the ppo-lag model using the python train_policy.py --algo PPOLag --env-id SafetyPointGoal1-v0 --parallel 1 --total-steps 10000000 --device cpu --vector-env-nums 1 --torch-threads 1, I can not gain the result when using omnisafe eval runs/PPOLag-\{SafetyPointGoal1-v0\} and meet the following problem. image

Gaiejj commented 6 months ago

A similar issue is in #329. We are reproducing this issue and fix this problem. Can you provide more information about your running environment? e.g.

Are you running on a headless server? Are you running in Linux? Are you using docker? Are you building from source or pypi?

We sincerely hope to resolve your issue. We hope you can provide more detailed information so that we can better pinpoint the problem.

wayne-weiwei commented 5 months ago

Thank you so much for your reply and help. I installed OmniSafe from source, and ran it in the Linux system on the dedicated server following the guidance in the guithub. And this is my running environment: _libgcc_mutex 0.1 _openmp_mutex 4.5 abseil-cpp 20230802.0 absl-py 2.1.0 aiohttp 3.9.3 aiosignal 1.2.0 alabaster 0.7.16 anyio 3.5.0 aoo-mozilla-en-dict-au 2024.03.01 aoo-mozilla-en-dict-ca 2024.03.01 aoo-mozilla-en-dict-gb 2024.03.01 aoo-mozilla-en-dict-us 2024.03.01 aoo-mozilla-en-dict-za 2024.03.01 appdirs 1.4.4 asttokens 2.0.5 async-timeout 4.0.3 attrs 23.1.0 babel 2.11.0 beautifulsoup4 4.12.3 blas 1.0 blinker 1.6.2 bottleneck 1.3.7 brotli 1.0.9 brotli-bin 1.0.9 brotli-python 1.0.9 bzip2 1.0.8 c-ares 1.19.1 ca-certificates 2024.3.11 cachetools 5.3.3 certifi 2024.2.2 cffi 1.16.0 charset-normalizer 2.0.4 click 8.1.7 colorama 0.4.6 comm 0.2.1 commonmark 0.9.1 contourpy 1.2.0 cryptography 42.0.5 cuda-cccl 11.7.91 cuda-command-line-tools 11.7.1 cuda-compiler 11.7.1 cuda-cudart 11.7.99 cuda-cudart-dev 11.7.99 cuda-cuobjdump 11.7.91 cuda-cupti 11.7.101 cuda-cuxxfilt 11.7.91 cuda-documentation 11.7.91 cuda-driver-dev 11.7.99 cuda-gdb 11.7.91 cuda-libraries 11.7.1 cuda-libraries-dev 11.7.1 cuda-memcheck 11.7.91 cuda-nsight 11.7.91 cuda-nsight-compute 11.7.1 cuda-nvcc 11.7.99 cuda-nvdisasm 11.7.91 cuda-nvml-dev 11.7.91 cuda-nvprof 11.7.101 cuda-nvprune 11.7.91 cuda-nvrtc 11.7.99 cuda-nvrtc-dev 11.7.99 cuda-nvtx 11.7.91 cuda-nvvp 11.7.101 cuda-runtime 11.7.1 cuda-sanitizer-api 11.7.91 cuda-toolkit 11.7.1 cuda-tools 11.7.1 cuda-visual-tools 11.7.1 cycler 0.11.0 dataclasses 0.8 debugpy 1.6.7 decorator 5.1.1 docker-pycreds 0.4.0 docutils 0.21.2 enchant 2.5.0 exceptiongroup 1.2.0 executing 0.8.3 ffmpeg 4.3 filelock 3.13.1 fonttools 4.51.0 freetype 2.12.1 frozenlist 1.4.0 future 0.18.3 gdown 5.1.0 gds-tools 1.3.1.18 gettext 0.22.5 gettext-tools 0.22.5 gitdb 4.0.7 gitpython 3.1.37 glfw 2.7.0 glib 2.78.4 glib-tools 2.78.4 gmp 6.2.1 gmpy2 2.1.2 gnutls 3.6.15 google-auth 2.22.0 google-auth-oauthlib 0.5.2 greenlet 3.0.1 grpc-cpp 1.48.2 grpcio 1.48.2 gtest 1.14.0 gymnasium 0.28.1 gymnasium-robotics 1.2.2 h11 0.14.0 hunspell 1.7.2 hunspell-en 2024.03.01 idna 3.4 imageio 2.33.1 imageio-ffmpeg 0.4.9 imagesize 1.4.1 importlib-metadata 7.0.1 importlib_metadata 7.0.1 intel-openmp 2023.1.0 ipykernel 6.28.0 ipython 8.20.0 jax-jumpy 1.0.0 jedi 0.18.1 jinja2 3.1.3 jpeg 9e jsonschema 4.19.2 jsonschema-specifications 2023.7.1 jupyter-cache 1.0.0 jupyter_client 8.6.0 jupyter_core 5.5.0 kiwisolver 1.4.4 lame 3.100 latexcodec 2.0.1 lcms2 2.12 ld_impl_linux-64 2.38 lerc 3.0 libasprintf 0.22.5 libasprintf-devel 0.22.5 libbrotlicommon 1.0.9 libbrotlidec 1.0.9 libbrotlienc 1.0.9 libcublas 11.10.3.66 libcublas-dev 11.10.3.66 libcufft 10.7.2.91 libcufft-dev 10.7.2.91 libcufile 1.3.1.18 libcufile-dev 1.3.1.18 libcurand 10.2.10.91 libcurand-dev 10.2.10.91 libcusolver 11.4.0.1 libcusolver-dev 11.4.0.1 libcusparse 11.7.4.91 libcusparse-dev 11.7.4.91 libdeflate 1.17 libffi 3.4.4 libgcc-ng 13.2.0 libgettextpo 0.22.5 libgettextpo-devel 0.22.5 libglib 2.78.4 libgomp 13.2.0 libiconv 1.16 libidn2 2.3.4 libnpp 11.7.4.75 libnpp-dev 11.7.4.75 libnvjpeg 11.8.0.2 libnvjpeg-dev 11.8.0.2 libpng 1.6.39 libprotobuf 3.20.3 libsodium 1.0.18 libstdcxx-ng 13.2.0 libtasn1 4.19.0 libtiff 4.5.1 libunistring 0.9.10 libuuid 1.41.5 libwebp-base 1.3.2 lightning-utilities 0.11.2 livereload 2.6.3 lz4-c 1.9.4 markdown 3.4.1 markdown-it-py 3.0.0 markupsafe 2.1.3 matplotlib-base 3.8.4 matplotlib-inline 0.1.6 mdit-py-plugins 0.4.0 mdurl 0.1.0 mkl 2023.1.0 mkl-service 2.4.0 mkl_fft 1.3.8 mkl_random 1.2.4 moviepy 1.0.3 mpc 1.1.0 mpfr 4.0.2 mpmath 1.3.0 mujoco 2.3.3 multidict 6.0.4 myst-nb 1.1.0 myst-parser 3.0.0 nbclient 0.8.0 nbformat 5.9.2 ncurses 6.4 nest-asyncio 1.6.0 nettle 3.7.3 networkx 3.1 nsight-compute 2022.2.1.3 numexpr 2.8.7 numpy 1.23.5 numpy-base 1.26.4 oauthlib 3.2.2 omnisafe 0.5.1.dev27+g080e6b8 openh264 2.1.1 openjpeg 2.4.0 openssl 3.0.13 packaging 23.2 pandas 2.0.3 pandoc 2.12 parso 0.8.3 pathtools 0.1.2 pcre2 10.42 pettingzoo 1.24.3 pexpect 4.8.0 pillow 10.2.0 pip 23.3.1 platformdirs 3.10.0 pretty-errors 1.2.25 proglog 0.1.9 prompt-toolkit 3.0.43 prompt_toolkit 3.0.43 protobuf 3.20.3 psutil 5.9.0 ptyprocess 0.7.0 pure_eval 0.2.2 pyasn1 0.4.8 pyasn1-modules 0.2.8 pybtex 0.24.0 pybtex-docutils 1.0.3 pycparser 2.21 pyenchant 3.2.2 pygame 2.1.0 pygments 2.15.1 pyjwt 2.4.0 pyopengl 3.1.7 pyopenssl 24.0.0 pyparsing 3.0.9 pysocks 1.7.1 python 3.10.14 python-dateutil 2.8.2 python-fastjsonschema 2.16.2 python-tzdata 2023.3 python_abi 3.10 pytorch 2.0.1 pytorch-cuda 11.7 pytorch-lightning 2.2.4 pytorch-mutex 1.0 pytz 2024.1 pyyaml 6.0.1 pyzmq 25.1.2 re2 2022.04.01 readline 8.2 referencing 0.30.2 requests 2.31.0 requests-oauthlib 1.3.0 rich 12.5.1 rpds-py 0.10.6 rsa 4.7.2 safety-gymnasium 1.0.0 seaborn 0.12.2 sentry-sdk 1.9.0 setproctitle 1.2.2 setuptools 68.2.2 shellingham 1.5.0 six 1.16.0 smmap 4.0.0 sniffio 1.3.0 snowballstemmer 2.2.0 soupsieve 2.5 sphinx 7.3.7 sphinx-autobuild 2024.4.16 sphinx-autodoc-typehints 2.1.0 sphinx-copybutton 0.5.2 sphinxcontrib-applehelp 1.0.2 sphinxcontrib-bibtex 2.6.2 sphinxcontrib-devhelp 1.0.2 sphinxcontrib-htmlhelp 2.0.0 sphinxcontrib-jsmath 1.0.1 sphinxcontrib-qthelp 1.0.3 sphinxcontrib-serializinghtml 1.1.10 sphinxcontrib-spelling 4.3.0 sqlalchemy 2.0.25 sqlite 3.41.2 stack_data 0.2.0 starlette 0.37.2 sympy 1.12 tabulate 0.9.0 tbb 2021.8.0 tensorboard 2.12.1 tensorboard-data-server 0.7.0 tensorboard-plugin-wit 1.8.1 tk 8.6.12 tomli 2.0.1 torchmetrics 1.4.0 torchtriton 2.0.0 torchvision 0.15.2 tornado 6.3.3 tqdm 4.65.0 traitlets 5.7.1 typer 0.9.0 typing-extensions 4.9.0 typing_extensions 4.9.0 tzdata 2024a unicodedata2 15.1.0 urllib3 1.26.18 uvicorn 0.29.0 wandb 0.16.5 watchfiles 0.21.0 wcwidth 0.2.5 websockets 12.0 werkzeug 2.3.8 wheel 0.41.2 xmltodict 0.13.0 xz 5.4.6 yaml 0.2.5 yarl 1.9.3 zeromq 4.3.5 zipp 3.17.0 zlib 1.2.13 zstd 1.5.5

Gaiejj commented 5 months ago

I attempted to replicate your issue on a Linux headless server but was unsuccessful. After executing export MUJOCO_GL=osmesa, I successfully obtained the following results. I have also carefully compared the differences between our environments and suspect the issue may lie with the version of ffmpeg. By running ffmpeg -version, I discovered that my version is 4.2.7. I will display my complete Python environment information and provide a related issue for reference.

python environment absl-py 2.1.0 aiohttp 3.9.5 aiosignal 1.3.1 async-timeout 4.0.3 attrs 23.2.0 beautifulsoup4 4.12.3 certifi 2024.2.2 charset-normalizer 3.3.2 click 8.1.7 cloudpickle 3.0.0 colorama 0.4.6 contourpy 1.2.1 cycler 0.12.1 decorator 4.4.2 docker-pycreds 0.4.0 Farama-Notifications 0.0.4 filelock 3.14.0 fonttools 4.51.0 frozenlist 1.4.1 fsspec 2024.3.1 gdown 5.1.0 gitdb 4.0.11 GitPython 3.1.43 glfw 2.7.0 grpcio 1.63.0 gymnasium 0.28.1 gymnasium-robotics 1.2.2 idna 3.7 imageio 2.34.1 imageio-ffmpeg 0.4.9 jax-jumpy 1.0.0 Jinja2 3.1.4 kiwisolver 1.4.5 lightning-utilities 0.11.2 Markdown 3.6 markdown-it-py 3.0.0 MarkupSafe 2.1.5 matplotlib 3.8.4 mdurl 0.1.2 moviepy 1.0.3 mpmath 1.3.0 mujoco 2.3.3 multidict 6.0.5 networkx 3.3 numpy 1.23.5 nvidia-cublas-cu12 12.1.3.1 nvidia-cuda-cupti-cu12 12.1.105 nvidia-cuda-nvrtc-cu12 12.1.105 nvidia-cuda-runtime-cu12 12.1.105 nvidia-cudnn-cu12 8.9.2.26 nvidia-cufft-cu12 11.0.2.54 nvidia-curand-cu12 10.3.2.106 nvidia-cusolver-cu12 11.4.5.107 nvidia-cusparse-cu12 12.1.0.106 nvidia-nccl-cu12 2.20.5 nvidia-nvjitlink-cu12 12.4.127 nvidia-nvtx-cu12 12.1.105 omnisafe 0.5.1.dev27+g080e6b8 /home/jiayi/omnisafe packaging 24.0 pandas 2.0.3 pettingzoo 1.24.3 pillow 10.3.0 pip 24.0 platformdirs 4.2.1 pretty-errors 1.2.25 proglog 0.1.10 protobuf 4.25.3 psutil 5.9.8 pygame 2.1.0 Pygments 2.18.0 PyOpenGL 3.1.7 pyparsing 3.1.2 PySocks 1.7.1 python-dateutil 2.9.0.post0 pytorch-lightning 2.2.4 pytz 2024.1 PyYAML 6.0.1 requests 2.31.0 rich 13.7.1 safety-gymnasium 1.0.0 seaborn 0.13.2 sentry-sdk 2.1.1 setproctitle 1.3.3 setuptools 69.5.1 shellingham 1.5.4 six 1.16.0 smmap 5.0.1 soupsieve 2.5 sympy 1.12 tensorboard 2.16.2 tensorboard-data-server 0.7.2 torch 2.3.0 torchmetrics 1.4.0 tqdm 4.66.4 triton 2.3.0 typer 0.12.3 typing_extensions 4.11.0 tzdata 2024.1 urllib3 2.2.1 wandb 0.17.0 Werkzeug 3.0.3 wheel 0.43.0 xmltodict 0.13.0 yarl 1.9.4

Related issue: https://github.com/lengstrom/fast-style-transfer/issues/253

My running log:

image
wayne-weiwei commented 5 months ago

I sincerely appreciate your patience and assistance. Thank you very much. I downgraded the imageio-ffmpeg package to address compatibility issues image and ffmpeg package image However, the error still persists image It is a problem with the OpenGL library.

Gaiejj commented 5 months ago

This issue is quite unfamiliar to me, but I found a related issue that might help you. https://github.com/mcfletch/pyopengl/issues/90

wayne-weiwei commented 5 months ago

Thanks to your help, I have successfully implemented the solution. Your support has been invaluable. Thank you!