diff options
| author | YurenHao0426 <Blackhao0426@gmail.com> | 2026-07-22 16:45:36 -0500 |
|---|---|---|
| committer | YurenHao0426 <Blackhao0426@gmail.com> | 2026-07-22 16:45:36 -0500 |
| commit | c8dd2e591c9835b8618fc34bc1d043634ce345e1 (patch) | |
| tree | 3f1ec546b4832eab5147cb2baaa92605f602b24d /sdil | |
| parent | 72f6b758540e8c1d7a44fed63bafe71784f6dfa2 (diff) | |
experiment: freeze predictor after neutral fit
Diffstat (limited to 'sdil')
| -rw-r--r-- | sdil/conv.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sdil/conv.py b/sdil/conv.py index d6bae4f..285ceb1 100644 --- a/sdil/conv.py +++ b/sdil/conv.py @@ -1267,8 +1267,8 @@ def conv_kp_mixed_traffic_step(net, x, y, config, step, rule, """One reciprocal-KP update using a selected mixed-apical signal.""" if not isinstance(net, CIFARKPMixedTrafficResNet): raise TypeError("mixed-traffic KP step requires CIFARKPMixedTrafficResNet") - if predictor_every < 1: - raise ValueError("predictor cadence must be positive") + if predictor_every < 0: + raise ValueError("predictor cadence must be nonnegative") config.validate() with torch.no_grad(): forward = net.forward( @@ -1303,7 +1303,8 @@ def conv_kp_mixed_traffic_step(net, x, y, config, step, rule, momentum=config.momentum, weight_decay=config.weight_decay, gamma_directions=gamma_directions, beta_directions=beta_directions) - did_predictor_update = step % predictor_every == 0 + did_predictor_update = ( + predictor_every > 0 and step % predictor_every == 0) predictor_mse = None if did_predictor_update: predictor_mse = net.predictor_step( |
