GitHub - ziyin-xiong/Ag2x2 (original) (raw)
Code repository for Ag2x2: Robust Agent-Agnostic Visual Representations for Zero-Shot Bimanual Manipulation.
Environment Setup
- Clone the project:
git clone https://github.com/ziyin-xiong/Ag2x2.git
cd Ag2x2 - Create a conda environment:
conda create -n ag2x2 python=3.6.8
conda activate ag2x2 - Install Pytorch:
pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 -f https://download.pytorch.org/whl/torch_stable.html - Install conda dependencies:
conda install --file dependencies.txt -y - Install pip requirements:
pip install -r requirements.txt - Install IsaacGym following the official documentation.
Visual Representation
- Train our visual representation model on EPIC-KITCHEN dataset:
- Run
train_ddp.pyto train our model on multiple GPUs in parallel, or runtrain.pyto train on a single GPU.
- Run
- Specify your model save path by modifying
exp_nameinrepre_trainer/cfgs/scratch.yml. - Please download our checkpoint here.
Bimanual Skills
- Change
ckpt_diraccording to the location you store your visual representation checkpoint. - Train bimanual tasks in IsaacGym with the following command:
python train.py --task=ag2x2@close_door_outward@ag2x2 --algo=ppo --seed=42 --cfg_train=cfgs/algo/ppo/manipulation.yaml --disable_wandb --camera=default
The best policy will be saved asmodel_best.ptinlogs/ag2x2/close_door_outward@default/ag2x2@ppo.42/. - Inference and save a trajectory generated by the trained policy:
python train.py --task=ag2x2@close_door_outward@ag2x2 --model_dir=logs/ag2x2/close_door_outward@default/ag2x2@ppo.42/model_best.pt --test --save_traj --algo=ppo --cfg_train=cfgs/algo/ppo/manipulation.yaml --camera=default --seed=0 --disable_wandb
The trajectory will be saved aslogs/ag2x2/close_door_outward@default/ag2x2@ppo.42/absres_best.pkl. - Plan with franka robot arms using the saved trajectory:
python plan.py --task=ag2x2@close_door_outward@ag2x2 --traj_path=logs/ag2x2/close_door_outward@default/ag2x2@ppo.42/absres_best.pkl --pipeline=cpu --algo=ppo --cfg_train=cfgs/algo/ppo/manipulation.yaml --disable_wandb --camera=default