Commit 539539b
committed
Fix SpikeDetection.load_state_dict referencing nonexistent self.running
`SpikeDetection.__init__` stores the running-mean metric on
`self.running_mean` (line 57). `SpikeDetection.state_dict` saves it under
the key `"running"` via `self.running_mean.state_dict()` (line 156).
`SpikeDetection.load_state_dict` then tries to restore it with
`self.running.load_state_dict(...)` — but `self.running` is never defined,
so any resume of a SpikeDetection callback state crashes with:
AttributeError: 'SpikeDetection' object has no attribute 'running'
The asymmetry with the symmetric line right below it
(`self.running_mean.base_metric.load_state_dict(...)`) confirms it's a
typo of `self.running_mean`, not a deliberate different attribute. Adds a
regression test that round-trips state_dict / load_state_dict on a fresh
SpikeDetection.1 parent 35e56ef commit 539539b
2 files changed
Lines changed: 13 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
168 | | - | |
| 168 | + | |
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
0 commit comments