# Skill Learning via Policy Diversity Yields Identifiable Representations for Reinforcement Learning
This repository includes code for the NeurIPS 2025 submission "Skill Learning via Policy Diversity Yields Identifiable Representations for Reinforcement Learning".

The code is a fork of the [repository](https://github.com/Princeton-RL/contrastive-successor-features) corresponding to the paper "Can a MISL Fly? Analysis and Ingredients for Mutual Information Skill Learning".

## Installation

Please run the following commands at the root of the project:
```
# Setting up the conda environment
conda create --name csf python=3.9
conda activate csf

# Installing dependencies
pip install -r requirements.txt --no-deps
pip install -e .
pip install -e garaged
pip install --upgrade joblib
pip install patchelf
```

> [!WARNING]
> Pip might complain about incompatible versions -- this is expected and can be safely ignored.

Next, we need to do some Mujoco setup.
```
conda activate csf
conda install -c conda-forge glew
conda install -c conda-forge mesalib
conda install -c anaconda mesa-libgl-cos6-x86_64
conda install -c menpo glfw3
```

We also need to tell Mujoco which backend to use. This can be done by setting the appropriate environment variables.
```
conda env config vars set MUJOCO_GL=egl PYOPENGL_PLATFORM=egl
conda deactivate && conda activate csf
```

If you don't already have Mujoco, you will need it. Install Mujoco in a folder called `.mujoco`. More instructions on how to do so are linked [here](https://pytorch.org/rl/main/reference/generated/knowledge_base/MUJOCO_INSTALLATION.html).

Finally, you may want to add the following environment variables to your `.bashrc` file:
```
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/your/.mujoco/mujoco210/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/nvidia
export CPATH=$CONDA_PREFIX/include
```

Remember to source your `.bashrc` file after changing it: `source ~/.bashrc`.

## Running Experiments

The general command to run our experiments is as follows.
```
sh scripts/[env_name]/[config_list].sh
```
For example, to run CSF on the Ant environment with latent dimensionality 29, use the following
command:
```
sh scripts/ant/dim_29_lam_1_seed_0.sh
```
