| 59 | |
| 60 | |
| 61 | class DummyOptimizer(torch.optim.Optimizer): |
| 62 | def __init__(self): |
| 63 | self.state = defaultdict(dict) |
| 64 | self.param_groups = [] |
| 65 | |
| 66 | def step(self, closure=None): |
| 67 | pass |
| 68 | |
| 69 | def zero_grad(self, set_to_none: bool = True): |
| 70 | pass |
| 71 | |
| 72 | def state_dict(self): |
| 73 | return {} |
| 74 | |
| 75 | def load_state_dict(self, state_dict): |
| 76 | pass |
| 77 | |
| 78 | |
| 79 | # Monkeypatch this so it counts all layer parameters, not just trainable parameters. |