ojaffe commited on
Commit
5f980e3
·
verified ·
1 Parent(s): eb84bdb

Upload folder using huggingface_hub

Browse files
__pycache__/predict.cpython-311.pyc CHANGED
Binary files a/__pycache__/predict.cpython-311.pyc and b/__pycache__/predict.cpython-311.pyc differ
 
predict.py CHANGED
@@ -230,13 +230,15 @@ def predict_next_frame(ens, context_frames: np.ndarray) -> np.ndarray:
230
 
231
  ar_pred = sum(all_ar_runs) / len(all_ar_runs)
232
 
 
 
233
  predicted = torch.zeros_like(direct_pred)
234
- eps = 1e-6
235
  for step in range(PRED_FRAMES):
236
  w = 0.65 - (step / (PRED_FRAMES - 1)) * 0.3
237
- ar_safe = torch.clamp(ar_pred[:, step], eps, 1.0)
238
- direct_safe = torch.clamp(direct_pred[:, step], eps, 1.0)
239
- predicted[:, step] = torch.clamp(ar_safe.pow(w) * direct_safe.pow(1.0 - w), 0, 1)
 
240
 
241
  predicted_np = predicted[0].cpu().numpy()
242
  ens.direct_cache = []
 
230
 
231
  ar_pred = sum(all_ar_runs) / len(all_ar_runs)
232
 
233
+ # Blend in residual space
234
+ last_ctx = last_tensor.unsqueeze(1).expand_as(direct_pred)
235
  predicted = torch.zeros_like(direct_pred)
 
236
  for step in range(PRED_FRAMES):
237
  w = 0.65 - (step / (PRED_FRAMES - 1)) * 0.3
238
+ ar_residual = ar_pred[:, step] - last_ctx[:, step]
239
+ direct_residual = direct_pred[:, step] - last_ctx[:, step]
240
+ blended_residual = w * ar_residual + (1.0 - w) * direct_residual
241
+ predicted[:, step] = torch.clamp(last_ctx[:, step] + blended_residual, 0, 1)
242
 
243
  predicted_np = predicted[0].cpu().numpy()
244
  ens.direct_cache = []