Skip to content

Commit d030961

Browse files
committed
typing
1 parent 209d15f commit d030961

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/lightning/pytorch/callbacks/lr_monitor.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,8 @@ def _extract_momentum(self, param_group: dict[str, list[float]], name: str, use_
255255
if not self.log_momentum:
256256
return {}
257257

258-
momentum = param_group["betas"][0] if use_betas else param_group.get("momentum")
259-
momentum = momentum if momentum is not None else 0
260-
self.last_momentum_values[name] = momentum
258+
momentum = param_group["betas"][0] if use_betas else param_group.get("momentum", 0)
259+
self.last_momentum_values[name] = momentum # type: ignore[assignment]
261260
return {name: momentum}
262261

263262
def _extract_weight_decay(self, param_group: dict[str, Any], name: str) -> dict[str, Any]:

0 commit comments

Comments
 (0)