Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ defaults:
- _self_
- task: pusht_image

name: pusht_pretrained_dinov2_base
name: pusht_pretrained_dinov2_base_preprocessing
_target_: diffusion_policy.workspace.train_diffusion_unet_image_workspace.TrainDiffusionUnetImageWorkspace

task_name: ${task.name}
Expand Down Expand Up @@ -45,6 +45,7 @@ policy:
use_group_norm: False
share_rgb_model: True
imagenet_norm: False
rgb_model_name: facebook/dinov2-base

horizon: ${horizon}
n_action_steps: ${eval:'${n_action_steps}+${n_latency_steps}'}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ defaults:
- _self_
- task: pusht_image

name: pusht_pretrained_dinov2_large
name: pusht_pretrained_dinov2_large_preprocessing
_target_: diffusion_policy.workspace.train_diffusion_unet_image_workspace.TrainDiffusionUnetImageWorkspace

task_name: ${task.name}
Expand Down Expand Up @@ -45,6 +45,7 @@ policy:
use_group_norm: False
share_rgb_model: True
imagenet_norm: False
rgb_model_name: facebook/dinov2-large

horizon: ${horizon}
n_action_steps: ${eval:'${n_action_steps}+${n_latency_steps}'}
Expand Down
152 changes: 152 additions & 0 deletions diffusion_policy/config/train_real_pusht.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
defaults:
- _self_
- task: real_pusht_image

name: real_pusht_end2end
_target_: diffusion_policy.workspace.train_diffusion_unet_image_workspace.TrainDiffusionUnetImageWorkspace

task_name: ${task.name}
shape_meta: ${task.shape_meta}
exp_name: "default"

horizon: 16
n_obs_steps: 2
n_action_steps: 8
n_latency_steps: 0
dataset_obs_steps: ${n_obs_steps}
past_action_visible: False
keypoint_visible_rate: 1.0
obs_as_global_cond: True

policy:
_target_: diffusion_policy.policy.diffusion_unet_image_policy.DiffusionUnetImagePolicy

shape_meta: ${shape_meta}

noise_scheduler:
_target_: diffusers.schedulers.scheduling_ddim.DDIMScheduler
num_train_timesteps: 100
beta_start: 0.0001
beta_end: 0.02
# beta_schedule is important
# this is the best we found
beta_schedule: squaredcos_cap_v2
clip_sample: True
set_alpha_to_one: True
steps_offset: 0
prediction_type: epsilon # or sample

obs_encoder:
_target_: diffusion_policy.model.vision.multi_image_obs_encoder.MultiImageObsEncoder
shape_meta: ${shape_meta}
rgb_model:
_target_: diffusion_policy.model.vision.model_getter.get_resnet
name: resnet18
weights: null
resize_shape: [224,224]
crop_shape: null
random_crop: False
use_group_norm: False
share_rgb_model: True
imagenet_norm: True

horizon: ${horizon}
n_action_steps: ${eval:'${n_action_steps}+${n_latency_steps}'}
n_obs_steps: ${n_obs_steps}
num_inference_steps: 100
obs_as_global_cond: ${obs_as_global_cond}
# crop_shape: null
diffusion_step_embed_dim: 128
down_dims: [512, 1024, 2048]
kernel_size: 5
n_groups: 8
cond_predict_scale: True

# scheduler.step params
# predict_epsilon: True

ema:
_target_: diffusion_policy.model.diffusion.ema_model.EMAModel
update_after_step: 0
inv_gamma: 1.0
power: 0.75
min_value: 0.0
max_value: 0.9999

dataloader:
batch_size: 64
num_workers: 8
shuffle: True
pin_memory: True
persistent_workers: True

val_dataloader:
batch_size: 64
num_workers: 8
shuffle: False
pin_memory: True
persistent_workers: True

optimizer:
_target_: torch.optim.AdamW
lr: 1.0e-4
betas: [0.95, 0.999]
eps: 1.0e-8
weight_decay: 1.0e-6

training:
device: "cuda:0"
seed: 42
debug: False
resume: True
# optimization
lr_scheduler: cosine
lr_warmup_steps: 100
num_epochs: 600
gradient_accumulate_every: 1
# EMA destroys performance when used with BatchNorm
# replace BatchNorm with GroupNorm.
use_ema: True
freeze_encoder: False
# training loop control
# in epochs
rollout_every: 50
checkpoint_every: 50
val_every: 1
sample_every: 5
# steps per epoch
max_train_steps: null
max_val_steps: null
# misc
tqdm_interval_sec: 1.0

logging:
project: diffusion_policy_debug
resume: True
mode: online
name: ${now:%Y.%m.%d-%H.%M.%S}_${name}_${task_name}
tags: ["${name}", "${task_name}", "${exp_name}"]
id: null
group: null

checkpoint:
topk:
monitor_key: train_loss
mode: min
k: 5
format_str: 'epoch={epoch:04d}-train_loss={train_loss:.3f}.ckpt'
save_last_ckpt: True
save_last_snapshot: False

multi_run:
run_dir: data/outputs/${now:%Y.%m.%d}/${now:%H.%M.%S}_${name}_${task_name}
wandb_name_base: ${now:%Y.%m.%d-%H.%M.%S}_${name}_${task_name}

hydra:
job:
override_dirname: ${name}
run:
dir: data/outputs/${now:%Y.%m.%d}/${now:%H.%M.%S}_${name}_${task_name}
sweep:
dir: data/outputs/${now:%Y.%m.%d}/${now:%H.%M.%S}_${name}_${task_name}
subdir: ${hydra.job.num}
149 changes: 149 additions & 0 deletions diffusion_policy/config/train_real_pusht_pretrained_dinov2_base.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
defaults:
- _self_
- task: real_pusht_image

name: real_pusht_dinov2_base_preprocessing
_target_: diffusion_policy.workspace.train_diffusion_unet_image_workspace.TrainDiffusionUnetImageWorkspace

task_name: ${task.name}
shape_meta: ${task.shape_meta}
exp_name: "default"

horizon: 16
n_obs_steps: 2
n_action_steps: 8
n_latency_steps: 0
dataset_obs_steps: ${n_obs_steps}
past_action_visible: False
keypoint_visible_rate: 1.0
obs_as_global_cond: True

policy:
_target_: diffusion_policy.policy.diffusion_unet_image_policy.DiffusionUnetImagePolicy
shape_meta: ${shape_meta}
noise_scheduler:
_target_: diffusers.schedulers.scheduling_ddim.DDIMScheduler
num_train_timesteps: 100
beta_start: 0.0001
beta_end: 0.02
# beta_schedule is important
# this is the best we found
beta_schedule: squaredcos_cap_v2
clip_sample: True
set_alpha_to_one: True
steps_offset: 0
prediction_type: epsilon # or sample

obs_encoder:
_target_: diffusion_policy.model.vision.multi_image_obs_encoder.MultiImageObsEncoder
shape_meta: ${shape_meta}
rgb_model:
_target_: diffusion_policy.model.vision.model_getter.get_dinov2
name: facebook/dinov2-base
crop_shape: null
random_crop: False
use_group_norm: False
share_rgb_model: True
imagenet_norm: False
rgb_model_name: facebook/dinov2-base

horizon: ${horizon}
n_action_steps: ${eval:'${n_action_steps}+${n_latency_steps}'}
n_obs_steps: ${n_obs_steps}
num_inference_steps: 100
obs_as_global_cond: ${obs_as_global_cond}
# crop_shape: null
diffusion_step_embed_dim: 128
down_dims: [512, 1024, 2048]
kernel_size: 5
n_groups: 8
cond_predict_scale: True

# scheduler.step params
# predict_epsilon: True

ema:
_target_: diffusion_policy.model.diffusion.ema_model.EMAModel
update_after_step: 0
inv_gamma: 1.0
power: 0.75
min_value: 0.0
max_value: 0.9999

dataloader:
batch_size: 64
num_workers: 8
shuffle: True
pin_memory: True
persistent_workers: True

val_dataloader:
batch_size: 64
num_workers: 8
shuffle: False
pin_memory: True
persistent_workers: True

optimizer:
_target_: torch.optim.AdamW
lr: 1.0e-4
betas: [0.95, 0.999]
eps: 1.0e-8
weight_decay: 1.0e-6

training:
device: "cuda:0"
seed: 42
debug: False
resume: True
# optimization
lr_scheduler: cosine
lr_warmup_steps: 100
num_epochs: 600
gradient_accumulate_every: 1
# EMA destroys performance when used with BatchNorm
# replace BatchNorm with GroupNorm.
use_ema: True
freeze_encoder: True
# training loop control
# in epochs
rollout_every: 50
checkpoint_every: 50
val_every: 1
sample_every: 5
# steps per epoch
max_train_steps: null
max_val_steps: null
# misc
tqdm_interval_sec: 1.0

logging:
project: diffusion_policy_debug
resume: True
mode: online
name: ${now:%Y.%m.%d-%H.%M.%S}_${name}_${task_name}
tags: ["${name}", "${task_name}", "${exp_name}"]
id: null
group: null

checkpoint:
topk:
monitor_key: train_loss
mode: min
k: 5
format_str: 'epoch={epoch:04d}-train_loss={train_loss:.3f}.ckpt'
save_last_ckpt: True
save_last_snapshot: False

multi_run:
run_dir: data/outputs/${now:%Y.%m.%d}/${now:%H.%M.%S}_${name}_${task_name}
wandb_name_base: ${now:%Y.%m.%d-%H.%M.%S}_${name}_${task_name}

hydra:
job:
override_dirname: ${name}
run:
dir: data/outputs/${now:%Y.%m.%d}/${now:%H.%M.%S}_${name}_${task_name}
sweep:
dir: data/outputs/${now:%Y.%m.%d}/${now:%H.%M.%S}_${name}_${task_name}
subdir: ${hydra.job.num}
Loading