This project provides the open source implementation of the CDE in the paper: "Learning from Sparse Offline Datasets via Conservative Density Estimation"
- We recommend to use Anaconda or Miniconda to manage python environment.
- Install
mujoco
andmujoco-py
, your can either refer to https://github.com/openai/mujoco-py or runIt is also necessary to add below towget https://mujoco.org/download/mujoco210-linux-x86_64.tar.gz tar -xvf mujoco210-linux-x86_64.tar.gz mkdir .mujoco mv mujoco210 ~/.mujoco/mujoco210
~/.bashrc
:We have includedexport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/.mujoco/mujoco210/bin export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/nvidia
mujoco-py
inrequirements.txt
but you may need to installlibglew-dev, patchelf
when compiling themujoco-py
after the installation:sudo apt-get install libglew-dev sudo apt-get install patchelf
- Create conda env:
cd cde-offline-rl conda env create -f environment.yaml conda activate cde
- Install PyTorch according to your platform and cuda version.
- Install D4rl from https://github.com/Farama-Foundation/D4RL.
To run a single experiment, take maze2d-medium-v1 for example, run
python run_cde.py --env_name "maze2d-medium-v1" --hyperparams 'hyper_params/cde/maze2d.yaml' --cudaid 0 --seed 100
where --hyperparams
specifies the hyperparameter files in directory ./hyper_params/
, --cudaid
specifies which gpu will be used for training (the defaulted -1
means using cpu).
If you want to run multiple experiments, we have also included some other training commands in bash file run_exp.sh
. You can consider using &
to run the commands in parallel.