add conv filter to EpisodicDataset in utils.py, save ckpt every 1000 steps
这个提交包含在:
@ -403,7 +403,7 @@ def train_bc(train_dataloader, val_dataloader, config):
|
||||
summary_string += f'{k}: {v.item():.3f} '
|
||||
print(summary_string)
|
||||
|
||||
if epoch % 100 == 0:
|
||||
if epoch % 1000 == 0:
|
||||
ckpt_path = os.path.join(ckpt_dir, f'policy_epoch_{epoch}_seed_{seed}.ckpt')
|
||||
torch.save(policy.state_dict(), ckpt_path)
|
||||
plot_history(train_history, validation_history, epoch, ckpt_dir, seed)
|
||||
|
||||
12
utils.py
12
utils.py
@ -28,7 +28,11 @@ class EpisodicDataset(torch.utils.data.Dataset):
|
||||
with h5py.File(dataset_path, 'r') as root:
|
||||
is_sim = root.attrs['sim']
|
||||
if '/base_action' in root:
|
||||
action = np.concatenate([root['/action'][()], root['/base_action'][()]], axis=-1)
|
||||
base_action = root['/base_action'][()]
|
||||
smoothed_base_action = np.stack([
|
||||
np.convolve(base_action[:, i], np.ones(20)/20, mode='same') for i in range(base_action.shape[1])
|
||||
], axis=-1, dtype=np.float32)
|
||||
action = np.concatenate([root['/action'][()], smoothed_base_action], axis=-1)
|
||||
else:
|
||||
action = root['/action'][()]
|
||||
original_action_shape = action.shape
|
||||
@ -89,7 +93,11 @@ def get_norm_stats(dataset_dir, num_episodes):
|
||||
with h5py.File(dataset_path, 'r') as root:
|
||||
qpos = root['/observations/qpos'][()]
|
||||
qvel = root['/observations/qvel'][()]
|
||||
action = np.concatenate([root['/action'][()], root['/base_action'][()]], axis=-1)
|
||||
base_action = root['/base_action'][()]
|
||||
smoothed_base_action = np.stack([
|
||||
np.convolve(base_action[:, i], np.ones(20)/20, mode='same') for i in range(base_action.shape[1])
|
||||
], axis=-1, dtype=np.float32)
|
||||
action = np.concatenate([root['/action'][()], smoothed_base_action], axis=-1)
|
||||
except:
|
||||
print(f'Error loading {dataset_path}')
|
||||
quit()
|
||||
|
||||
在新工单中引用
屏蔽一个用户