Xiangyu Yin1, Sihao Wu1, Jiaxu Liu1, Meng Fang1, Xingyu Zhao2, Xiaowei Huang1, Wenjie Ruan1
1Department of Computer Science, University of Liverpool, 2WMG, University of Warwick
This is a PyTorch implementation of our paper Representation-Based Robustness in Goal-Conditioned Reinforcement Learning; this code can be used to reproduce Section Experiments and Appendix of the paper.
We evaluate our method using four robot manipulation tasks, namely FetchPush, FetchReach, FetchSlide, and FetchPick as below.
FetchPush | FetchPickAndPlace | FetchReach | FetchSlide |
- Create conda environment and activate it:
conda env create -f environment.yml conda activate ReRoGCRL pip install torch==1.13.1 gym==0.15.7
- Download the offline dataset and place
/offline_data
in the project root directory.
We provide commands for reproducing the various attack methods (Table 1), the defensive performance (Table 3).
- Train the 3 algorithms as our baselines for GCRL (DDPG, GCSL, GoFar) and save the models:
mpirun -np 1 python3 train.py --env $env --method $method --device $device --seed $seed
Flags and Parameters | Description |
---|---|
--env $ENV |
tasks: FetchReach, FetchPush, FetchPick, FetchSlide |
--method $METHOD |
algorithms: ddpg, gcsl, gofar |
- Run various attack methods in GCRL for all the baselines to get Table 1.
sh scripts/adversarial_attack.sh $device $env $method $attack_obj
Flags and Parameters | Description |
---|---|
$env |
tasks: FetchReach, FetchPush, FetchPick, FetchSlide |
$method |
algorithms: ddpg, gcsl, gofar |
$attack_obj |
attack objects: obs, goal, both |
- To run the defensive performance (Table 3), we first train the defensive methods in all environments and save the models.
sh scripts/trainning.sh $env $device $method
Flags and Parameters | Description |
---|---|
$env |
tasks: FetchReach, FetchPush, FetchPick, FetchSlide |
$method |
algorithms: ddpg_simsr, ddpg_aug, ddpg_arts, gofar_simsr, gofar_aug, gofar_arts |
- Run various attack methods in GCRL for defensive methods to get Table 3.
sh scripts/adversarial_attack.sh $device $env $method $attack_obj
Flags and Parameters | Description |
---|---|
$env |
tasks: FetchReach, FetchPush, FetchPick, FetchSlide |
$method |
algorithms: ddpg_simsr, ddpg_aug, ddpg_arts, gofar_simsr, gofar_aug, gofar_arts |
$attack_obj |
attack objects: obs, goal, both |
We borrowed some code from the following repositories: