R12 time_only control arm (scripts/evaluate_drydown_physics.py)
Browse files
scripts/evaluate_drydown_physics.py
CHANGED
|
@@ -74,8 +74,8 @@ def main() -> int:
|
|
| 74 |
ap.add_argument("--split", choices=["molecule", "formula"], default="formula")
|
| 75 |
ap.add_argument("--arm-label", default=None)
|
| 76 |
ap.add_argument("--use-gamma", action="store_true")
|
| 77 |
-
ap.add_argument("--physics-mode", choices=["full", "off", "gamma_only", "headspace_only"], default="full",
|
| 78 |
-
help="Match the arm's training conditioning: gamma_only zeroes channels 0-1 of the 'on' tensor, headspace_only zeroes channel 2, off zeroes all. Ensures each factorial arm is evaluated with the same masked physics it was trained on.")
|
| 79 |
ap.add_argument("--max-eval", type=int, default=400)
|
| 80 |
ap.add_argument("--output", required=True)
|
| 81 |
args = ap.parse_args()
|
|
@@ -137,6 +137,13 @@ def main() -> int:
|
|
| 137 |
physics = physics.clone(); physics[..., 0] = 0.0; physics[..., 1] = 0.0
|
| 138 |
elif args.physics_mode == "headspace_only":
|
| 139 |
physics = physics.clone(); physics[..., 2] = 0.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
lat_on = model(tokens, physics)
|
| 141 |
pyr_on = heads(lat_on, physics, mask)["objective"][0] # (3,138)
|
| 142 |
# physics OFF (zeroed)
|
|
|
|
| 74 |
ap.add_argument("--split", choices=["molecule", "formula"], default="formula")
|
| 75 |
ap.add_argument("--arm-label", default=None)
|
| 76 |
ap.add_argument("--use-gamma", action="store_true")
|
| 77 |
+
ap.add_argument("--physics-mode", choices=["full", "off", "gamma_only", "headspace_only", "time_only"], default="full",
|
| 78 |
+
help="Match the arm's training conditioning: gamma_only zeroes channels 0-1 of the 'on' tensor, headspace_only zeroes channel 2, off zeroes all, time_only zeroes all then sets channel 0 to linspace(0,1,T) (clean time axis, matched to the time_only training arm). Ensures each factorial arm is evaluated with the same masked physics it was trained on.")
|
| 79 |
ap.add_argument("--max-eval", type=int, default=400)
|
| 80 |
ap.add_argument("--output", required=True)
|
| 81 |
args = ap.parse_args()
|
|
|
|
| 137 |
physics = physics.clone(); physics[..., 0] = 0.0; physics[..., 1] = 0.0
|
| 138 |
elif args.physics_mode == "headspace_only":
|
| 139 |
physics = physics.clone(); physics[..., 2] = 0.0
|
| 140 |
+
elif args.physics_mode == "time_only":
|
| 141 |
+
# Match the time_only training conditioning: zero ALL thermodynamic
|
| 142 |
+
# content, then set channel 0 to a normalized time index linspace
|
| 143 |
+
# (0..1) over T, broadcast identically across batch+ingredients.
|
| 144 |
+
_T = physics.size(1)
|
| 145 |
+
physics = torch.zeros_like(physics)
|
| 146 |
+
physics[..., 0] = torch.linspace(0.0, 1.0, _T, device=device).view(1, _T, 1)
|
| 147 |
lat_on = model(tokens, physics)
|
| 148 |
pyr_on = heads(lat_on, physics, mask)["objective"][0] # (3,138)
|
| 149 |
# physics OFF (zeroed)
|