ojaffe commited on
Commit
ab47a15
·
verified ·
1 Parent(s): d2d7b72

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
 
model_pole_position.pt CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:27d26875071b536cc75cac27a0840b50cd6c9a8e1956c94f1cd08feacc49621f
3
- size 2971526
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:62d218b9859acd4d19cfcfe6b3aa93ae129485a872175632ed32d6441ae9c7f6
3
+ size 1580934
model_pong.pt CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:6e5c823ea30b79baec88c337290bb2491c83906ac288b5a0111decb2f2b49792
3
- size 1387816
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d6c8b9235347bea94e7e5f5f0f225d4c1dbd13a749d5e28920c75c91902ecb11
3
+ size 2435368
predict.py CHANGED
@@ -1,4 +1,4 @@
1
- """Compact ensemble: small Pong AR, Sonic AR+direct ensemble, PP direct. All under 16MB."""
2
  import sys
3
  import os
4
  import numpy as np
@@ -42,9 +42,9 @@ class EnsembleModels:
42
  def load_model(model_dir: str):
43
  ens = EnsembleModels()
44
 
45
- # Pong: compact AR model (3 outputs, smaller architecture)
46
  pong = UNet(in_channels=24, out_channels=3,
47
- enc_channels=(24, 48, 96), bottleneck_channels=96,
48
  upsample_mode="bilinear").to(DEVICE)
49
  sd = torch.load(os.path.join(model_dir, "model_pong.pt"),
50
  map_location=DEVICE, weights_only=True)
@@ -72,9 +72,9 @@ def load_model(model_dir: str):
72
  sonic_direct.eval()
73
  ens.sonic_direct = sonic_direct
74
 
75
- # PP: direct 8-frame model (24 outputs)
76
  pp = UNet(in_channels=24, out_channels=24,
77
- enc_channels=(32, 64, 128), bottleneck_channels=192,
78
  upsample_mode="bilinear").to(DEVICE)
79
  sd = torch.load(os.path.join(model_dir, "model_pole_position.pt"),
80
  map_location=DEVICE, weights_only=True)
@@ -146,7 +146,7 @@ def predict_next_frame(ens, context_frames: np.ndarray) -> np.ndarray:
146
  direct_flipped = torch.flip(direct_flipped, dims=[4])
147
  direct_pred = (direct_orig + direct_flipped) / 2.0
148
 
149
- # AR prediction with TTA for each step
150
  ar_preds = []
151
  ctx = context_tensor.clone()
152
  ctx_flip = context_flipped.clone()
@@ -182,6 +182,7 @@ def predict_next_frame(ens, context_frames: np.ndarray) -> np.ndarray:
182
  return result
183
 
184
  else:
 
185
  if ens.direct_cache is not None and n > CONTEXT_FRAMES and ens.cache_step < PRED_FRAMES:
186
  result = ens.direct_cache[ens.cache_step]
187
  ens.cache_step += 1
 
1
+ """Compact PP ensemble: full Pong AR, Sonic AR+direct ensemble, compact PP direct. Under 16MB."""
2
  import sys
3
  import os
4
  import numpy as np
 
42
  def load_model(model_dir: str):
43
  ens = EnsembleModels()
44
 
45
+ # Pong: full AR model (3 outputs)
46
  pong = UNet(in_channels=24, out_channels=3,
47
+ enc_channels=(32, 64, 128), bottleneck_channels=128,
48
  upsample_mode="bilinear").to(DEVICE)
49
  sd = torch.load(os.path.join(model_dir, "model_pong.pt"),
50
  map_location=DEVICE, weights_only=True)
 
72
  sonic_direct.eval()
73
  ens.sonic_direct = sonic_direct
74
 
75
+ # PP: compact direct 8-frame model (24 outputs, smaller architecture)
76
  pp = UNet(in_channels=24, out_channels=24,
77
+ enc_channels=(24, 48, 96), bottleneck_channels=128,
78
  upsample_mode="bilinear").to(DEVICE)
79
  sd = torch.load(os.path.join(model_dir, "model_pole_position.pt"),
80
  map_location=DEVICE, weights_only=True)
 
146
  direct_flipped = torch.flip(direct_flipped, dims=[4])
147
  direct_pred = (direct_orig + direct_flipped) / 2.0
148
 
149
+ # AR prediction with TTA
150
  ar_preds = []
151
  ctx = context_tensor.clone()
152
  ctx_flip = context_flipped.clone()
 
182
  return result
183
 
184
  else:
185
+ # PP: direct 8-frame with caching and TTA
186
  if ens.direct_cache is not None and n > CONTEXT_FRAMES and ens.cache_step < PRED_FRAMES:
187
  result = ens.direct_cache[ens.cache_step]
188
  ens.cache_step += 1