Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TAXPoseD #18

Open
wants to merge 85 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
25a8a42
non-corl additions
beneisner Jul 26, 2023
bb03794
corl additions
beneisner Jul 26, 2023
5712e5c
refactor the point cloud dataset so it can be swapped out
beneisner Jul 28, 2023
0d044c1
partially complete dataset
beneisner Aug 1, 2023
db16b37
replaced with cfg stuff
beneisner Aug 2, 2023
0f9fe29
enum
beneisner Aug 2, 2023
2b82315
first version of training rlbench
beneisner Aug 3, 2023
a29e57b
changes to some downloads
beneisner Aug 7, 2023
b3027e4
small changes to pretraining
beneisner Aug 8, 2023
7cf195a
pretraining works for all objects now
beneisner Aug 11, 2023
a44f73d
initial attempt at ndf pretraining
beneisner Aug 11, 2023
9f213ed
add a bunch of commands and configs
beneisner Aug 12, 2023
09bce40
launch script
beneisner Aug 12, 2023
57c63d2
amend
beneisner Aug 12, 2023
7976d19
additional stuff
beneisner Aug 12, 2023
dd8e36c
lots of extra goodies...
beneisner Aug 13, 2023
88c2ed3
got training and downloading going
beneisner Aug 14, 2023
be99025
added bottle place
beneisner Aug 14, 2023
98456c7
added remaining things
beneisner Aug 14, 2023
2656e87
add open3d dependency
beneisner Aug 14, 2023
3d99175
add pretraining options
beneisner Aug 14, 2023
60ce4ee
add in a config file
beneisner Aug 14, 2023
b7789b5
add in a config file
beneisner Aug 14, 2023
693a3ab
fix bottle config
beneisner Aug 14, 2023
3d3f65a
fix bottle config
beneisner Aug 14, 2023
6c33b7d
add taxpose training scripts
beneisner Aug 14, 2023
9a10a06
fix logic bug
beneisner Aug 14, 2023
2048cad
Merge remote-tracking branch 'origin/rlbench_dataset' into corl_2023_…
beneisner Aug 14, 2023
e3c0d11
add in multilateration
beneisner Aug 14, 2023
3ec0905
add new commands for cluster
beneisner Aug 14, 2023
e3c2cc1
new reupload command
beneisner Aug 15, 2023
9c4871e
new reupload command
beneisner Aug 15, 2023
6d53e54
some nice ablations
beneisner Aug 15, 2023
9ba65b4
added commands
beneisner Aug 15, 2023
54c05e4
state of the repo corl 2023 rebuttal
beneisner Sep 11, 2023
fc119b7
bump training time
beneisner Sep 12, 2023
ce92f54
decrease
beneisner Sep 12, 2023
e22d30a
fixed some of the eval stuff for grasping...
beneisner Sep 25, 2023
d0a3d84
redid the symmetry
beneisner Sep 27, 2023
727b579
remove symmetry from mug stuff
beneisner Sep 27, 2023
c62b74f
improved inference
beneisner Sep 27, 2023
b4488cf
made some changes to make the occlusions random and reduce training time
beneisner Sep 27, 2023
0ff3585
drop to fit on gpus
beneisner Sep 27, 2023
a6f42b4
skip if things get weird
beneisner Sep 27, 2023
8d47125
resubmit for iclr 2024
beneisner Sep 29, 2023
75a28c2
some rlbench stuff
beneisner Nov 12, 2023
42f1e83
added some rlbench stuff
beneisner Nov 19, 2023
a80e27c
additional stuff for training ndf
beneisner Nov 19, 2023
d9c328e
remove cruft
beneisner Nov 19, 2023
a1c1986
some additional
beneisner Nov 19, 2023
7edbaa6
some additional
beneisner Nov 19, 2023
0834a50
new mlat config
beneisner Nov 19, 2023
c0764e8
mlat
beneisner Nov 19, 2023
2b09a08
boost all the training
beneisner Nov 19, 2023
57da706
add all the configs
beneisner Nov 19, 2023
5fd8531
small changes
beneisner Nov 19, 2023
a2ce611
small changes
beneisner Nov 19, 2023
2c9e3d8
small changes
beneisner Nov 19, 2023
5d95e84
small changes
beneisner Nov 19, 2023
4eff4bc
reduce workers
beneisner Nov 19, 2023
773bbe6
fewer resources
beneisner Nov 19, 2023
7e3c4f2
updated configs
beneisner Nov 20, 2023
39d00b4
add new symmetry
beneisner Nov 20, 2023
141c1ee
add in symmetry to model
beneisner Nov 20, 2023
65892ad
update the config to use max points
beneisner Nov 20, 2023
522a7e8
add puzzle training
beneisner Nov 21, 2023
245831b
added new tasks
beneisner Nov 21, 2023
4bc2f6a
add evaluations
beneisner Nov 22, 2023
3bb2227
ablation
beneisner Nov 22, 2023
4033a25
iclr 2024 rebuttal
beneisner Nov 29, 2023
18a42aa
pick and place works well
beneisner Nov 29, 2023
8f1c54d
eval works
beneisner Dec 11, 2023
84fae64
pytest works
beneisner Dec 12, 2023
aeb0a73
move rlbench around
beneisner Dec 12, 2023
4392445
move train
beneisner Dec 12, 2023
d6ffabe
configs look good
beneisner Dec 12, 2023
7eef0ea
huge change to the config structure to enable better scaling to rlbench
beneisner Dec 13, 2023
48ca396
nice new training commands
beneisner Dec 13, 2023
d114cc1
Adding back NDF dataset support with some feature additions
oadonca Dec 21, 2023
9b7332e
Use occlusion_cfg itself to check whether to apply occlusions
oadonca Dec 22, 2023
96b0f0d
Merge pull request #19 from r-pad/add_back_ndf
oadonca Dec 22, 2023
9af0790
fix rlbench eval
beneisner Dec 22, 2023
3ec7a83
Add TAXPoseD with support for base TAXPose decoder and RLBench
oadonca Dec 15, 2023
a8e0291
Add TAXPoseD support for RelDist decoder
oadonca Dec 18, 2023
062ffb0
Revert some changes, apply black formatting, add more taxposed config…
oadonca Dec 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
third_party/ndf_robot/src/ndf_robot/data/
third_party/ndf_robot/src/ndf_robot/eval_data/
third_party/ndf_robot/src/ndf_robot/descriptions/
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -377,8 +377,11 @@ results/
rollouts/
wandb/
trained_models/ndf/
artifacts/
wandb_artifacts/
recent_training_paths.txt

# Ignore all checkpoint configs except for release files.
configs/checkpoints/**/*.yaml
!configs/checkpoints/**/release.yaml
!configs/checkpoints/**/pretraining.yaml
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -6,11 +6,14 @@
"torch.*"
],
"editor.codeActionsOnSave": {
"source.organizeImports": true
"source.organizeImports": "explicit"
},
"files.exclude": {
"data/*": true,
},
"python.analysis.exclude": [
"logs/**",
],
"python.linting.enabled": true,
"files.watcherExclude": {
"**/.git/objects/**": true,
88 changes: 88 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Use the official Ubuntu 20.04 image as the base
FROM ubuntu:20.04

# Set environment variables to avoid interactive prompts during installation
ENV DEBIAN_FRONTEND=noninteractive

# Install necessary dependencies
RUN apt-get update && \
apt-get install -y curl git build-essential libssl-dev zlib1g-dev libbz2-dev \
git \
libreadline-dev libsqlite3-dev wget llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev libffi-dev liblzma-dev python-openssl && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Install pyenv
ENV CODING_ROOT="/opt/baeisner"

WORKDIR $CODING_ROOT
RUN git clone --depth=1 https://github.com/pyenv/pyenv.git .pyenv

ENV PYENV_ROOT="$CODING_ROOT/.pyenv"
ENV PATH="$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH"

# Install Python 3.10 using pyenv
RUN pyenv install 3.9.12
RUN pyenv global 3.9.12

# Install PyTorch with CUDA support (make sure to adjust this depending on your CUDA version)
RUN pip install torch==1.13.0+cu116 torchvision==0.14.0+cu116 --extra-index-url https://download.pytorch.org/whl/cu116

# Install pytorch geometric.
RUN pip install torch-scatter==2.0.9 torch-sparse==0.6.15 torch-cluster==1.6.0 torch-spline-conv==1.2.1 pyg_lib==0.1.0 -f https://data.pyg.org/whl/torch-1.13.0+cu116.html

# Install pytorch3d
RUN pip install fvcore iopath && \
pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/py39_cu116_pyt1130/download.html

# Download CoppeliaSim
RUN mkdir $CODING_ROOT/.coppelia
WORKDIR $CODING_ROOT/.coppelia
RUN curl https://www.coppeliarobotics.com/files/V4_1_0/CoppeliaSim_Edu_V4_1_0_Ubuntu20_04.tar.xz -o CoppeliaSim_Edu_V4_1_0_Ubuntu20_04.tar.xz && \
tar -xf CoppeliaSim_Edu_V4_1_0_Ubuntu20_04.tar.xz && \
rm CoppeliaSim_Edu_V4_1_0_Ubuntu20_04.tar.xz

# modify environment variables
ENV COPPELIASIM_ROOT="$CODING_ROOT/.coppelia/CoppeliaSim_Edu_V4_1_0_Ubuntu20_04"
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$COPPELIASIM_ROOT"
ENV QT_QPA_PLATFORM_PLUGIN_PATH="$COPPELIASIM_ROOT"

# Install CFFI
RUN pip install cffi==1.14.2 wheel

# Install PyRep
RUN pip install --no-build-isolation "pyrep @ git+https://github.com/stepjam/PyRep.git"

# Make the working directory the home directory
RUN mkdir $CODING_ROOT/code
WORKDIR $CODING_ROOT/code

# Only copy in the source code that is necessary for the dependencies to install
COPY ./taxpose $CODING_ROOT/code/taxpose
COPY ./third_party $CODING_ROOT/code/third_party
COPY ./setup.py $CODING_ROOT/code/setup.py
COPY ./pyproject.toml $CODING_ROOT/code/pyproject.toml
RUN pip install -e ".[rlbench]"
RUN pip install -e third_party/ndf_robot

# Changes to the configs and scripts will not require a rebuild
COPY ./configs $CODING_ROOT/code/configs
COPY ./scripts $CODING_ROOT/code/scripts

RUN git config --global --add safe.directory /root/code

# Make a data directory.
RUN mkdir $CODING_ROOT/data

# Make a logs directory.
RUN mkdir $CODING_ROOT/logs

# Install gdown.
RUN pip install gdown

# Copy the download script.
COPY ./download_data.sh $CODING_ROOT/code/download_data.sh

# Set up the entry point
CMD ["python", "-c", "import torch; print(torch.cuda.is_available())"]
43 changes: 40 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -57,7 +57,9 @@ For our experiments, we installed torch 1.11 with cuda 11.3:

```
# pip install torch==1.11.0+cu113 torchvision==0.12.0+cu113 --extra-index-url https://download.pytorch.org/whl/cu113
pip install torch==1.13.0+cu116 torchvision==0.14.0+cu116 --extra-index-url https://download.pytorch.org/whl/cu116
# pip install torch==1.13.0+cu116 torchvision==0.14.0+cu116 --extra-index-url https://download.pytorch.org/whl/cu116
pip install torch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 --index-url https://download.pytorch.org/whl/cu118

```

### `pytorch-geometric`
@@ -68,7 +70,8 @@ For our experiments, we installed with the following command:

```
# pip install torch-scatter==2.0.9 torch-sparse==0.6.15 torch-cluster==1.6.0 torch-spline-conv==1.2.1 pyg_lib==0.1.0 -f https://data.pyg.org/whl/torch-1.11.0+cu113.html
pip install torch-scatter==2.0.9 torch-sparse==0.6.15 torch-cluster==1.6.0 torch-spline-conv==1.2.1 pyg_lib==0.1.0 -f https://data.pyg.org/whl/torch-1.13.0+cu116.html
# pip install torch-scatter==2.0.9 torch-sparse==0.6.15 torch-cluster==1.6.0 torch-spline-conv==1.2.1 pyg_lib==0.1.0 -f https://data.pyg.org/whl/torch-1.13.0+cu116.html
pip install pyg_lib torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-2.1.0+cu121.html
```

### `pytorch3d`
@@ -80,7 +83,9 @@ We ran the following:
```
pip install fvcore iopath
# pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/py39_cu113_pyt1110/download.html
pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/py39_cu116_pyt1130/download.html
# pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/py39_cu116_pyt1130/download.html
# pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/py39_cu118_pyt201/download.html

```

### `dgl`
@@ -648,3 +653,35 @@ These are real-world experiments we ran, and so can't be reproduced purely from
## Supplement Tables 11-14: Expanded results

These are granular results of the experiments in Table 1.


## Docker

### Build a Docker container.

```
docker build -t beisner/taxpose .
```

### Run training.

```
WANDB_API_KEY=<API_KEY>
USERNAME=<USERNAME>
# Optional: mount current directory to run / test new code.
# Mount data directory to access data.
docker run \
--shm-size=256m\
-v /data/ndf:/opt/baeisner/data \
-v $(pwd)/trained_models:/opt/baeisner/code/trained_models \
-v $(pwd)/logs:/opt/baeisner/logs \
--gpus all \
-e WANDB_API_KEY=$WANDB_API_KEY \
-e WANDB_DOCKER_IMAGE=beisner/taxpose \
beisner/taxpose python scripts/train_residual_flow.py \
task=mug_grasp \
model=taxpose \
+mode=train \
benchmark.dataset_root=/opt/baeisner/data \
log_dir=/opt/baeisner/logs
```
48 changes: 48 additions & 0 deletions autobot.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@

Downloading the data.

```bash
singularity exec \
--nv \
--pwd /opt/$(whoami)/code \
-B /scratch/$(whoami)/data:/opt/data \
docker://beisner/taxpose \
/opt/code/scripts/download_data.sh \
/opt/data/ndf
```


Pretraining.

```bash
SINGULARITYENV_CUDA_VISIBLE_DEVICES=0 \
SINGULARITYENV_WANDB_DOCKER_IMAGE=taxpose \
singularity exec \
--nv \
-B /scratch/$(whoami)/data:/data \
-B /scratch/$(whoami)/logs:/opt/logs \
docker://beisner/taxpose \
python scripts/train_residual_flow.py \
log_dir=/opt/logs
```



Training the model.

```bash
SINGULARITYENV_CUDA_VISIBLE_DEVICES=0 \
SINGULARITYENV_WANDB_DOCKER_IMAGE=taxpose \
singularity exec \
--nv \
--pwd /opt/$(whoami)/code \
-B /scratch/$(whoami)/data:/opt/data \
-B /scratch/$(whoami)/logs:/opt/logs \
docker://beisner/taxpose \
python scripts/train_residual_flow.py \
task=mug_grasp \
model=taxpose \
+mode=train \
benchmark.dataset_root=/opt/data \
log_dir=/opt/logs
```
32 changes: 32 additions & 0 deletions configs/_logging.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Where logs go, i.e. the top folder.
log_dir: ${hydra:runtime.cwd}/logs

output_dir: ${hydra:runtime.output_dir}

# This has to come from above.
job_type: ???

hydra:
run:
dir: ${log_dir}/${hydra.job.name}/${now:%Y-%m-%d}/${now:%H-%M-%S}
sweep:
dir: ${log_dir}/${hydra.job.name}/sweep/${now:%Y-%m-%d}/${now:%H-%M-%S}
subdir: ${hydra.job.num}
job:
chdir: True
name: ${job_type}

lightning:
checkpoint_dir: ${output_dir}/checkpoints

wandb:
entity: r-pad
project: taxpose

# Group is for grouping runs together (i.e. a train run and an eval run).
group: ???

# Where to dump wandb logs, etc.
save_dir: ${output_dir}
# Put artifacts at the toplevel so that we don't have to re-download each time...
artifact_dir: ${hydra:runtime.cwd}/wandb_artifacts
2 changes: 2 additions & 0 deletions configs/benchmark/ndf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
name: ndf
dataset_root: ${..data_root}/ndf
2 changes: 2 additions & 0 deletions configs/benchmark/real_world_mug.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
name: real_world_mug
dataset_root: /home/beisner/code/multi_project/cam_ready_trainingdata
2 changes: 2 additions & 0 deletions configs/benchmark/rlbench.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
name: rlbench
dataset_root: ${..data_root}/rlbench
8 changes: 4 additions & 4 deletions configs/checkpoints/ndf/mug/release.yaml
Original file line number Diff line number Diff line change
@@ -2,8 +2,8 @@ defaults:
- taxpose_base

arbitrary:
grasp: ${hydra:runtime.cwd}/trained_models/ndf/${object_class.name}/arbitrary/grasp.ckpt
place: ${hydra:runtime.cwd}/trained_models/ndf/${object_class.name}/arbitrary/place.ckpt
grasp: ${hydra:runtime.cwd}/trained_models/ndf/${task.name}/arbitrary/grasp.ckpt
place: ${hydra:runtime.cwd}/trained_models/ndf/${task.name}/arbitrary/place.ckpt
upright:
grasp: ${hydra:runtime.cwd}/trained_models/ndf/${object_class.name}/upright/grasp.ckpt
place: ${hydra:runtime.cwd}/trained_models/ndf/${object_class.name}/upright/place.ckpt
grasp: ${hydra:runtime.cwd}/trained_models/ndf/${task.name}/upright/grasp.ckpt
place: ${hydra:runtime.cwd}/trained_models/ndf/${task.name}/upright/place.ckpt
68 changes: 68 additions & 0 deletions configs/checkpoints/pretraining.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
dgcnn:
nce_loss:
# These got retrained!
# gripper: ${hydra:runtime.cwd}/trained_models/pretraining_gripper_embnn_weights.ckpt
gripper: r-pad/taxpose/model-wajnzcwn:v0
# mug: ${hydra:runtime.cwd}/trained_models/pretraining_mug_embnn_weights.ckpt
mug: r-pad/taxpose/model-f81p2p5d:v0
# rack: ${hydra:runtime.cwd}/trained_models/pretraining_rack_embnn_weights.ckpt
rack: r-pad/taxpose/model-1on3wem2:v0
# bottle: ${hydra:runtime.cwd}/trained_models/pretraining_bottle_embnn_weights.ckpt
bottle: r-pad/taxpose/model-nogq98i9:v0
# bowl: ${hydra:runtime.cwd}/trained_models/pretraining_bowl_embnn_weights.ckpt
bowl: r-pad/taxpose/model-i7e35k1f:v0
# slab: ${hydra:runtime.cwd}/trained_models/pretraining_slab_embnn_weights.ckpt
slab: r-pad/taxpose/model-ysgwf55q:v0
none:
gripper: null
mug: null
rack: null
wine: null
wine_rack: null
bottle: null
bowl: null
slab: null
square: null
base: null
phone: null
phone_base: null
toilet_roll: null
toilet_roll_stand: null
puzzle_piece: null
puzzle: null
hanger: null
hanger_rack: null
vn_dgcnn:
nce_loss:
# 0
# mug: /home/beisner/code/multi_project/taxpose/outputs/2023-05-22/17-09-00/embedding_pretraining_mug/2eakon6k/checkpoints/embnn_callback_epoch_2_global_step_33000.ckpt
# # 1
# rack: /home/beisner/code/multi_project/taxpose/outputs/2023-05-23/14-31-55/embedding_pretraining_mug/wcdwkh8r/checkpoints/embnn_callback_epoch_999_global_step_13000.ckpt
# # 2
# gripper: /home/beisner/code/multi_project/taxpose/outputs/2023-05-23/14-31-58/embedding_pretraining_mug/1m959icc/checkpoints/embnn_callback_epoch_999_global_step_13000.ckpt
gripper: r-pad/taxpose/model-3bvf82th:v0
mug: r-pad/taxpose/model-p3fluqtg:v0
rack: r-pad/taxpose/model-kxc51apt:v0
bottle: r-pad/taxpose/model-x3c82iam:v0
bowl: r-pad/taxpose/model-qbtkzw5y:v0
slab: r-pad/taxpose/model-tmymvff2:v0

none:
gripper: null
mug: null
rack: null
wine: null
wine_rack: null
bottle: null
bowl: null
slab: null
square: null
base: null
phone: null
phone_base: null
toilet_roll: null
toilet_roll_stand: null
puzzle_piece: null
puzzle: null
hanger: null
hanger_rack: null
14 changes: 14 additions & 0 deletions configs/commands/ablations/se3_augmentation/_base.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# @package _global_

defaults:
- /commands/ndf/_train@_here_
- _self_

dm:
train_dset:
rotation_variance: 1e-4
translation_variance: 1e-4

val_dset:
rotation_variance: 3.1415
translation_variance: 0.5
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# @package _global_

defaults:
- /commands/ndf/_eval@_here_
- override /model: mlat_s256_vnn
- override /task: mug
- override /pose_dist: arbitrary
- _self_

checkpoint_file_grasp: r-pad/taxpose/model-sysvj0fh:v0
checkpoint_file_place: r-pad/taxpose/model-wbjsiwz1:v0
Loading