mattbitzesty commited on
Commit
4fb2620
·
verified ·
1 Parent(s): 407d0c8

R12 time_only control arm (src/pino/train.py)

Browse files
Files changed (1) hide show
  1. src/pino/train.py +15 -1
src/pino/train.py CHANGED
@@ -50,6 +50,10 @@ _PHYSICS_OFF_TRAIN = False
50
  # gamma_only : keep channel 2 (log gamma), zero 0-1 -- isolates the
51
  # non-redundant blend-interaction channel
52
  # headspace_only : keep channels 0-1, zero channel 2 -- the E2-redundant part
 
 
 
 
53
  _PHYSICS_MODE = "full"
54
 
55
  def pad_trajectory_collate(batch: list[dict[str, Any]]) -> dict[str, Any]:
@@ -115,6 +119,16 @@ def pad_trajectory_collate(batch: list[dict[str, Any]]) -> dict[str, Any]:
115
  # Keep channels 0-1 (x_liquid, log10 OAV); zero the gamma channel.
116
  physics = physics.clone()
117
  physics[..., 2] = 0.0
 
 
 
 
 
 
 
 
 
 
118
 
119
  return {
120
  "tokens": tokens,
@@ -306,7 +320,7 @@ def main():
306
  parser.add_argument("--use-gamma", action="store_true", help="Add the UNIFAC blend-interaction (gamma) 3rd physics channel; requires a gamma-augmented dataset (physics_gamma field)")
307
  parser.add_argument("--split-strategy", choices=["molecule", "formula"], default="molecule", help="molecule = strict molecule-disjoint holdout (default, used for frozen-task headline results); formula = random formula-level holdout (E1 physics-gamma substantivity experiment; discloses molecule leakage for measured-Poucher eval power)")
308
  parser.add_argument("--physics-off-train", action="store_true", help="Idea3 ablation: zero the physics tensor for every batch (train+val) so the model is a fair no-physics baseline")
309
- parser.add_argument("--physics-mode", choices=["full", "off", "gamma_only", "headspace_only"], default="full", help="Factorial channel ablation: full = all channels; off = all zeroed; gamma_only = keep only log-gamma channel (zero x_liquid/OAV); headspace_only = keep x_liquid/OAV (zero gamma). Applied during BOTH train and val so each arm is a fair trained baseline.")
310
  args = parser.parse_args()
311
 
312
  global _PHYSICS_OFF_TRAIN, _PHYSICS_MODE
 
50
  # gamma_only : keep channel 2 (log gamma), zero 0-1 -- isolates the
51
  # non-redundant blend-interaction channel
52
  # headspace_only : keep channels 0-1, zero channel 2 -- the E2-redundant part
53
+ # time_only : zero ALL thermodynamic channels, then set channel 0 to a
54
+ # normalized time index (linspace 0..1 over T, identical across
55
+ # batch+ingredients). Gives the model a clean time axis with
56
+ # zero thermodynamic content, capacity-matched (state_dim=3).
57
  _PHYSICS_MODE = "full"
58
 
59
  def pad_trajectory_collate(batch: list[dict[str, Any]]) -> dict[str, Any]:
 
119
  # Keep channels 0-1 (x_liquid, log10 OAV); zero the gamma channel.
120
  physics = physics.clone()
121
  physics[..., 2] = 0.0
122
+ elif _PHYSICS_MODE == "time_only":
123
+ # Decisive control for the physics-off ablation: the PIMT model has NO
124
+ # positional encoding, so time enters ONLY via the physics state tensor.
125
+ # The 'off' arm therefore removes the time axis entirely. 'time_only'
126
+ # gives the model a clean normalized time index (linspace 0..1 over T)
127
+ # with zero thermodynamic content, broadcast identically across batch and
128
+ # ingredients. Channels 1..end stay zero. Capacity-matched (state_dim=3).
129
+ T = physics.size(1)
130
+ physics = torch.zeros_like(physics)
131
+ physics[..., 0] = torch.linspace(0.0, 1.0, T).view(1, T, 1)
132
 
133
  return {
134
  "tokens": tokens,
 
320
  parser.add_argument("--use-gamma", action="store_true", help="Add the UNIFAC blend-interaction (gamma) 3rd physics channel; requires a gamma-augmented dataset (physics_gamma field)")
321
  parser.add_argument("--split-strategy", choices=["molecule", "formula"], default="molecule", help="molecule = strict molecule-disjoint holdout (default, used for frozen-task headline results); formula = random formula-level holdout (E1 physics-gamma substantivity experiment; discloses molecule leakage for measured-Poucher eval power)")
322
  parser.add_argument("--physics-off-train", action="store_true", help="Idea3 ablation: zero the physics tensor for every batch (train+val) so the model is a fair no-physics baseline")
323
+ parser.add_argument("--physics-mode", choices=["full", "off", "gamma_only", "headspace_only", "time_only"], default="full", help="Factorial channel ablation: full = all channels; off = all zeroed; gamma_only = keep only log-gamma channel (zero x_liquid/OAV); headspace_only = keep x_liquid/OAV (zero gamma); time_only = zero ALL thermodynamic channels then set channel 0 to a normalized time index linspace(0,1,T) broadcast over batch+ingredients (clean time axis, zero thermodynamic content, capacity-matched). Applied during BOTH train and val so each arm is a fair trained baseline.")
324
  args = parser.parse_args()
325
 
326
  global _PHYSICS_OFF_TRAIN, _PHYSICS_MODE