dobro12 / CPO

Constrained Policy Optimization implementation on Safety Gym
21 stars 5 forks source link

how to run this code #1

Closed lwyncepu closed 3 years ago

lwyncepu commented 3 years ago

I've been trying to run this for weeks, and found it hard to build a envrionment to run this. can anyone provide a requirement.txt or a environment.yml to implement this code ?

Thanks!

dobro12 commented 3 years ago

I used the Safety Gym environment to evaluate my implementation. The Safety Gym needs MuJoCo licenses to install and the installation instruction is well described on their Github page (https://github.com/openai/safety-gym).

Other python modules to run this project are listed below.

tensorflow-gpu           1.13.1
tensorflow-probability   0.6.0
sklearn                  0.0
mujoco-py                2.0.2.7
numpy                    1.19.4
safety-gym               0.0.0
scipy                    1.5.4
lwyncepu commented 3 years ago

I'm using Windows10. What platform is this implementation on originally?

Found in https://github.com/openai/mujoco-py/README.md: "Windows support has been DEPRECATED and removed in 2.0.2.0. One known good past version is 1.50.1.68." So I installed mujoco_py=1.50.1.

2. And what the exact version of sklearn? I think it should not be "0.0" I installed scikit_learn‑0.24.2 instead. Is that OK?

I'm new to Python, thanks a lot for helping.

  1. Bug occurs: (safety-gym) D:\2021\safeRL\CPO-master>python train.py #training Traceback (most recent call last): File "train.py", line 10, in from nets import Agent File "D:\2021\safeRL\CPO-master\nets.py", line 1, in from sklearn.utils import shuffle File "D:\anaconda3\envs\safety-gym\lib\site-packages\sklearn__init.py", line 82, in from .base import clone File "D:\anaconda3\envs\safety-gym\lib\site-packages\sklearn\base.py", line 17, in from .utils import _IS_32BIT File "D:\anaconda3\envs\safety-gym\lib\site-packages\sklearn\utils__init__.py", line 23, in from .class_weight import compute_class_weight, compute_sample_weight File "D:\anaconda3\envs\safety-gym\lib\site-packages\sklearn\utils\class_weight.py", line 7, in from .validation import _deprecate_positional_args File "D:\anaconda3\envs\safety-gym\lib\site-packages\sklearn\utils\validation.py", line 26, in from .fixes import _object_dtype_isnan, parse_version File "D:\anaconda3\envs\safety-gym\lib\site-packages\sklearn\utils\fixes.py", line 20, in import scipy.stats File "D:\anaconda3\envs\safety-gym\lib\site-packages\scipy\stats\init.py", line 388, in from .stats import * File "D:\anaconda3\envs\safety-gym\lib\site-packages\scipy\stats\stats.py", line 174, in from scipy.spatial.distance import cdist File "D:\anaconda3\envs\safety-gym\lib\site-packages\scipy\spatial\init__.py", line 98, in from .qhull import * ImportError: DLL load failed: The specified module could not be found.

Do you have any advice? Thanks!!

dobro12 commented 3 years ago

Sorry, but this project was only tested on Ubuntu.

  1. For MuJoCo error, you have to get the license file and the instruction in Safety Gym GitHub page well describes how to install MuJoCo.
  2. It's okay.
  3. It looks like Window problems.
RaduCorcodel commented 3 years ago

Can this run with gym, but not safety-gym? What changes (if any) would the code need in this case? Thank you

dobro12 commented 3 years ago

Yes, it can run in gym-like environments. However, you should modify the environments to give a cost signal through a variable, "info['cost']".