BonanDing commited on
Commit
537f6f3
·
1 Parent(s): f10b281

Update DeMemWM validation metrics and launchers

Browse files
algorithms/dememwm/df_video.py CHANGED
@@ -738,6 +738,7 @@ class DeMemWMMinecraft(DiffusionForcingBase):
738
  self.lpips_batch_size = getattr(cfg, "lpips_batch_size", 16)
739
  self.next_frame_length = getattr(cfg, "next_frame_length", 1)
740
  self.require_pose_prediction = getattr(cfg, "require_pose_prediction", False)
 
741
  self.log_per_frame_metrics = bool(getattr(cfg, "log_per_frame_metrics", False))
742
  self.log_revisit_metrics = bool(getattr(cfg, "log_revisit_metrics", False))
743
  self.log_memory_selection_sheet = bool(getattr(cfg, "log_memory_selection_sheet", False))
@@ -948,11 +949,18 @@ class DeMemWMMinecraft(DiffusionForcingBase):
948
  self._psnr_count = torch.tensor(0.0, device=self._metric_device)
949
  self._lpips_sum = torch.tensor(0.0, device=self._metric_device)
950
  self._lpips_count = torch.tensor(0.0, device=self._metric_device)
 
 
951
 
952
  if self.log_per_frame_metrics:
953
  self._frame_metric_eval_start = None
954
  for attr in ("mse_sum", "mse_count", "psnr_sum", "psnr_count", "lpips_sum", "lpips_count"):
955
  setattr(self, f"_frame_{attr}", torch.empty(0, device=self._metric_device))
 
 
 
 
 
956
  if self.log_revisit_metrics:
957
  self._reset_revisit_metric_accumulators()
958
 
@@ -960,6 +968,18 @@ class DeMemWMMinecraft(DiffusionForcingBase):
960
  base = Path(self.local_save_dir) if self.local_save_dir is not None else Path.cwd() / "eval_artifacts"
961
  return base / "metrics"
962
 
 
 
 
 
 
 
 
 
 
 
 
 
963
  def _memory_sheet_artifact_dir(self) -> Path:
964
  base = Path(self.local_save_dir) if self.local_save_dir is not None else Path.cwd() / "eval_artifacts"
965
  return base / "memory_selection_sheets"
@@ -1096,13 +1116,17 @@ class DeMemWMMinecraft(DiffusionForcingBase):
1096
  setattr(self, name, torch.cat([getattr(self, name), torch.zeros(pad, device=self._metric_device)]))
1097
 
1098
  def _sync_frame_metric_accumulators(self) -> None:
 
 
1099
  if not (dist.is_available() and dist.is_initialized()):
 
1100
  return
1101
  length = torch.tensor(int(self._frame_mse_sum.numel()), device=self._metric_device, dtype=torch.long)
1102
  dist.all_reduce(length, op=dist.ReduceOp.MAX)
1103
  self._pad_frame_metric_accumulators(int(length.item()))
1104
  for attr in ("mse_sum", "mse_count", "psnr_sum", "psnr_count", "lpips_sum", "lpips_count"):
1105
  dist.all_reduce(getattr(self, f"_frame_{attr}"), op=dist.ReduceOp.SUM)
 
1106
 
1107
  def _update_per_frame_metric_accumulators(
1108
  self,
@@ -1115,6 +1139,7 @@ class DeMemWMMinecraft(DiffusionForcingBase):
1115
  return
1116
  if not hasattr(self, "_frame_mse_sum"):
1117
  self._reset_metric_accumulators()
 
1118
 
1119
  frames = int(xs_pred.shape[0])
1120
  self._pad_frame_metric_accumulators(frames)
@@ -1149,6 +1174,100 @@ class DeMemWMMinecraft(DiffusionForcingBase):
1149
  self._frame_lpips_sum[frame_idx] += value * count
1150
  self._frame_lpips_count[frame_idx] += count
1151
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1152
  def _log_per_frame_metrics(self) -> None:
1153
  if not hasattr(self, "_frame_mse_sum"):
1154
  return
@@ -1187,6 +1306,71 @@ class DeMemWMMinecraft(DiffusionForcingBase):
1187
  writer.writeheader()
1188
  writer.writerows(rows)
1189
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1190
  def _revisit_gap_labels(self) -> list[tuple[str, int, int | None]]:
1191
  edges = [self.revisit_metrics_min_gap]
1192
  edges.extend(edge for edge in sorted(set(self.revisit_metrics_gap_bands)) if edge > self.revisit_metrics_min_gap)
@@ -1435,12 +1619,29 @@ class DeMemWMMinecraft(DiffusionForcingBase):
1435
  writer.writeheader()
1436
  writer.writerows(rows)
1437
 
1438
- def _update_metric_accumulators(self, xs_pred: torch.Tensor, xs_gt: torch.Tensor) -> None:
 
 
 
 
 
 
1439
  if not hasattr(self, "_metric_device"):
1440
  self._reset_metric_accumulators()
1441
 
 
 
 
 
1442
  xs_pred_device = xs_pred.to(self._metric_device)
1443
  xs_gt_device = xs_gt.to(self._metric_device)
 
 
 
 
 
 
 
1444
  metric_dict = get_validation_metrics_for_videos(
1445
  xs_pred_device,
1446
  xs_gt_device,
@@ -1488,6 +1689,8 @@ class DeMemWMMinecraft(DiffusionForcingBase):
1488
 
1489
  if self.log_per_frame_metrics:
1490
  self._log_per_frame_metrics()
 
 
1491
  if self.log_revisit_metrics:
1492
  self._log_revisit_metrics()
1493
 
@@ -1796,18 +1999,12 @@ class DeMemWMMinecraft(DiffusionForcingBase):
1796
  )
1797
 
1798
  metric_mask = None
1799
- if target_mask is None:
1800
- self._update_metric_accumulators(xs_pred_decode, xs_decode)
1801
- else:
1802
  metric_mask = rearrange(
1803
  target_mask[:, eval_start:target_length].to(device=xs_pred_decode.device),
1804
  "b t -> t b",
1805
  )
1806
- if metric_mask.any():
1807
- self._update_metric_accumulators(
1808
- xs_pred_decode[metric_mask].unsqueeze(1),
1809
- xs_decode[metric_mask].unsqueeze(1),
1810
- )
1811
  self._update_per_frame_metric_accumulators(xs_pred_decode, xs_decode, metric_mask, eval_start)
1812
  self._update_revisit_metric_accumulators(
1813
  xs_pred_decode,
 
738
  self.lpips_batch_size = getattr(cfg, "lpips_batch_size", 16)
739
  self.next_frame_length = getattr(cfg, "next_frame_length", 1)
740
  self.require_pose_prediction = getattr(cfg, "require_pose_prediction", False)
741
+ self.metric_report_segment = max(0, int(getattr(cfg, "metric_report_segment", 0) or 0))
742
  self.log_per_frame_metrics = bool(getattr(cfg, "log_per_frame_metrics", False))
743
  self.log_revisit_metrics = bool(getattr(cfg, "log_revisit_metrics", False))
744
  self.log_memory_selection_sheet = bool(getattr(cfg, "log_memory_selection_sheet", False))
 
949
  self._psnr_count = torch.tensor(0.0, device=self._metric_device)
950
  self._lpips_sum = torch.tensor(0.0, device=self._metric_device)
951
  self._lpips_count = torch.tensor(0.0, device=self._metric_device)
952
+ self._frame_metrics_synced = False
953
+ self._segment_metrics_synced = False
954
 
955
  if self.log_per_frame_metrics:
956
  self._frame_metric_eval_start = None
957
  for attr in ("mse_sum", "mse_count", "psnr_sum", "psnr_count", "lpips_sum", "lpips_count"):
958
  setattr(self, f"_frame_{attr}", torch.empty(0, device=self._metric_device))
959
+ if self.metric_report_segment > 0:
960
+ self._segment_metric_eval_start = None
961
+ self._segment_metric_frames = 0
962
+ for attr in ("mse_sum", "mse_count", "psnr_sum", "psnr_count", "lpips_sum", "lpips_count"):
963
+ setattr(self, f"_segment_{attr}", torch.empty(0, device=self._metric_device))
964
  if self.log_revisit_metrics:
965
  self._reset_revisit_metric_accumulators()
966
 
 
968
  base = Path(self.local_save_dir) if self.local_save_dir is not None else Path.cwd() / "eval_artifacts"
969
  return base / "metrics"
970
 
971
+ def _wandb_run_files_dir(self) -> Path | None:
972
+ logger = getattr(self, "logger", None)
973
+ experiment = None if logger is None else getattr(logger, "experiment", None)
974
+ run_dir = None if experiment is None else getattr(experiment, "dir", None)
975
+ return None if run_dir is None else Path(run_dir)
976
+
977
+ def _segment_metric_artifact_dir(self) -> Path:
978
+ run_dir = self._wandb_run_files_dir()
979
+ if run_dir is not None:
980
+ return run_dir / "metrics"
981
+ return self._eval_artifact_dir()
982
+
983
  def _memory_sheet_artifact_dir(self) -> Path:
984
  base = Path(self.local_save_dir) if self.local_save_dir is not None else Path.cwd() / "eval_artifacts"
985
  return base / "memory_selection_sheets"
 
1116
  setattr(self, name, torch.cat([getattr(self, name), torch.zeros(pad, device=self._metric_device)]))
1117
 
1118
  def _sync_frame_metric_accumulators(self) -> None:
1119
+ if getattr(self, "_frame_metrics_synced", False):
1120
+ return
1121
  if not (dist.is_available() and dist.is_initialized()):
1122
+ self._frame_metrics_synced = True
1123
  return
1124
  length = torch.tensor(int(self._frame_mse_sum.numel()), device=self._metric_device, dtype=torch.long)
1125
  dist.all_reduce(length, op=dist.ReduceOp.MAX)
1126
  self._pad_frame_metric_accumulators(int(length.item()))
1127
  for attr in ("mse_sum", "mse_count", "psnr_sum", "psnr_count", "lpips_sum", "lpips_count"):
1128
  dist.all_reduce(getattr(self, f"_frame_{attr}"), op=dist.ReduceOp.SUM)
1129
+ self._frame_metrics_synced = True
1130
 
1131
  def _update_per_frame_metric_accumulators(
1132
  self,
 
1139
  return
1140
  if not hasattr(self, "_frame_mse_sum"):
1141
  self._reset_metric_accumulators()
1142
+ self._frame_metrics_synced = False
1143
 
1144
  frames = int(xs_pred.shape[0])
1145
  self._pad_frame_metric_accumulators(frames)
 
1174
  self._frame_lpips_sum[frame_idx] += value * count
1175
  self._frame_lpips_count[frame_idx] += count
1176
 
1177
+ def _pad_segment_metric_accumulators(self, length: int) -> None:
1178
+ current = int(self._segment_mse_sum.numel())
1179
+ if current >= int(length):
1180
+ return
1181
+ pad = int(length) - current
1182
+ for attr in ("mse_sum", "mse_count", "psnr_sum", "psnr_count", "lpips_sum", "lpips_count"):
1183
+ name = f"_segment_{attr}"
1184
+ setattr(self, name, torch.cat([getattr(self, name), torch.zeros(pad, device=self._metric_device)]))
1185
+
1186
+ def _sync_segment_metric_accumulators(self) -> None:
1187
+ if getattr(self, "_segment_metrics_synced", False):
1188
+ return
1189
+ if not (dist.is_available() and dist.is_initialized()):
1190
+ self._segment_metrics_synced = True
1191
+ return
1192
+ length = torch.tensor(int(self._segment_mse_sum.numel()), device=self._metric_device, dtype=torch.long)
1193
+ frames = torch.tensor(int(getattr(self, "_segment_metric_frames", 0)), device=self._metric_device, dtype=torch.long)
1194
+ dist.all_reduce(length, op=dist.ReduceOp.MAX)
1195
+ dist.all_reduce(frames, op=dist.ReduceOp.MAX)
1196
+ self._segment_metric_frames = int(frames.item())
1197
+ self._pad_segment_metric_accumulators(int(length.item()))
1198
+ for attr in ("mse_sum", "mse_count", "psnr_sum", "psnr_count", "lpips_sum", "lpips_count"):
1199
+ dist.all_reduce(getattr(self, f"_segment_{attr}"), op=dist.ReduceOp.SUM)
1200
+ self._segment_metrics_synced = True
1201
+
1202
+ def _update_segment_metric_accumulators(
1203
+ self,
1204
+ xs_pred: torch.Tensor,
1205
+ xs_gt: torch.Tensor,
1206
+ valid_mask: torch.Tensor | None,
1207
+ eval_start: int,
1208
+ ) -> None:
1209
+ if self.metric_report_segment <= 0 or xs_pred.numel() == 0:
1210
+ return
1211
+ if not hasattr(self, "_segment_mse_sum"):
1212
+ self._reset_metric_accumulators()
1213
+ self._segment_metrics_synced = False
1214
+
1215
+ frames = int(xs_pred.shape[0])
1216
+ segment = int(self.metric_report_segment)
1217
+ num_segments = (frames + segment - 1) // segment
1218
+ self._pad_segment_metric_accumulators(num_segments)
1219
+ self._segment_metric_frames = max(int(getattr(self, "_segment_metric_frames", 0)), frames)
1220
+ if self._segment_metric_eval_start is None:
1221
+ self._segment_metric_eval_start = int(eval_start)
1222
+
1223
+ pred = torch.clamp(xs_pred.to(self._metric_device).float(), 0.0, 1.0)
1224
+ gt = torch.clamp(xs_gt.to(self._metric_device).float(), 0.0, 1.0)
1225
+ mask = torch.ones(pred.shape[:2], device=self._metric_device, dtype=torch.bool)
1226
+ if valid_mask is not None:
1227
+ mask = valid_mask.to(device=self._metric_device, dtype=torch.bool)
1228
+
1229
+ frame_mse = (pred - gt).square().flatten(start_dim=2).mean(dim=2)
1230
+ frame_psnr = 10.0 * torch.log10(1.0 / frame_mse.clamp_min(torch.finfo(frame_mse.dtype).eps))
1231
+ lpips_batch_size = max(1, int(self.lpips_batch_size))
1232
+
1233
+ for segment_idx in range(num_segments):
1234
+ start = segment_idx * segment
1235
+ end = min(start + segment, frames)
1236
+ segment_mask = mask[start:end]
1237
+ count = int(segment_mask.sum().item())
1238
+ if count == 0:
1239
+ continue
1240
+
1241
+ mask_f = segment_mask.to(dtype=frame_mse.dtype)
1242
+ mse_sum = (frame_mse[start:end] * mask_f).sum()
1243
+ psnr_sum = (frame_psnr[start:end] * mask_f).sum()
1244
+ count_t = torch.tensor(float(count), device=self._metric_device)
1245
+ pred_segment = pred[start:end][segment_mask]
1246
+ gt_segment = gt[start:end][segment_mask]
1247
+
1248
+ self.validation_lpips_model.reset()
1249
+ for batch_start in range(0, count, lpips_batch_size):
1250
+ batch_end = min(batch_start + lpips_batch_size, count)
1251
+ self.validation_lpips_model.update(pred_segment[batch_start:batch_end], gt_segment[batch_start:batch_end])
1252
+ lpips = self.validation_lpips_model.compute().detach().to(self._metric_device)
1253
+ self.validation_lpips_model.reset()
1254
+
1255
+ self._segment_mse_sum[segment_idx] += mse_sum
1256
+ self._segment_mse_count[segment_idx] += count_t
1257
+ self._segment_psnr_sum[segment_idx] += psnr_sum
1258
+ self._segment_psnr_count[segment_idx] += count_t
1259
+ self._segment_lpips_sum[segment_idx] += lpips * count_t
1260
+ self._segment_lpips_count[segment_idx] += count_t
1261
+
1262
+ # Segment mode derives global metrics from this same pass to avoid
1263
+ # running LPIPS once for the whole rollout and again per segment.
1264
+ self._mse_sum += mse_sum
1265
+ self._mse_count += count_t
1266
+ self._psnr_sum += psnr_sum
1267
+ self._psnr_count += count_t
1268
+ self._lpips_sum += lpips * count_t
1269
+ self._lpips_count += count_t
1270
+
1271
  def _log_per_frame_metrics(self) -> None:
1272
  if not hasattr(self, "_frame_mse_sum"):
1273
  return
 
1306
  writer.writeheader()
1307
  writer.writerows(rows)
1308
 
1309
+ def _log_metric_segments(self) -> None:
1310
+ if self.metric_report_segment <= 0 or not hasattr(self, "_segment_mse_sum"):
1311
+ return
1312
+ self._sync_segment_metric_accumulators()
1313
+ valid = self._segment_mse_count > 0
1314
+ if not bool(valid.any()):
1315
+ return
1316
+
1317
+ segment = int(self.metric_report_segment)
1318
+ eval_start = 0 if self._segment_metric_eval_start is None else int(self._segment_metric_eval_start)
1319
+ rows = []
1320
+ log_dict = {}
1321
+ total_generated = int(getattr(self, "_segment_metric_frames", self._segment_mse_count.numel() * segment))
1322
+ for segment_idx in torch.nonzero(valid, as_tuple=False).flatten().tolist():
1323
+ start = int(segment_idx) * segment
1324
+ end = min(start + segment, total_generated)
1325
+ label = f"{start:04d}_{end:04d}"
1326
+ mse = self._mean_or_nan_tensor(self._segment_mse_sum[segment_idx], self._segment_mse_count[segment_idx])
1327
+ psnr = self._mean_or_nan_tensor(self._segment_psnr_sum[segment_idx], self._segment_psnr_count[segment_idx])
1328
+ lpips = self._mean_or_nan_tensor(self._segment_lpips_sum[segment_idx], self._segment_lpips_count[segment_idx])
1329
+ generation_length = end - start
1330
+ log_dict[f"segment/mse_{label}"] = mse
1331
+ log_dict[f"segment/psnr_{label}"] = psnr
1332
+ log_dict[f"segment/lpips_{label}"] = lpips
1333
+ log_dict[f"segment/generation_length_{label}"] = torch.tensor(float(generation_length), device=self._metric_device)
1334
+ rows.append(
1335
+ {
1336
+ "generation_start": start,
1337
+ "generation_end": end,
1338
+ "generation_length": generation_length,
1339
+ "absolute_start": eval_start + start,
1340
+ "absolute_end": eval_start + end,
1341
+ "mse": float(mse.detach().cpu().item()),
1342
+ "psnr": float(psnr.detach().cpu().item()),
1343
+ "lpips": float(lpips.detach().cpu().item()),
1344
+ "count": float(self._segment_mse_count[segment_idx].detach().cpu().item()),
1345
+ }
1346
+ )
1347
+ self.log_dict(log_dict, sync_dist=False)
1348
+ if self._is_global_rank_zero():
1349
+ output_path = self._segment_metric_artifact_dir() / f"segment_metrics_step{int(getattr(self, 'global_step', 0)):08d}.csv"
1350
+ output_path.parent.mkdir(parents=True, exist_ok=True)
1351
+ with output_path.open("w", newline="", encoding="utf-8") as handle:
1352
+ writer = csv.DictWriter(handle, fieldnames=list(rows[0].keys()))
1353
+ writer.writeheader()
1354
+ writer.writerows(rows)
1355
+ logger = getattr(self, "logger", None)
1356
+ if logger is not None:
1357
+ import wandb
1358
+
1359
+ columns = list(rows[0].keys())
1360
+ experiment = logger.experiment
1361
+ experiment.log(
1362
+ {
1363
+ "segment_metrics/table": wandb.Table(
1364
+ columns=columns,
1365
+ data=[[row[column] for column in columns] for row in rows],
1366
+ ),
1367
+ "trainer/global_step": int(getattr(self, "global_step", 0)),
1368
+ }
1369
+ )
1370
+ save_fn = getattr(experiment, "save", None)
1371
+ if callable(save_fn):
1372
+ save_fn(str(output_path), policy="now")
1373
+
1374
  def _revisit_gap_labels(self) -> list[tuple[str, int, int | None]]:
1375
  edges = [self.revisit_metrics_min_gap]
1376
  edges.extend(edge for edge in sorted(set(self.revisit_metrics_gap_bands)) if edge > self.revisit_metrics_min_gap)
 
1619
  writer.writeheader()
1620
  writer.writerows(rows)
1621
 
1622
+ def _update_metric_accumulators(
1623
+ self,
1624
+ xs_pred: torch.Tensor,
1625
+ xs_gt: torch.Tensor,
1626
+ valid_mask: torch.Tensor | None = None,
1627
+ eval_start: int = 0,
1628
+ ) -> None:
1629
  if not hasattr(self, "_metric_device"):
1630
  self._reset_metric_accumulators()
1631
 
1632
+ if self.metric_report_segment > 0:
1633
+ self._update_segment_metric_accumulators(xs_pred, xs_gt, valid_mask, eval_start)
1634
+ return
1635
+
1636
  xs_pred_device = xs_pred.to(self._metric_device)
1637
  xs_gt_device = xs_gt.to(self._metric_device)
1638
+ if valid_mask is not None:
1639
+ valid_mask = valid_mask.to(device=self._metric_device, dtype=torch.bool)
1640
+ if not bool(valid_mask.any()):
1641
+ return
1642
+ xs_pred_device = xs_pred_device[valid_mask].unsqueeze(1)
1643
+ xs_gt_device = xs_gt_device[valid_mask].unsqueeze(1)
1644
+
1645
  metric_dict = get_validation_metrics_for_videos(
1646
  xs_pred_device,
1647
  xs_gt_device,
 
1689
 
1690
  if self.log_per_frame_metrics:
1691
  self._log_per_frame_metrics()
1692
+ if self.metric_report_segment > 0:
1693
+ self._log_metric_segments()
1694
  if self.log_revisit_metrics:
1695
  self._log_revisit_metrics()
1696
 
 
1999
  )
2000
 
2001
  metric_mask = None
2002
+ if target_mask is not None:
 
 
2003
  metric_mask = rearrange(
2004
  target_mask[:, eval_start:target_length].to(device=xs_pred_decode.device),
2005
  "b t -> t b",
2006
  )
2007
+ self._update_metric_accumulators(xs_pred_decode, xs_decode, metric_mask, eval_start)
 
 
 
 
2008
  self._update_per_frame_metric_accumulators(xs_pred_decode, xs_decode, metric_mask, eval_start)
2009
  self._update_revisit_metric_accumulators(
2010
  xs_pred_decode,
configurations/algorithm/dememwm_base.yaml CHANGED
@@ -39,6 +39,8 @@ ref_mode: sequential
39
  focal_length: 0.35
40
  log_video: false
41
  save_local: true
 
 
42
  require_pose_prediction: false
43
 
44
  # training hyperparameters
 
39
  focal_length: 0.35
40
  log_video: false
41
  save_local: true
42
+ # 0 disables segment metrics; 100 logs generated-frame windows [0,100), [100,200), ...
43
+ metric_report_segment: 0
44
  require_pose_prediction: false
45
 
46
  # training hyperparameters
configurations/experiment/base_pytorch.yaml CHANGED
@@ -26,6 +26,7 @@ training:
26
  every_n_train_steps: 5000 # save a checkpoint every n train steps
27
  every_n_epochs: null # mutually exclusive with ``every_n_train_steps`` and ``train_time_interval``
28
  train_time_interval: null # in format of "00:12:00:00", mutually exclusive with ``every_n_train_steps`` and ``every_n_epochs``.
 
29
  enable_version_counter: False # If this is ``False``, later checkpoint will be overwrite previous ones.
30
 
31
  validation:
 
26
  every_n_train_steps: 5000 # save a checkpoint every n train steps
27
  every_n_epochs: null # mutually exclusive with ``every_n_train_steps`` and ``train_time_interval``
28
  train_time_interval: null # in format of "00:12:00:00", mutually exclusive with ``every_n_train_steps`` and ``every_n_epochs``.
29
+ save_last_k: null # repo extension: if set, keep only the latest k step checkpoints.
30
  enable_version_counter: False # If this is ``False``, later checkpoint will be overwrite previous ones.
31
 
32
  validation:
experiments/exp_base.py CHANGED
@@ -33,6 +33,41 @@ from huggingface_hub import model_info
33
 
34
  torch.set_float32_matmul_precision("high")
35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  def is_huggingface_model(path: str) -> bool:
37
  hf_ckpt = str(path).split('/')
38
  repo_id = '/'.join(hf_ckpt[:2])
@@ -404,12 +439,17 @@ class BaseLightningExperiment(BaseExperiment):
404
  if self.logger:
405
  callbacks.append(LearningRateMonitor("step", True))
406
  if "checkpointing" in self.cfg.training:
 
 
 
 
 
407
  callbacks.append(
408
- ModelCheckpoint(
409
  pathlib.Path(hydra.core.hydra_config.HydraConfig.get()["runtime"]["output_dir"]) / "checkpoints",
410
  filename="epoch{epoch}_step{step}",
411
  auto_insert_metric_name=False,
412
- **self.cfg.training.checkpointing,
413
  )
414
  )
415
  return callbacks
 
33
 
34
  torch.set_float32_matmul_precision("high")
35
 
36
+
37
+ class LastKStepModelCheckpoint(ModelCheckpoint):
38
+ """ModelCheckpoint variant that keeps only the latest k step checkpoints."""
39
+
40
+ def __init__(self, *args, save_last_k: Optional[int] = None, **kwargs):
41
+ self._save_last_k = None
42
+ if save_last_k is not None:
43
+ self._save_last_k = int(save_last_k)
44
+ if self._save_last_k < 1:
45
+ raise ValueError("save_last_k must be a positive integer")
46
+ # Lightning needs save-all mode here; this subclass prunes by step after each save.
47
+ kwargs["save_top_k"] = -1
48
+ super().__init__(*args, **kwargs)
49
+
50
+ def _save_checkpoint(self, trainer: "pl.Trainer", filepath: str) -> None:
51
+ super()._save_checkpoint(trainer, filepath)
52
+ self._prune_old_step_checkpoints(trainer)
53
+
54
+ def _prune_old_step_checkpoints(self, trainer: "pl.Trainer") -> None:
55
+ if self._save_last_k is None or self.dirpath is None:
56
+ return
57
+
58
+ checkpoint_dir = pathlib.Path(self.dirpath)
59
+ if not checkpoint_dir.exists():
60
+ return
61
+
62
+ step_checkpoints = []
63
+ for checkpoint_path in checkpoint_dir.glob("*.ckpt"):
64
+ match = re.search(r"(?:^|[_=-])step[=_]?(\d+)", checkpoint_path.stem)
65
+ if match:
66
+ step_checkpoints.append((int(match.group(1)), checkpoint_path.name, str(checkpoint_path)))
67
+
68
+ for _, _, checkpoint_path in sorted(step_checkpoints)[:-self._save_last_k]:
69
+ self._remove_checkpoint(trainer, checkpoint_path)
70
+
71
  def is_huggingface_model(path: str) -> bool:
72
  hf_ckpt = str(path).split('/')
73
  repo_id = '/'.join(hf_ckpt[:2])
 
439
  if self.logger:
440
  callbacks.append(LearningRateMonitor("step", True))
441
  if "checkpointing" in self.cfg.training:
442
+ checkpointing_cfg = dict(self.cfg.training.checkpointing)
443
+ save_last_k = checkpointing_cfg.pop("save_last_k", None)
444
+ checkpoint_cls = LastKStepModelCheckpoint if save_last_k is not None else ModelCheckpoint
445
+ if save_last_k is not None:
446
+ checkpointing_cfg["save_last_k"] = save_last_k
447
  callbacks.append(
448
+ checkpoint_cls(
449
  pathlib.Path(hydra.core.hydra_config.HydraConfig.get()["runtime"]["output_dir"]) / "checkpoints",
450
  filename="epoch{epoch}_step{step}",
451
  auto_insert_metric_name=False,
452
+ **checkpointing_cfg,
453
  )
454
  )
455
  return callbacks
train_dememwm_curric_base_recent_8a100_berzelius.sh DELETED
@@ -1,93 +0,0 @@
1
- #!/usr/bin/env bash
2
- #SBATCH --job-name=dememwm-curric-base-recent-8a100
3
- #SBATCH --nodes=1
4
- #SBATCH --ntasks-per-node=8
5
- #SBATCH --cpus-per-task=8
6
- #SBATCH --time=72:00:00
7
- #SBATCH --output=slurm_logs/dememwm-curric-base-recent-8a100-%j.out
8
- #SBATCH --error=slurm_logs/dememwm-curric-base-recent-8a100-%j.out
9
- #SBATCH --account=berzelius-2025-436
10
- #SBATCH --gres=gpu:A100-SXM4-80GB:8
11
- #SBATCH --chdir=/proj/cvl/users/x_fahkh2/DeMemWM
12
-
13
- set -eo pipefail
14
-
15
- module load buildenv-gcccuda/12.1.1-gcc12.3.0
16
- source $(conda info --base)/etc/profile.d/conda.sh
17
-
18
- export PYTHONPATH="./:${PYTHONPATH:-}"
19
- export HF_HOME=/proj/cvl/users/x_fahkh2/caches
20
- export TORCH_HOME=/proj/cvl/users/x_fahkh2/caches
21
- export PIP_CACHE_DIR=/proj/cvl/users/x_fahkh2/caches
22
- export TMPDIR=/proj/cvl/users/x_fahkh2/caches
23
- export TRITON_CACHE_DIR=/proj/cvl/users/x_fahkh2/caches
24
- export CUDA_HOME=$CUDA_ROOT
25
- export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
26
- export WANDB_DISABLED=true
27
- export HYDRA_FULL_ERROR=1
28
-
29
- git checkout main
30
-
31
- RUN_NAME=train_dememwm_curric_base_recent_a2d4r2_route_ntok8_8a100_bs8_global64_400k
32
- OUTPUT_DIR=/proj/cvl/users/x_fahkh2/DeMemWM/results/${RUN_NAME}
33
- CURRICULUM='{enabled:true,stages:[{name:no_updown,until_step:120000,dataset:{wo_updown:true}},{name:with_updown,until_step:400000,dataset:{wo_updown:false}}]}'
34
-
35
- srun python -m main \
36
- +name=${RUN_NAME} \
37
- +output_dir=$OUTPUT_DIR/ \
38
- auto_resume=true \
39
- wandb.mode=offline \
40
- "experiment.tasks=[training]" \
41
- algorithm=dememwm_base \
42
- +customized_load=true \
43
- +seperate_load=true \
44
- +diffusion_model_path=/proj/cvl/users/x_fahkh2/WorldMem_Repro/checkpoints/oasis500m.safetensors \
45
- +vae_path=/proj/cvl/users/x_fahkh2/WorldMem_Repro/checkpoints/vit-l-20.safetensors \
46
- dataset=video_minecraft_dememwm_latent \
47
- dataset.save_dir=/proj/cvl/users/x_fahkh2/WorldMem_Repro/datasets/minecraft \
48
- dataset.precomputed_feature_dir=/proj/cvl/users/x_fahkh2/WorldMem_Repro/datasets/minecraft/vae_features \
49
- dataset.n_frames=8 \
50
- dataset.n_frames_valid=700 \
51
- dataset.context_length=100 \
52
- dataset.single_eval_clip=true \
53
- dataset.memory_selection.enabled=true \
54
- dataset.memory_selection.max_anchor_frames=2 \
55
- dataset.memory_selection.max_dynamic_frames=4 \
56
- dataset.memory_selection.max_revisit_frames=2 \
57
- dataset.memory_selection.pose_similarity_threshold=0.6 \
58
- dataset.memory_selection.training_use_plucker=true \
59
- dataset.memory_selection.training_plucker_weight=1.0 \
60
- dataset.memory_selection.fov_overlap_threshold=0.6 \
61
- dataset.memory_selection.min_total_selected_coverage=0.1 \
62
- dataset.memory_selection.local_context_exclusion_frames=8 \
63
- dataset.memory_selection.anchor_diverse_selection=true \
64
- +dataset.memory_selection.pose_preselect_topk=64 \
65
- +dataset.memory_selection.candidate_chunk_size=64 \
66
- dataset.memory_selection.dynamic.selection_policy=recent \
67
- algorithm.n_tokens=8 \
68
- algorithm.context_frames=600 \
69
- algorithm.chunk_size=1 \
70
- algorithm.warmup_steps=10000 \
71
- algorithm.trainability.train_full_dit=true \
72
- algorithm.trainability.full_dit_start_step=40000 \
73
- algorithm.trainability.lr.memory_modules=4.0e-5 \
74
- algorithm.trainability.lr.base_dit=1.0e-5 \
75
- algorithm.log_video=true \
76
- algorithm.save_local=true \
77
- algorithm.diffusion.sampling_timesteps=20 \
78
- algorithm.noise_route.anchor=high \
79
- algorithm.noise_route.dynamic=low \
80
- algorithm.noise_route.revisit=all \
81
- algorithm.memory_noise.enabled=true \
82
- algorithm.memory_noise.mode=random_cleaner_fraction \
83
- algorithm.memory_noise.anchor_max_fraction=0.25 \
84
- algorithm.memory_noise.dynamic_max_fraction=0.50 \
85
- algorithm.memory_noise.revisit_max_fraction=0.25 \
86
- "experiment.training.curriculum=${CURRICULUM}" \
87
- experiment.training.batch_size=8 \
88
- experiment.training.optim.accumulate_grad_batches=1 \
89
- experiment.validation.batch_size=1 \
90
- experiment.validation.limit_batch=1 \
91
- experiment.training.checkpointing.every_n_train_steps=5000 \
92
- experiment.validation.val_every_n_step=5000 \
93
- experiment.training.max_steps=400000
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
train_dememwm_curric_base_recent_8h200_berzelius.sh DELETED
@@ -1,93 +0,0 @@
1
- #!/usr/bin/env bash
2
- #SBATCH --job-name=dememwm-curric-base-recent-8h200
3
- #SBATCH --nodes=1
4
- #SBATCH --ntasks-per-node=8
5
- #SBATCH --cpus-per-task=8
6
- #SBATCH --time=72:00:00
7
- #SBATCH --output=slurm_logs/dememwm-curric-base-recent-8h200-%j.out
8
- #SBATCH --error=slurm_logs/dememwm-curric-base-recent-8h200-%j.out
9
- #SBATCH --account=berzelius-2025-436
10
- #SBATCH --gres=gpu:8
11
- #SBATCH --chdir=/proj/cvl/users/x_fahkh2/DeMemWM
12
-
13
- set -eo pipefail
14
-
15
- module load buildenv-gcccuda/12.9.1-gcc11
16
- source $(conda info --base)/etc/profile.d/conda.sh
17
-
18
- export PYTHONPATH="./:${PYTHONPATH:-}"
19
- export HF_HOME=/proj/cvl/users/x_fahkh2/caches
20
- export TORCH_HOME=/proj/cvl/users/x_fahkh2/caches
21
- export PIP_CACHE_DIR=/proj/cvl/users/x_fahkh2/caches
22
- export TMPDIR=/proj/cvl/users/x_fahkh2/caches
23
- export TRITON_CACHE_DIR=/proj/cvl/users/x_fahkh2/caches
24
- export CUDA_HOME=$CUDA_ROOT
25
- export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
26
- export WANDB_DISABLED=true
27
- export HYDRA_FULL_ERROR=1
28
-
29
- git checkout main
30
-
31
- RUN_NAME=train_dememwm_curric_base_recent_a2d4r2_route_ntok8_8h200_bs16_global128_200k
32
- OUTPUT_DIR=/proj/cvl/users/x_fahkh2/DeMemWM/results/${RUN_NAME}
33
- CURRICULUM='{enabled:true,stages:[{name:no_updown,until_step:60000,dataset:{wo_updown:true}},{name:with_updown,until_step:200000,dataset:{wo_updown:false}}]}'
34
-
35
- srun python -m main \
36
- +name=${RUN_NAME} \
37
- +output_dir=$OUTPUT_DIR/ \
38
- auto_resume=true \
39
- wandb.mode=offline \
40
- "experiment.tasks=[training]" \
41
- algorithm=dememwm_base \
42
- +customized_load=true \
43
- +seperate_load=true \
44
- +diffusion_model_path=/proj/cvl/users/x_fahkh2/WorldMem_Repro/checkpoints/oasis500m.safetensors \
45
- +vae_path=/proj/cvl/users/x_fahkh2/WorldMem_Repro/checkpoints/vit-l-20.safetensors \
46
- dataset=video_minecraft_dememwm_latent \
47
- dataset.save_dir=/proj/cvl/users/x_fahkh2/WorldMem_Repro/datasets/minecraft \
48
- dataset.precomputed_feature_dir=/proj/cvl/users/x_fahkh2/WorldMem_Repro/datasets/minecraft/vae_features \
49
- dataset.n_frames=8 \
50
- dataset.n_frames_valid=700 \
51
- dataset.context_length=100 \
52
- dataset.single_eval_clip=true \
53
- dataset.memory_selection.enabled=true \
54
- dataset.memory_selection.max_anchor_frames=2 \
55
- dataset.memory_selection.max_dynamic_frames=4 \
56
- dataset.memory_selection.max_revisit_frames=2 \
57
- dataset.memory_selection.pose_similarity_threshold=0.6 \
58
- dataset.memory_selection.training_use_plucker=true \
59
- dataset.memory_selection.training_plucker_weight=1.0 \
60
- dataset.memory_selection.fov_overlap_threshold=0.6 \
61
- dataset.memory_selection.min_total_selected_coverage=0.1 \
62
- dataset.memory_selection.local_context_exclusion_frames=8 \
63
- dataset.memory_selection.anchor_diverse_selection=true \
64
- +dataset.memory_selection.pose_preselect_topk=64 \
65
- +dataset.memory_selection.candidate_chunk_size=64 \
66
- dataset.memory_selection.dynamic.selection_policy=recent \
67
- algorithm.n_tokens=8 \
68
- algorithm.context_frames=600 \
69
- algorithm.chunk_size=1 \
70
- algorithm.warmup_steps=5000 \
71
- algorithm.trainability.train_full_dit=true \
72
- algorithm.trainability.full_dit_start_step=20000 \
73
- algorithm.trainability.lr.memory_modules=8.0e-5 \
74
- algorithm.trainability.lr.base_dit=2.0e-5 \
75
- algorithm.log_video=true \
76
- algorithm.save_local=true \
77
- algorithm.diffusion.sampling_timesteps=20 \
78
- algorithm.noise_route.anchor=high \
79
- algorithm.noise_route.dynamic=low \
80
- algorithm.noise_route.revisit=all \
81
- algorithm.memory_noise.enabled=true \
82
- algorithm.memory_noise.mode=random_cleaner_fraction \
83
- algorithm.memory_noise.anchor_max_fraction=0.25 \
84
- algorithm.memory_noise.dynamic_max_fraction=0.50 \
85
- algorithm.memory_noise.revisit_max_fraction=0.25 \
86
- "experiment.training.curriculum=${CURRICULUM}" \
87
- experiment.training.batch_size=16 \
88
- experiment.training.optim.accumulate_grad_batches=1 \
89
- experiment.validation.batch_size=1 \
90
- experiment.validation.limit_batch=1 \
91
- experiment.training.checkpointing.every_n_train_steps=5000 \
92
- experiment.validation.val_every_n_step=5000 \
93
- experiment.training.max_steps=200000
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
train_dememwm_curric_event_trigger_8a100_berzelius.sh CHANGED
@@ -1,11 +1,11 @@
1
  #!/usr/bin/env bash
2
- #SBATCH --job-name=dememwm-curric-event-8a100
3
  #SBATCH --nodes=1
4
  #SBATCH --ntasks-per-node=8
5
  #SBATCH --cpus-per-task=8
6
  #SBATCH --time=72:00:00
7
- #SBATCH --output=slurm_logs/dememwm-curric-event-8a100-%j.out
8
- #SBATCH --error=slurm_logs/dememwm-curric-event-8a100-%j.out
9
  #SBATCH --account=berzelius-2025-436
10
  #SBATCH --gres=gpu:A100-SXM4-80GB:8
11
  #SBATCH --chdir=/proj/cvl/users/x_fahkh2/DeMemWM
@@ -23,12 +23,11 @@ export TMPDIR=/proj/cvl/users/x_fahkh2/caches
23
  export TRITON_CACHE_DIR=/proj/cvl/users/x_fahkh2/caches
24
  export CUDA_HOME=$CUDA_ROOT
25
  export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
26
- export WANDB_DISABLED=true
27
  export HYDRA_FULL_ERROR=1
28
 
29
  git checkout main
30
 
31
- RUN_NAME=train_dememwm_curric_event_trigger_a2d4r2_route_ntok8_8a100_bs8_global64_400k
32
  OUTPUT_DIR=/proj/cvl/users/x_fahkh2/DeMemWM/results/${RUN_NAME}
33
  CURRICULUM='{enabled:true,stages:[{name:no_updown,until_step:120000,dataset:{wo_updown:true}},{name:with_updown,until_step:400000,dataset:{wo_updown:false}}]}'
34
 
@@ -47,10 +46,11 @@ srun python -m main \
47
  dataset.save_dir=/proj/cvl/users/x_fahkh2/WorldMem_Repro/datasets/minecraft \
48
  dataset.precomputed_feature_dir=/proj/cvl/users/x_fahkh2/WorldMem_Repro/datasets/minecraft/vae_features \
49
  dataset.n_frames=8 \
50
- dataset.n_frames_valid=700 \
51
  dataset.context_length=100 \
52
  dataset.single_eval_clip=true \
53
  dataset.memory_selection.enabled=true \
 
54
  dataset.memory_selection.max_anchor_frames=2 \
55
  dataset.memory_selection.max_dynamic_frames=4 \
56
  dataset.memory_selection.max_revisit_frames=2 \
@@ -66,6 +66,7 @@ srun python -m main \
66
  dataset.memory_selection.dynamic.selection_policy=event_triggered \
67
  algorithm.n_tokens=8 \
68
  algorithm.context_frames=600 \
 
69
  algorithm.chunk_size=1 \
70
  algorithm.warmup_steps=10000 \
71
  algorithm.trainability.train_full_dit=true \
@@ -80,14 +81,15 @@ srun python -m main \
80
  algorithm.noise_route.revisit=all \
81
  algorithm.memory_noise.enabled=true \
82
  algorithm.memory_noise.mode=random_cleaner_fraction \
83
- algorithm.memory_noise.anchor_max_fraction=0.25 \
84
- algorithm.memory_noise.dynamic_max_fraction=0.50 \
85
  algorithm.memory_noise.revisit_max_fraction=0.25 \
86
  "experiment.training.curriculum=${CURRICULUM}" \
87
  experiment.training.batch_size=8 \
88
  experiment.training.optim.accumulate_grad_batches=1 \
89
  experiment.validation.batch_size=1 \
90
  experiment.validation.limit_batch=1 \
91
- experiment.training.checkpointing.every_n_train_steps=5000 \
92
- experiment.validation.val_every_n_step=5000 \
 
93
  experiment.training.max_steps=400000
 
1
  #!/usr/bin/env bash
2
+ #SBATCH --job-name=dememwm-curric-event-anchorclean-causal-8a100
3
  #SBATCH --nodes=1
4
  #SBATCH --ntasks-per-node=8
5
  #SBATCH --cpus-per-task=8
6
  #SBATCH --time=72:00:00
7
+ #SBATCH --output=slurm_logs/dememwm-curric-event-anchorclean-causal-8a100-%j.out
8
+ #SBATCH --error=slurm_logs/dememwm-curric-event-anchorclean-causal-8a100-%j.out
9
  #SBATCH --account=berzelius-2025-436
10
  #SBATCH --gres=gpu:A100-SXM4-80GB:8
11
  #SBATCH --chdir=/proj/cvl/users/x_fahkh2/DeMemWM
 
23
  export TRITON_CACHE_DIR=/proj/cvl/users/x_fahkh2/caches
24
  export CUDA_HOME=$CUDA_ROOT
25
  export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
 
26
  export HYDRA_FULL_ERROR=1
27
 
28
  git checkout main
29
 
30
+ RUN_NAME=train_dememwm_curric_event_trigger_anchorclean_causal_a2d4r2_route_ntok8_8a100_bs8_global64_400k
31
  OUTPUT_DIR=/proj/cvl/users/x_fahkh2/DeMemWM/results/${RUN_NAME}
32
  CURRICULUM='{enabled:true,stages:[{name:no_updown,until_step:120000,dataset:{wo_updown:true}},{name:with_updown,until_step:400000,dataset:{wo_updown:false}}]}'
33
 
 
46
  dataset.save_dir=/proj/cvl/users/x_fahkh2/WorldMem_Repro/datasets/minecraft \
47
  dataset.precomputed_feature_dir=/proj/cvl/users/x_fahkh2/WorldMem_Repro/datasets/minecraft/vae_features \
48
  dataset.n_frames=8 \
49
+ dataset.n_frames_valid=1100 \
50
  dataset.context_length=100 \
51
  dataset.single_eval_clip=true \
52
  dataset.memory_selection.enabled=true \
53
+ dataset.memory_selection.causal=true \
54
  dataset.memory_selection.max_anchor_frames=2 \
55
  dataset.memory_selection.max_dynamic_frames=4 \
56
  dataset.memory_selection.max_revisit_frames=2 \
 
66
  dataset.memory_selection.dynamic.selection_policy=event_triggered \
67
  algorithm.n_tokens=8 \
68
  algorithm.context_frames=600 \
69
+ algorithm.metric_report_segment=100 \
70
  algorithm.chunk_size=1 \
71
  algorithm.warmup_steps=10000 \
72
  algorithm.trainability.train_full_dit=true \
 
81
  algorithm.noise_route.revisit=all \
82
  algorithm.memory_noise.enabled=true \
83
  algorithm.memory_noise.mode=random_cleaner_fraction \
84
+ algorithm.memory_noise.anchor_max_fraction=0.0 \
85
+ algorithm.memory_noise.dynamic_max_fraction=0.25 \
86
  algorithm.memory_noise.revisit_max_fraction=0.25 \
87
  "experiment.training.curriculum=${CURRICULUM}" \
88
  experiment.training.batch_size=8 \
89
  experiment.training.optim.accumulate_grad_batches=1 \
90
  experiment.validation.batch_size=1 \
91
  experiment.validation.limit_batch=1 \
92
+ experiment.training.checkpointing.every_n_train_steps=2000 \
93
+ experiment.training.checkpointing.save_last_k=10 \
94
+ experiment.validation.val_every_n_step=2000 \
95
  experiment.training.max_steps=400000
train_dememwm_curric_event_trigger_8h200_berzelius.sh CHANGED
@@ -1,11 +1,11 @@
1
  #!/usr/bin/env bash
2
- #SBATCH --job-name=dememwm-curric-event-8h200
3
  #SBATCH --nodes=1
4
  #SBATCH --ntasks-per-node=8
5
  #SBATCH --cpus-per-task=8
6
  #SBATCH --time=72:00:00
7
- #SBATCH --output=slurm_logs/dememwm-curric-event-8h200-%j.out
8
- #SBATCH --error=slurm_logs/dememwm-curric-event-8h200-%j.out
9
  #SBATCH --account=berzelius-2025-436
10
  #SBATCH --gres=gpu:8
11
  #SBATCH --chdir=/proj/cvl/users/x_fahkh2/DeMemWM
@@ -23,14 +23,13 @@ export TMPDIR=/proj/cvl/users/x_fahkh2/caches
23
  export TRITON_CACHE_DIR=/proj/cvl/users/x_fahkh2/caches
24
  export CUDA_HOME=$CUDA_ROOT
25
  export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
26
- export WANDB_DISABLED=true
27
  export HYDRA_FULL_ERROR=1
28
 
29
  git checkout main
30
 
31
- RUN_NAME=train_dememwm_curric_event_trigger_a2d4r2_route_ntok8_8h200_bs16_global128_200k
32
  OUTPUT_DIR=/proj/cvl/users/x_fahkh2/DeMemWM/results/${RUN_NAME}
33
- CURRICULUM='{enabled:true,stages:[{name:no_updown,until_step:60000,dataset:{wo_updown:true}},{name:with_updown,until_step:200000,dataset:{wo_updown:false}}]}'
34
 
35
  srun python -m main \
36
  +name=${RUN_NAME} \
@@ -47,10 +46,11 @@ srun python -m main \
47
  dataset.save_dir=/proj/cvl/users/x_fahkh2/WorldMem_Repro/datasets/minecraft \
48
  dataset.precomputed_feature_dir=/proj/cvl/users/x_fahkh2/WorldMem_Repro/datasets/minecraft/vae_features \
49
  dataset.n_frames=8 \
50
- dataset.n_frames_valid=700 \
51
  dataset.context_length=100 \
52
  dataset.single_eval_clip=true \
53
  dataset.memory_selection.enabled=true \
 
54
  dataset.memory_selection.max_anchor_frames=2 \
55
  dataset.memory_selection.max_dynamic_frames=4 \
56
  dataset.memory_selection.max_revisit_frames=2 \
@@ -66,10 +66,11 @@ srun python -m main \
66
  dataset.memory_selection.dynamic.selection_policy=event_triggered \
67
  algorithm.n_tokens=8 \
68
  algorithm.context_frames=600 \
 
69
  algorithm.chunk_size=1 \
70
- algorithm.warmup_steps=5000 \
71
  algorithm.trainability.train_full_dit=true \
72
- algorithm.trainability.full_dit_start_step=20000 \
73
  algorithm.trainability.lr.memory_modules=8.0e-5 \
74
  algorithm.trainability.lr.base_dit=2.0e-5 \
75
  algorithm.log_video=true \
@@ -80,14 +81,15 @@ srun python -m main \
80
  algorithm.noise_route.revisit=all \
81
  algorithm.memory_noise.enabled=true \
82
  algorithm.memory_noise.mode=random_cleaner_fraction \
83
- algorithm.memory_noise.anchor_max_fraction=0.25 \
84
- algorithm.memory_noise.dynamic_max_fraction=0.50 \
85
  algorithm.memory_noise.revisit_max_fraction=0.25 \
86
  "experiment.training.curriculum=${CURRICULUM}" \
87
  experiment.training.batch_size=16 \
88
  experiment.training.optim.accumulate_grad_batches=1 \
89
  experiment.validation.batch_size=1 \
90
  experiment.validation.limit_batch=1 \
91
- experiment.training.checkpointing.every_n_train_steps=5000 \
92
- experiment.validation.val_every_n_step=5000 \
93
- experiment.training.max_steps=200000
 
 
1
  #!/usr/bin/env bash
2
+ #SBATCH --job-name=dememwm-curric-event-anchorclean-causal-8h200
3
  #SBATCH --nodes=1
4
  #SBATCH --ntasks-per-node=8
5
  #SBATCH --cpus-per-task=8
6
  #SBATCH --time=72:00:00
7
+ #SBATCH --output=slurm_logs/dememwm-curric-event-anchorclean-causal-8h200-%j.out
8
+ #SBATCH --error=slurm_logs/dememwm-curric-event-anchorclean-causal-8h200-%j.out
9
  #SBATCH --account=berzelius-2025-436
10
  #SBATCH --gres=gpu:8
11
  #SBATCH --chdir=/proj/cvl/users/x_fahkh2/DeMemWM
 
23
  export TRITON_CACHE_DIR=/proj/cvl/users/x_fahkh2/caches
24
  export CUDA_HOME=$CUDA_ROOT
25
  export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
 
26
  export HYDRA_FULL_ERROR=1
27
 
28
  git checkout main
29
 
30
+ RUN_NAME=train_dememwm_curric_event_trigger_anchorclean_causal_a2d4r2_route_ntok8_8h200_bs16_global128_150k
31
  OUTPUT_DIR=/proj/cvl/users/x_fahkh2/DeMemWM/results/${RUN_NAME}
32
+ CURRICULUM='{enabled:true,stages:[{name:no_updown,until_step:30000,dataset:{wo_updown:true}},{name:with_updown,until_step:150000,dataset:{wo_updown:false}}]}'
33
 
34
  srun python -m main \
35
  +name=${RUN_NAME} \
 
46
  dataset.save_dir=/proj/cvl/users/x_fahkh2/WorldMem_Repro/datasets/minecraft \
47
  dataset.precomputed_feature_dir=/proj/cvl/users/x_fahkh2/WorldMem_Repro/datasets/minecraft/vae_features \
48
  dataset.n_frames=8 \
49
+ dataset.n_frames_valid=1100 \
50
  dataset.context_length=100 \
51
  dataset.single_eval_clip=true \
52
  dataset.memory_selection.enabled=true \
53
+ dataset.memory_selection.causal=true \
54
  dataset.memory_selection.max_anchor_frames=2 \
55
  dataset.memory_selection.max_dynamic_frames=4 \
56
  dataset.memory_selection.max_revisit_frames=2 \
 
66
  dataset.memory_selection.dynamic.selection_policy=event_triggered \
67
  algorithm.n_tokens=8 \
68
  algorithm.context_frames=600 \
69
+ algorithm.metric_report_segment=100 \
70
  algorithm.chunk_size=1 \
71
+ algorithm.warmup_steps=1000 \
72
  algorithm.trainability.train_full_dit=true \
73
+ algorithm.trainability.full_dit_start_step=10000 \
74
  algorithm.trainability.lr.memory_modules=8.0e-5 \
75
  algorithm.trainability.lr.base_dit=2.0e-5 \
76
  algorithm.log_video=true \
 
81
  algorithm.noise_route.revisit=all \
82
  algorithm.memory_noise.enabled=true \
83
  algorithm.memory_noise.mode=random_cleaner_fraction \
84
+ algorithm.memory_noise.anchor_max_fraction=0.0 \
85
+ algorithm.memory_noise.dynamic_max_fraction=0.25 \
86
  algorithm.memory_noise.revisit_max_fraction=0.25 \
87
  "experiment.training.curriculum=${CURRICULUM}" \
88
  experiment.training.batch_size=16 \
89
  experiment.training.optim.accumulate_grad_batches=1 \
90
  experiment.validation.batch_size=1 \
91
  experiment.validation.limit_batch=1 \
92
+ experiment.training.checkpointing.every_n_train_steps=2000 \
93
+ experiment.training.checkpointing.save_last_k=10 \
94
+ experiment.validation.val_every_n_step=2000 \
95
+ experiment.training.max_steps=150000
train_dememwm_curric_event_trigger_no_memory_noise_8a100_berzelius.sh → train_dememwm_curric_event_trigger_anchorclean_noncausal_8a100_berzelius.sh RENAMED
@@ -1,11 +1,11 @@
1
  #!/usr/bin/env bash
2
- #SBATCH --job-name=dememwm-curric-event-nomemnoise-8a100
3
  #SBATCH --nodes=1
4
  #SBATCH --ntasks-per-node=8
5
  #SBATCH --cpus-per-task=8
6
  #SBATCH --time=72:00:00
7
- #SBATCH --output=slurm_logs/dememwm-curric-event-nomemnoise-8a100-%j.out
8
- #SBATCH --error=slurm_logs/dememwm-curric-event-nomemnoise-8a100-%j.out
9
  #SBATCH --account=berzelius-2025-436
10
  #SBATCH --gres=gpu:A100-SXM4-80GB:8
11
  #SBATCH --chdir=/proj/cvl/users/x_fahkh2/DeMemWM
@@ -23,12 +23,11 @@ export TMPDIR=/proj/cvl/users/x_fahkh2/caches
23
  export TRITON_CACHE_DIR=/proj/cvl/users/x_fahkh2/caches
24
  export CUDA_HOME=$CUDA_ROOT
25
  export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
26
- export WANDB_DISABLED=true
27
  export HYDRA_FULL_ERROR=1
28
 
29
  git checkout main
30
 
31
- RUN_NAME=train_dememwm_curric_event_trigger_no_memory_noise_a2d4r2_route_ntok8_8a100_bs8_global64_400k
32
  OUTPUT_DIR=/proj/cvl/users/x_fahkh2/DeMemWM/results/${RUN_NAME}
33
  CURRICULUM='{enabled:true,stages:[{name:no_updown,until_step:120000,dataset:{wo_updown:true}},{name:with_updown,until_step:400000,dataset:{wo_updown:false}}]}'
34
 
@@ -47,10 +46,11 @@ srun python -m main \
47
  dataset.save_dir=/proj/cvl/users/x_fahkh2/WorldMem_Repro/datasets/minecraft \
48
  dataset.precomputed_feature_dir=/proj/cvl/users/x_fahkh2/WorldMem_Repro/datasets/minecraft/vae_features \
49
  dataset.n_frames=8 \
50
- dataset.n_frames_valid=700 \
51
  dataset.context_length=100 \
52
  dataset.single_eval_clip=true \
53
  dataset.memory_selection.enabled=true \
 
54
  dataset.memory_selection.max_anchor_frames=2 \
55
  dataset.memory_selection.max_dynamic_frames=4 \
56
  dataset.memory_selection.max_revisit_frames=2 \
@@ -66,6 +66,7 @@ srun python -m main \
66
  dataset.memory_selection.dynamic.selection_policy=event_triggered \
67
  algorithm.n_tokens=8 \
68
  algorithm.context_frames=600 \
 
69
  algorithm.chunk_size=1 \
70
  algorithm.warmup_steps=10000 \
71
  algorithm.trainability.train_full_dit=true \
@@ -78,16 +79,17 @@ srun python -m main \
78
  algorithm.noise_route.anchor=high \
79
  algorithm.noise_route.dynamic=low \
80
  algorithm.noise_route.revisit=all \
81
- algorithm.memory_noise.enabled=false \
82
  algorithm.memory_noise.mode=random_cleaner_fraction \
83
- algorithm.memory_noise.anchor_max_fraction=0.25 \
84
- algorithm.memory_noise.dynamic_max_fraction=0.50 \
85
  algorithm.memory_noise.revisit_max_fraction=0.25 \
86
  "experiment.training.curriculum=${CURRICULUM}" \
87
  experiment.training.batch_size=8 \
88
  experiment.training.optim.accumulate_grad_batches=1 \
89
  experiment.validation.batch_size=1 \
90
  experiment.validation.limit_batch=1 \
91
- experiment.training.checkpointing.every_n_train_steps=5000 \
92
- experiment.validation.val_every_n_step=5000 \
 
93
  experiment.training.max_steps=400000
 
1
  #!/usr/bin/env bash
2
+ #SBATCH --job-name=dememwm-curric-event-anchorclean-noncausal-8a100
3
  #SBATCH --nodes=1
4
  #SBATCH --ntasks-per-node=8
5
  #SBATCH --cpus-per-task=8
6
  #SBATCH --time=72:00:00
7
+ #SBATCH --output=slurm_logs/dememwm-curric-event-anchorclean-noncausal-8a100-%j.out
8
+ #SBATCH --error=slurm_logs/dememwm-curric-event-anchorclean-noncausal-8a100-%j.out
9
  #SBATCH --account=berzelius-2025-436
10
  #SBATCH --gres=gpu:A100-SXM4-80GB:8
11
  #SBATCH --chdir=/proj/cvl/users/x_fahkh2/DeMemWM
 
23
  export TRITON_CACHE_DIR=/proj/cvl/users/x_fahkh2/caches
24
  export CUDA_HOME=$CUDA_ROOT
25
  export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
 
26
  export HYDRA_FULL_ERROR=1
27
 
28
  git checkout main
29
 
30
+ RUN_NAME=train_dememwm_curric_event_trigger_anchorclean_noncausal_a2d4r2_route_ntok8_8a100_bs8_global64_400k
31
  OUTPUT_DIR=/proj/cvl/users/x_fahkh2/DeMemWM/results/${RUN_NAME}
32
  CURRICULUM='{enabled:true,stages:[{name:no_updown,until_step:120000,dataset:{wo_updown:true}},{name:with_updown,until_step:400000,dataset:{wo_updown:false}}]}'
33
 
 
46
  dataset.save_dir=/proj/cvl/users/x_fahkh2/WorldMem_Repro/datasets/minecraft \
47
  dataset.precomputed_feature_dir=/proj/cvl/users/x_fahkh2/WorldMem_Repro/datasets/minecraft/vae_features \
48
  dataset.n_frames=8 \
49
+ dataset.n_frames_valid=1100 \
50
  dataset.context_length=100 \
51
  dataset.single_eval_clip=true \
52
  dataset.memory_selection.enabled=true \
53
+ dataset.memory_selection.causal=false \
54
  dataset.memory_selection.max_anchor_frames=2 \
55
  dataset.memory_selection.max_dynamic_frames=4 \
56
  dataset.memory_selection.max_revisit_frames=2 \
 
66
  dataset.memory_selection.dynamic.selection_policy=event_triggered \
67
  algorithm.n_tokens=8 \
68
  algorithm.context_frames=600 \
69
+ algorithm.metric_report_segment=100 \
70
  algorithm.chunk_size=1 \
71
  algorithm.warmup_steps=10000 \
72
  algorithm.trainability.train_full_dit=true \
 
79
  algorithm.noise_route.anchor=high \
80
  algorithm.noise_route.dynamic=low \
81
  algorithm.noise_route.revisit=all \
82
+ algorithm.memory_noise.enabled=true \
83
  algorithm.memory_noise.mode=random_cleaner_fraction \
84
+ algorithm.memory_noise.anchor_max_fraction=0.0 \
85
+ algorithm.memory_noise.dynamic_max_fraction=0.25 \
86
  algorithm.memory_noise.revisit_max_fraction=0.25 \
87
  "experiment.training.curriculum=${CURRICULUM}" \
88
  experiment.training.batch_size=8 \
89
  experiment.training.optim.accumulate_grad_batches=1 \
90
  experiment.validation.batch_size=1 \
91
  experiment.validation.limit_batch=1 \
92
+ experiment.training.checkpointing.every_n_train_steps=2000 \
93
+ experiment.training.checkpointing.save_last_k=10 \
94
+ experiment.validation.val_every_n_step=2000 \
95
  experiment.training.max_steps=400000
train_dememwm_curric_event_trigger_no_memory_noise_8h200_berzelius.sh → train_dememwm_curric_event_trigger_anchorclean_noncausal_8h200_berzelius.sh RENAMED
@@ -1,11 +1,11 @@
1
  #!/usr/bin/env bash
2
- #SBATCH --job-name=dememwm-curric-event-nomemnoise-8h200
3
  #SBATCH --nodes=1
4
  #SBATCH --ntasks-per-node=8
5
  #SBATCH --cpus-per-task=8
6
  #SBATCH --time=72:00:00
7
- #SBATCH --output=slurm_logs/dememwm-curric-event-nomemnoise-8h200-%j.out
8
- #SBATCH --error=slurm_logs/dememwm-curric-event-nomemnoise-8h200-%j.out
9
  #SBATCH --account=berzelius-2025-436
10
  #SBATCH --gres=gpu:8
11
  #SBATCH --chdir=/proj/cvl/users/x_fahkh2/DeMemWM
@@ -23,14 +23,13 @@ export TMPDIR=/proj/cvl/users/x_fahkh2/caches
23
  export TRITON_CACHE_DIR=/proj/cvl/users/x_fahkh2/caches
24
  export CUDA_HOME=$CUDA_ROOT
25
  export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
26
- export WANDB_DISABLED=true
27
  export HYDRA_FULL_ERROR=1
28
 
29
  git checkout main
30
 
31
- RUN_NAME=train_dememwm_curric_event_trigger_no_memory_noise_a2d4r2_route_ntok8_8h200_bs16_global128_200k
32
  OUTPUT_DIR=/proj/cvl/users/x_fahkh2/DeMemWM/results/${RUN_NAME}
33
- CURRICULUM='{enabled:true,stages:[{name:no_updown,until_step:60000,dataset:{wo_updown:true}},{name:with_updown,until_step:200000,dataset:{wo_updown:false}}]}'
34
 
35
  srun python -m main \
36
  +name=${RUN_NAME} \
@@ -47,10 +46,11 @@ srun python -m main \
47
  dataset.save_dir=/proj/cvl/users/x_fahkh2/WorldMem_Repro/datasets/minecraft \
48
  dataset.precomputed_feature_dir=/proj/cvl/users/x_fahkh2/WorldMem_Repro/datasets/minecraft/vae_features \
49
  dataset.n_frames=8 \
50
- dataset.n_frames_valid=700 \
51
  dataset.context_length=100 \
52
  dataset.single_eval_clip=true \
53
  dataset.memory_selection.enabled=true \
 
54
  dataset.memory_selection.max_anchor_frames=2 \
55
  dataset.memory_selection.max_dynamic_frames=4 \
56
  dataset.memory_selection.max_revisit_frames=2 \
@@ -66,10 +66,11 @@ srun python -m main \
66
  dataset.memory_selection.dynamic.selection_policy=event_triggered \
67
  algorithm.n_tokens=8 \
68
  algorithm.context_frames=600 \
 
69
  algorithm.chunk_size=1 \
70
- algorithm.warmup_steps=5000 \
71
  algorithm.trainability.train_full_dit=true \
72
- algorithm.trainability.full_dit_start_step=20000 \
73
  algorithm.trainability.lr.memory_modules=8.0e-5 \
74
  algorithm.trainability.lr.base_dit=2.0e-5 \
75
  algorithm.log_video=true \
@@ -78,16 +79,17 @@ srun python -m main \
78
  algorithm.noise_route.anchor=high \
79
  algorithm.noise_route.dynamic=low \
80
  algorithm.noise_route.revisit=all \
81
- algorithm.memory_noise.enabled=false \
82
  algorithm.memory_noise.mode=random_cleaner_fraction \
83
- algorithm.memory_noise.anchor_max_fraction=0.25 \
84
- algorithm.memory_noise.dynamic_max_fraction=0.50 \
85
  algorithm.memory_noise.revisit_max_fraction=0.25 \
86
  "experiment.training.curriculum=${CURRICULUM}" \
87
  experiment.training.batch_size=16 \
88
  experiment.training.optim.accumulate_grad_batches=1 \
89
  experiment.validation.batch_size=1 \
90
  experiment.validation.limit_batch=1 \
91
- experiment.training.checkpointing.every_n_train_steps=5000 \
92
- experiment.validation.val_every_n_step=5000 \
93
- experiment.training.max_steps=200000
 
 
1
  #!/usr/bin/env bash
2
+ #SBATCH --job-name=dememwm-curric-event-anchorclean-noncausal-8h200
3
  #SBATCH --nodes=1
4
  #SBATCH --ntasks-per-node=8
5
  #SBATCH --cpus-per-task=8
6
  #SBATCH --time=72:00:00
7
+ #SBATCH --output=slurm_logs/dememwm-curric-event-anchorclean-noncausal-8h200-%j.out
8
+ #SBATCH --error=slurm_logs/dememwm-curric-event-anchorclean-noncausal-8h200-%j.out
9
  #SBATCH --account=berzelius-2025-436
10
  #SBATCH --gres=gpu:8
11
  #SBATCH --chdir=/proj/cvl/users/x_fahkh2/DeMemWM
 
23
  export TRITON_CACHE_DIR=/proj/cvl/users/x_fahkh2/caches
24
  export CUDA_HOME=$CUDA_ROOT
25
  export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
 
26
  export HYDRA_FULL_ERROR=1
27
 
28
  git checkout main
29
 
30
+ RUN_NAME=train_dememwm_curric_event_trigger_anchorclean_noncausal_a2d4r2_route_ntok8_8h200_bs16_global128_150k
31
  OUTPUT_DIR=/proj/cvl/users/x_fahkh2/DeMemWM/results/${RUN_NAME}
32
+ CURRICULUM='{enabled:true,stages:[{name:no_updown,until_step:30000,dataset:{wo_updown:true}},{name:with_updown,until_step:150000,dataset:{wo_updown:false}}]}'
33
 
34
  srun python -m main \
35
  +name=${RUN_NAME} \
 
46
  dataset.save_dir=/proj/cvl/users/x_fahkh2/WorldMem_Repro/datasets/minecraft \
47
  dataset.precomputed_feature_dir=/proj/cvl/users/x_fahkh2/WorldMem_Repro/datasets/minecraft/vae_features \
48
  dataset.n_frames=8 \
49
+ dataset.n_frames_valid=1100 \
50
  dataset.context_length=100 \
51
  dataset.single_eval_clip=true \
52
  dataset.memory_selection.enabled=true \
53
+ dataset.memory_selection.causal=false \
54
  dataset.memory_selection.max_anchor_frames=2 \
55
  dataset.memory_selection.max_dynamic_frames=4 \
56
  dataset.memory_selection.max_revisit_frames=2 \
 
66
  dataset.memory_selection.dynamic.selection_policy=event_triggered \
67
  algorithm.n_tokens=8 \
68
  algorithm.context_frames=600 \
69
+ algorithm.metric_report_segment=100 \
70
  algorithm.chunk_size=1 \
71
+ algorithm.warmup_steps=1000 \
72
  algorithm.trainability.train_full_dit=true \
73
+ algorithm.trainability.full_dit_start_step=10000 \
74
  algorithm.trainability.lr.memory_modules=8.0e-5 \
75
  algorithm.trainability.lr.base_dit=2.0e-5 \
76
  algorithm.log_video=true \
 
79
  algorithm.noise_route.anchor=high \
80
  algorithm.noise_route.dynamic=low \
81
  algorithm.noise_route.revisit=all \
82
+ algorithm.memory_noise.enabled=true \
83
  algorithm.memory_noise.mode=random_cleaner_fraction \
84
+ algorithm.memory_noise.anchor_max_fraction=0.0 \
85
+ algorithm.memory_noise.dynamic_max_fraction=0.25 \
86
  algorithm.memory_noise.revisit_max_fraction=0.25 \
87
  "experiment.training.curriculum=${CURRICULUM}" \
88
  experiment.training.batch_size=16 \
89
  experiment.training.optim.accumulate_grad_batches=1 \
90
  experiment.validation.batch_size=1 \
91
  experiment.validation.limit_batch=1 \
92
+ experiment.training.checkpointing.every_n_train_steps=2000 \
93
+ experiment.training.checkpointing.save_last_k=10 \
94
+ experiment.validation.val_every_n_step=2000 \
95
+ experiment.training.max_steps=150000
train_dememwm_curric_event_trigger_no_route_8a100_berzelius.sh CHANGED
@@ -1,11 +1,11 @@
1
  #!/usr/bin/env bash
2
- #SBATCH --job-name=dememwm-curric-event-noroute-8a100
3
  #SBATCH --nodes=1
4
  #SBATCH --ntasks-per-node=8
5
  #SBATCH --cpus-per-task=8
6
  #SBATCH --time=72:00:00
7
- #SBATCH --output=slurm_logs/dememwm-curric-event-noroute-8a100-%j.out
8
- #SBATCH --error=slurm_logs/dememwm-curric-event-noroute-8a100-%j.out
9
  #SBATCH --account=berzelius-2025-436
10
  #SBATCH --gres=gpu:A100-SXM4-80GB:8
11
  #SBATCH --chdir=/proj/cvl/users/x_fahkh2/DeMemWM
@@ -23,12 +23,11 @@ export TMPDIR=/proj/cvl/users/x_fahkh2/caches
23
  export TRITON_CACHE_DIR=/proj/cvl/users/x_fahkh2/caches
24
  export CUDA_HOME=$CUDA_ROOT
25
  export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
26
- export WANDB_DISABLED=true
27
  export HYDRA_FULL_ERROR=1
28
 
29
  git checkout main
30
 
31
- RUN_NAME=train_dememwm_curric_event_trigger_no_route_a2d4r2_ntok8_8a100_bs8_global64_400k
32
  OUTPUT_DIR=/proj/cvl/users/x_fahkh2/DeMemWM/results/${RUN_NAME}
33
  CURRICULUM='{enabled:true,stages:[{name:no_updown,until_step:120000,dataset:{wo_updown:true}},{name:with_updown,until_step:400000,dataset:{wo_updown:false}}]}'
34
 
@@ -47,10 +46,11 @@ srun python -m main \
47
  dataset.save_dir=/proj/cvl/users/x_fahkh2/WorldMem_Repro/datasets/minecraft \
48
  dataset.precomputed_feature_dir=/proj/cvl/users/x_fahkh2/WorldMem_Repro/datasets/minecraft/vae_features \
49
  dataset.n_frames=8 \
50
- dataset.n_frames_valid=700 \
51
  dataset.context_length=100 \
52
  dataset.single_eval_clip=true \
53
  dataset.memory_selection.enabled=true \
 
54
  dataset.memory_selection.max_anchor_frames=2 \
55
  dataset.memory_selection.max_dynamic_frames=4 \
56
  dataset.memory_selection.max_revisit_frames=2 \
@@ -66,6 +66,7 @@ srun python -m main \
66
  dataset.memory_selection.dynamic.selection_policy=event_triggered \
67
  algorithm.n_tokens=8 \
68
  algorithm.context_frames=600 \
 
69
  algorithm.chunk_size=1 \
70
  algorithm.warmup_steps=10000 \
71
  algorithm.trainability.train_full_dit=true \
@@ -80,14 +81,15 @@ srun python -m main \
80
  algorithm.noise_route.revisit=all \
81
  algorithm.memory_noise.enabled=true \
82
  algorithm.memory_noise.mode=random_cleaner_fraction \
83
- algorithm.memory_noise.anchor_max_fraction=0.25 \
84
- algorithm.memory_noise.dynamic_max_fraction=0.50 \
85
  algorithm.memory_noise.revisit_max_fraction=0.25 \
86
  "experiment.training.curriculum=${CURRICULUM}" \
87
  experiment.training.batch_size=8 \
88
  experiment.training.optim.accumulate_grad_batches=1 \
89
  experiment.validation.batch_size=1 \
90
  experiment.validation.limit_batch=1 \
91
- experiment.training.checkpointing.every_n_train_steps=5000 \
92
- experiment.validation.val_every_n_step=5000 \
 
93
  experiment.training.max_steps=400000
 
1
  #!/usr/bin/env bash
2
+ #SBATCH --job-name=dememwm-curric-event-noroute-anchorclean-8a100
3
  #SBATCH --nodes=1
4
  #SBATCH --ntasks-per-node=8
5
  #SBATCH --cpus-per-task=8
6
  #SBATCH --time=72:00:00
7
+ #SBATCH --output=slurm_logs/dememwm-curric-event-noroute-anchorclean-8a100-%j.out
8
+ #SBATCH --error=slurm_logs/dememwm-curric-event-noroute-anchorclean-8a100-%j.out
9
  #SBATCH --account=berzelius-2025-436
10
  #SBATCH --gres=gpu:A100-SXM4-80GB:8
11
  #SBATCH --chdir=/proj/cvl/users/x_fahkh2/DeMemWM
 
23
  export TRITON_CACHE_DIR=/proj/cvl/users/x_fahkh2/caches
24
  export CUDA_HOME=$CUDA_ROOT
25
  export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
 
26
  export HYDRA_FULL_ERROR=1
27
 
28
  git checkout main
29
 
30
+ RUN_NAME=train_dememwm_curric_event_trigger_no_route_anchorclean_a2d4r2_ntok8_8a100_bs8_global64_400k
31
  OUTPUT_DIR=/proj/cvl/users/x_fahkh2/DeMemWM/results/${RUN_NAME}
32
  CURRICULUM='{enabled:true,stages:[{name:no_updown,until_step:120000,dataset:{wo_updown:true}},{name:with_updown,until_step:400000,dataset:{wo_updown:false}}]}'
33
 
 
46
  dataset.save_dir=/proj/cvl/users/x_fahkh2/WorldMem_Repro/datasets/minecraft \
47
  dataset.precomputed_feature_dir=/proj/cvl/users/x_fahkh2/WorldMem_Repro/datasets/minecraft/vae_features \
48
  dataset.n_frames=8 \
49
+ dataset.n_frames_valid=1100 \
50
  dataset.context_length=100 \
51
  dataset.single_eval_clip=true \
52
  dataset.memory_selection.enabled=true \
53
+ dataset.memory_selection.causal=true \
54
  dataset.memory_selection.max_anchor_frames=2 \
55
  dataset.memory_selection.max_dynamic_frames=4 \
56
  dataset.memory_selection.max_revisit_frames=2 \
 
66
  dataset.memory_selection.dynamic.selection_policy=event_triggered \
67
  algorithm.n_tokens=8 \
68
  algorithm.context_frames=600 \
69
+ algorithm.metric_report_segment=100 \
70
  algorithm.chunk_size=1 \
71
  algorithm.warmup_steps=10000 \
72
  algorithm.trainability.train_full_dit=true \
 
81
  algorithm.noise_route.revisit=all \
82
  algorithm.memory_noise.enabled=true \
83
  algorithm.memory_noise.mode=random_cleaner_fraction \
84
+ algorithm.memory_noise.anchor_max_fraction=0.0 \
85
+ algorithm.memory_noise.dynamic_max_fraction=0.25 \
86
  algorithm.memory_noise.revisit_max_fraction=0.25 \
87
  "experiment.training.curriculum=${CURRICULUM}" \
88
  experiment.training.batch_size=8 \
89
  experiment.training.optim.accumulate_grad_batches=1 \
90
  experiment.validation.batch_size=1 \
91
  experiment.validation.limit_batch=1 \
92
+ experiment.training.checkpointing.every_n_train_steps=2000 \
93
+ experiment.training.checkpointing.save_last_k=10 \
94
+ experiment.validation.val_every_n_step=2000 \
95
  experiment.training.max_steps=400000
train_dememwm_curric_event_trigger_no_route_8h200_berzelius.sh CHANGED
@@ -1,11 +1,11 @@
1
  #!/usr/bin/env bash
2
- #SBATCH --job-name=dememwm-curric-event-noroute-8h200
3
  #SBATCH --nodes=1
4
  #SBATCH --ntasks-per-node=8
5
  #SBATCH --cpus-per-task=8
6
  #SBATCH --time=72:00:00
7
- #SBATCH --output=slurm_logs/dememwm-curric-event-noroute-8h200-%j.out
8
- #SBATCH --error=slurm_logs/dememwm-curric-event-noroute-8h200-%j.out
9
  #SBATCH --account=berzelius-2025-436
10
  #SBATCH --gres=gpu:8
11
  #SBATCH --chdir=/proj/cvl/users/x_fahkh2/DeMemWM
@@ -23,14 +23,13 @@ export TMPDIR=/proj/cvl/users/x_fahkh2/caches
23
  export TRITON_CACHE_DIR=/proj/cvl/users/x_fahkh2/caches
24
  export CUDA_HOME=$CUDA_ROOT
25
  export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
26
- export WANDB_DISABLED=true
27
  export HYDRA_FULL_ERROR=1
28
 
29
  git checkout main
30
 
31
- RUN_NAME=train_dememwm_curric_event_trigger_no_route_a2d4r2_ntok8_8h200_bs16_global128_200k
32
  OUTPUT_DIR=/proj/cvl/users/x_fahkh2/DeMemWM/results/${RUN_NAME}
33
- CURRICULUM='{enabled:true,stages:[{name:no_updown,until_step:60000,dataset:{wo_updown:true}},{name:with_updown,until_step:200000,dataset:{wo_updown:false}}]}'
34
 
35
  srun python -m main \
36
  +name=${RUN_NAME} \
@@ -47,10 +46,11 @@ srun python -m main \
47
  dataset.save_dir=/proj/cvl/users/x_fahkh2/WorldMem_Repro/datasets/minecraft \
48
  dataset.precomputed_feature_dir=/proj/cvl/users/x_fahkh2/WorldMem_Repro/datasets/minecraft/vae_features \
49
  dataset.n_frames=8 \
50
- dataset.n_frames_valid=700 \
51
  dataset.context_length=100 \
52
  dataset.single_eval_clip=true \
53
  dataset.memory_selection.enabled=true \
 
54
  dataset.memory_selection.max_anchor_frames=2 \
55
  dataset.memory_selection.max_dynamic_frames=4 \
56
  dataset.memory_selection.max_revisit_frames=2 \
@@ -66,10 +66,11 @@ srun python -m main \
66
  dataset.memory_selection.dynamic.selection_policy=event_triggered \
67
  algorithm.n_tokens=8 \
68
  algorithm.context_frames=600 \
 
69
  algorithm.chunk_size=1 \
70
- algorithm.warmup_steps=5000 \
71
  algorithm.trainability.train_full_dit=true \
72
- algorithm.trainability.full_dit_start_step=20000 \
73
  algorithm.trainability.lr.memory_modules=8.0e-5 \
74
  algorithm.trainability.lr.base_dit=2.0e-5 \
75
  algorithm.log_video=true \
@@ -80,14 +81,15 @@ srun python -m main \
80
  algorithm.noise_route.revisit=all \
81
  algorithm.memory_noise.enabled=true \
82
  algorithm.memory_noise.mode=random_cleaner_fraction \
83
- algorithm.memory_noise.anchor_max_fraction=0.25 \
84
- algorithm.memory_noise.dynamic_max_fraction=0.50 \
85
  algorithm.memory_noise.revisit_max_fraction=0.25 \
86
  "experiment.training.curriculum=${CURRICULUM}" \
87
  experiment.training.batch_size=16 \
88
  experiment.training.optim.accumulate_grad_batches=1 \
89
  experiment.validation.batch_size=1 \
90
  experiment.validation.limit_batch=1 \
91
- experiment.training.checkpointing.every_n_train_steps=5000 \
92
- experiment.validation.val_every_n_step=5000 \
93
- experiment.training.max_steps=200000
 
 
1
  #!/usr/bin/env bash
2
+ #SBATCH --job-name=dememwm-curric-event-noroute-anchorclean-8h200
3
  #SBATCH --nodes=1
4
  #SBATCH --ntasks-per-node=8
5
  #SBATCH --cpus-per-task=8
6
  #SBATCH --time=72:00:00
7
+ #SBATCH --output=slurm_logs/dememwm-curric-event-noroute-anchorclean-8h200-%j.out
8
+ #SBATCH --error=slurm_logs/dememwm-curric-event-noroute-anchorclean-8h200-%j.out
9
  #SBATCH --account=berzelius-2025-436
10
  #SBATCH --gres=gpu:8
11
  #SBATCH --chdir=/proj/cvl/users/x_fahkh2/DeMemWM
 
23
  export TRITON_CACHE_DIR=/proj/cvl/users/x_fahkh2/caches
24
  export CUDA_HOME=$CUDA_ROOT
25
  export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
 
26
  export HYDRA_FULL_ERROR=1
27
 
28
  git checkout main
29
 
30
+ RUN_NAME=train_dememwm_curric_event_trigger_no_route_anchorclean_a2d4r2_ntok8_8h200_bs16_global128_150k
31
  OUTPUT_DIR=/proj/cvl/users/x_fahkh2/DeMemWM/results/${RUN_NAME}
32
+ CURRICULUM='{enabled:true,stages:[{name:no_updown,until_step:30000,dataset:{wo_updown:true}},{name:with_updown,until_step:150000,dataset:{wo_updown:false}}]}'
33
 
34
  srun python -m main \
35
  +name=${RUN_NAME} \
 
46
  dataset.save_dir=/proj/cvl/users/x_fahkh2/WorldMem_Repro/datasets/minecraft \
47
  dataset.precomputed_feature_dir=/proj/cvl/users/x_fahkh2/WorldMem_Repro/datasets/minecraft/vae_features \
48
  dataset.n_frames=8 \
49
+ dataset.n_frames_valid=1100 \
50
  dataset.context_length=100 \
51
  dataset.single_eval_clip=true \
52
  dataset.memory_selection.enabled=true \
53
+ dataset.memory_selection.causal=true \
54
  dataset.memory_selection.max_anchor_frames=2 \
55
  dataset.memory_selection.max_dynamic_frames=4 \
56
  dataset.memory_selection.max_revisit_frames=2 \
 
66
  dataset.memory_selection.dynamic.selection_policy=event_triggered \
67
  algorithm.n_tokens=8 \
68
  algorithm.context_frames=600 \
69
+ algorithm.metric_report_segment=100 \
70
  algorithm.chunk_size=1 \
71
+ algorithm.warmup_steps=1000 \
72
  algorithm.trainability.train_full_dit=true \
73
+ algorithm.trainability.full_dit_start_step=10000 \
74
  algorithm.trainability.lr.memory_modules=8.0e-5 \
75
  algorithm.trainability.lr.base_dit=2.0e-5 \
76
  algorithm.log_video=true \
 
81
  algorithm.noise_route.revisit=all \
82
  algorithm.memory_noise.enabled=true \
83
  algorithm.memory_noise.mode=random_cleaner_fraction \
84
+ algorithm.memory_noise.anchor_max_fraction=0.0 \
85
+ algorithm.memory_noise.dynamic_max_fraction=0.25 \
86
  algorithm.memory_noise.revisit_max_fraction=0.25 \
87
  "experiment.training.curriculum=${CURRICULUM}" \
88
  experiment.training.batch_size=16 \
89
  experiment.training.optim.accumulate_grad_batches=1 \
90
  experiment.validation.batch_size=1 \
91
  experiment.validation.limit_batch=1 \
92
+ experiment.training.checkpointing.every_n_train_steps=2000 \
93
+ experiment.training.checkpointing.save_last_k=10 \
94
+ experiment.validation.val_every_n_step=2000 \
95
+ experiment.training.max_steps=150000