Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't fail if optim name not found. #54

Merged
merged 6 commits into from
Jul 27, 2023
Merged

Conversation

kshitij12345
Copy link
Contributor

@kshitij12345 kshitij12345 commented Jul 27, 2023

@kshitij12345 kshitij12345 changed the title Fix/optim name not found Don't fail if optim name not found. Jul 27, 2023
@@ -154,7 +154,9 @@ def _batch_size(self) -> int:

@property
def _optimizer_name(self) -> Optional[str]:
return self.opt_func.__name__
optim_name = getattr(self.opt_func, "__name__", "NA")
warnings.warn("NeptuneCallback: Couldn't retrieve the optimizer name, so it will logged as 'NA'.")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"NeptuneCallback: Couldn't retrieve the optimizer name, so it will be logged as 'NA'."

or should it be 'N/A'? not sure which option will be consistent with other instances of this in Neptune, but usually this abbreviation includes a slash :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we not skip logging this field instead of logging it as NA?

The warning can also be updated to

"NeptuneCallback: Couldn't retrieve the optimizer name, so it will not be logged.
You can set the optimizer name by passing it to the __name__ attribute:
>>> optimizer.__name__ = "NAME"
"

Copy link
Contributor Author

@kshitij12345 kshitij12345 Jul 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason, I thought of logging something like NA was that if later the user has a script which fetches values from run then this would fail because it doesn't exist in this case (So changing the structure would be BC-breaking). Wdyt?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense (y)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will update the message to

"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'

Thanks!

@@ -154,7 +154,9 @@ def _batch_size(self) -> int:

@property
def _optimizer_name(self) -> Optional[str]:
return self.opt_func.__name__
optim_name = getattr(self.opt_func, "__name__", "NA")
warnings.warn("NeptuneCallback: Couldn't retrieve the optimizer name, so it will logged as 'NA'.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we not skip logging this field instead of logging it as NA?

The warning can also be updated to

"NeptuneCallback: Couldn't retrieve the optimizer name, so it will not be logged.
You can set the optimizer name by passing it to the __name__ attribute:
>>> optimizer.__name__ = "NAME"
"

@SiddhantSadangi SiddhantSadangi linked an issue Jul 27, 2023 that may be closed by this pull request
@kshitij12345 kshitij12345 merged commit 0cd7691 into master Jul 27, 2023
11 checks passed
@kshitij12345 kshitij12345 deleted the fix/optim_name_not_found branch July 27, 2023 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: fastai callback fails
3 participants