-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e99b723
commit 3329ac7
Showing
4 changed files
with
47 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from pprobe.utils.logging import Logger | ||
from typing import Any, Callable, Optional | ||
|
||
|
||
def lr_scheduler_step_method_wrapper( | ||
original_method: Callable, epoch: Optional[int] = None | ||
): | ||
def wrapper(self) -> Any: | ||
lr = self.get_lr() | ||
Logger.info(f"[PPROBE] INIT LR ===> {lr}") | ||
return original_method(self, epoch) | ||
|
||
return wrapper | ||
|
||
|
||
def optimizer_zero_grad_method_wrapper( | ||
original_method, set_to_none: bool = True | ||
) -> None: | ||
def wrapper(self) -> Any: | ||
for group in self.param_groups: | ||
lr = group["lr"] | ||
Logger.info(f"[PPROBE] Iteration optimizer lr ===> {lr}") | ||
return original_method(self, set_to_none) | ||
|
||
return wrapper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters