Skip to content

Commit

Permalink
warning only for na
Browse files Browse the repository at this point in the history
  • Loading branch information
kshitij12345 authored Jul 27, 2023
1 parent 30caef2 commit de5ec04
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/neptune_fastai/impl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,16 @@ def _batch_size(self) -> int:

@property
def _optimizer_name(self) -> Optional[str]:
optim_name = getattr(self.opt_func, "__name__", "N/A")
warning_msg = (
"NeptuneCallback: Couldn't retrieve the optimizer name, "
"so it will be logged as 'N/A'. You can set the optimizer "
"name by assigning it to the __name__ attribute. "
"Eg. >>> optimizer.__name__ = 'NAME'"
)
warnings.warn(warning_msg)
NA = "N/A"
optim_name = getattr(self.opt_func, "__name__", NA)
if optim_name == NA:
warning_msg = (
"NeptuneCallback: Couldn't retrieve the optimizer name, "
"so it will be logged as 'N/A'. You can set the optimizer "
"name by assigning it to the __name__ attribute. "
"Eg. >>> optimizer.__name__ = 'NAME'"
)
warnings.warn(warning_msg)
return optim_name

@property
Expand Down

0 comments on commit de5ec04

Please sign in to comment.