debug diffusion is_pad, enable EMA
这个提交包含在:
@ -65,7 +65,7 @@ class DiffusionPolicy(nn.Module):
|
|||||||
})
|
})
|
||||||
|
|
||||||
nets = nets.float().cuda()
|
nets = nets.float().cuda()
|
||||||
ENABLE_EMA = False
|
ENABLE_EMA = True
|
||||||
if ENABLE_EMA:
|
if ENABLE_EMA:
|
||||||
ema = EMAModel(model=nets, power=self.ema_power)
|
ema = EMAModel(model=nets, power=self.ema_power)
|
||||||
else:
|
else:
|
||||||
@ -125,7 +125,8 @@ class DiffusionPolicy(nn.Module):
|
|||||||
noise_pred = nets['policy']['noise_pred_net'](noisy_actions, timesteps, global_cond=obs_cond)
|
noise_pred = nets['policy']['noise_pred_net'](noisy_actions, timesteps, global_cond=obs_cond)
|
||||||
|
|
||||||
# L2 loss
|
# L2 loss
|
||||||
loss = F.mse_loss(noise_pred, noise)
|
all_l2 = F.mse_loss(noise_pred, noise, reduction='none')
|
||||||
|
loss = (all_l2 * ~is_pad.unsqueeze(-1)).mean()
|
||||||
|
|
||||||
loss_dict = {}
|
loss_dict = {}
|
||||||
loss_dict['l2_loss'] = loss
|
loss_dict['l2_loss'] = loss
|
||||||
|
|||||||
1
utils.py
1
utils.py
@ -93,6 +93,7 @@ class EpisodicDataset(torch.utils.data.Dataset):
|
|||||||
is_pad[action_len:] = 1
|
is_pad[action_len:] = 1
|
||||||
|
|
||||||
padded_action = padded_action[:self.chunk_size]
|
padded_action = padded_action[:self.chunk_size]
|
||||||
|
is_pad = is_pad[:self.chunk_size]
|
||||||
|
|
||||||
# new axis for different cameras
|
# new axis for different cameras
|
||||||
all_cam_images = []
|
all_cam_images = []
|
||||||
|
|||||||
在新工单中引用
屏蔽一个用户