-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add multitask policy training benchmark scripts
- Loading branch information
Lirui
committed
Nov 7, 2023
1 parent
ecaf111
commit 06b10df
Showing
6 changed files
with
130 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
["color-coordinated-box-ball-matching", "ball-on-box-on-container", "insert-sphere-into-container", "sphere-container-color-match", "colored-balls-sorting-in-corner", "color-cued-ball-corner-sorting", "place-ball-in-elevated-bowl", "stack-blocks-in-container", "sorting-blocks-into-pallets", "ball-sorting-with-blocks-barrier", "color-coordinated-zone-arrangement", "color-specific-container-fill", "align-balls-in-colored-boxes", "color-ordered-container-arrangement", "cylinder-balancing-and-placement", "color-coordinated-cylinder-ball-match", "color-coordinated-zone-stacking", "color-coordinated-block-shifting", "kit-in-bowl-in-zone", "put-kit-in-bowl", "ball-in-bowl-obstacle-course-new", "color-ordered-blocks-on-pallet", "color-coordinated-insertion", "sort-insert-color-coordinated-blocks", "color-coordinated-sphere-insertion", "insert-blocks-lineup", "mixed-color-block-barrier-insertion", "block-on-cylinder-on-pallet", "vertical-insertion-blocks", "color-sorted-block-race", "color-coordinated-sphere-on-pallet-pyramid", "color-blocks-in-cylinder-maze", "color-coordinated-block-tower", "sort-and-stack-clr-blocks", "create-pyramid-blocks-and-container", "colorful-block-tower-on-cylinder-base", "sweep-and-sort-blocks", "color-coordinated-ball-stacking", "stack-color-coordinated-blocks", "color-coordinated-cylinder-pyramid", "block-pyramid-with-limited-space", "multicolor-block-bridge", "construct-colorful-arch", "color-coordinated-block-bridge", "multi-level-pyramid-construction", "create-pyramid-with-color-coded-ells", "color-coordinated-cylinder-tower", "color-coordinated-arch-construction", "cylinder-ring-stack", "color-sorted-container-stack", "color-structured-block-tower", "rainbow-stack", "sort-and-assemble-block-castle", "symmetric-block-bridge-construction", "colored-cylinder-in-square", "build-cylinder-structure", "stack-three-layer-red-wall", "insert-ell-along-square-path", "guided-block-path", "color-ordered-insertion-new", "construct-corner-blocks", "build-car", "build-house", "put-blocks-between-zones", "corner-sort-cylinders", "place-blue-on-line-ends", "align-pair-colored-blocks-along-line", "align-rope-along-line", "sphere-align-stand", "align-rope-cross-zone"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
DATA_DIR=$1 | ||
TASK=$2 | ||
DISP=False | ||
|
||
echo "Generating dataset... Folder: $DATA_DIR" | ||
trap "kill 0" SIGINT | ||
|
||
LANG_TASKS=$2 | ||
|
||
for task in $LANG_TASKS | ||
do | ||
python cliport/demos.py n=200 task=$task mode=train data_dir=$DATA_DIR disp=$DISP record.save_video=False +regenerate_data=True & | ||
python cliport/demos.py n=50 task=$task mode=val data_dir=$DATA_DIR disp=$DISP record.save_video=False +regenerate_data=True & | ||
python cliport/demos.py n=100 task=$task mode=test data_dir=$DATA_DIR disp=$DISP record.save_video=False +regenerate_data=True & | ||
done | ||
wait | ||
|
||
echo "Finished Language Tasks." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/bin/bash | ||
|
||
DATA_DIR=$1 | ||
TRAINTASK=${2-'[rainbow-stack,bowl-ball-placement]'} | ||
TESTTASK=${3-'[rainbow-stack,bowl-ball-placement]'} | ||
TASKNAME=${4-'mix-two'} | ||
STEPS=${5-'10000'} | ||
|
||
DISP=False | ||
|
||
echo "Training multi-task dataset... Folder: $DATA_DIR Task $TRAINTASK" | ||
trap "kill 0" SIGINT | ||
|
||
python cliport/train.py train.task=$TRAINTASK \ | ||
train.agent=cliport \ | ||
train.model_task=$TASKNAME \ | ||
train.attn_stream_fusion_type=add \ | ||
train.trans_stream_fusion_type=conv \ | ||
train.lang_fusion_type=mult \ | ||
train.n_demos=50 \ | ||
train.n_steps=${STEPS} \ | ||
dataset.cache=True \ | ||
train.exp_folder=exps/exp-$TASKNAME \ | ||
dataset.type=multi \ | ||
train.load_from_last_ckpt=False | ||
|
||
|
||
# Convert Python list to Bash array | ||
bash_array=$(python3 -c "import sys; print(' '.join((sys.argv[1])[1:-1].split(',')))" "$TESTTASK") | ||
|
||
# Convert the space-separated string to a bash array | ||
echo "Testing multi-task dataset... Folder: $DATA_DIR Task $TESTTASK" | ||
|
||
|
||
for task in $bash_array | ||
do | ||
echo "Testing $task" | ||
# TEST | ||
# bash scripts/generate_gpt_datasets.sh data $task | ||
|
||
python cliport/eval.py model_task=$TASKNAME \ | ||
eval_task=$task \ | ||
agent=cliport \ | ||
mode=test \ | ||
n_demos=100 \ | ||
train_demos=50 \ | ||
checkpoint_type=test_best \ | ||
type=single \ | ||
exp_folder=exps/exp-$TASKNAME \ | ||
update_results=True & | ||
done | ||
wait | ||
|
||
python notebooks/print_results.py -r=exps/exp-$TASKNAME | ||
|
||
echo "Finished Training." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash | ||
|
||
DATA_DIR=$1 | ||
TASK=$2 | ||
DISP=False | ||
|
||
echo "Training dataset... Folder: $DATA_DIR Task $TASK" | ||
|
||
# You can parallelize these depending on how much resources you have | ||
|
||
############################# | ||
## Language-Conditioned Tasks | ||
trap "kill 0" SIGINT | ||
LANG_TASKS=$2 | ||
|
||
|
||
for task in $LANG_TASKS | ||
do | ||
# Generate data | ||
bash scripts/regenerate_gpt_datasets.sh data $task | ||
|
||
# TRAIN | ||
python cliport/train.py train.task=$task \ | ||
train.agent=cliport \ | ||
train.attn_stream_fusion_type=add \ | ||
train.trans_stream_fusion_type=conv \ | ||
train.lang_fusion_type=mult \ | ||
train.n_demos=100 \ | ||
train.n_steps=5000 \ | ||
train.exp_folder=exps/exps-singletask \ | ||
dataset.cache=True | ||
|
||
# TEST | ||
python cliport/eval.py eval_task=$task \ | ||
agent=cliport \ | ||
mode=test \ | ||
n_demos=100 \ | ||
train_demos=200 \ | ||
checkpoint_type=test_best \ | ||
exp_folder=exps/exps-singletask \ | ||
update_results=True | ||
done | ||
|
||
python notebooks/print_results.py -r=exps/exps-singletask | ||
|
||
echo "Finished Training." |