-
Notifications
You must be signed in to change notification settings - Fork 28.3k
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
Prevent crash with WandbCallback
with third parties
#30477
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing!
self._wandb.config["model/num_parameters"] = model.num_parameters() | ||
except AttributeError: | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add a logger.info here (feel free to change the message)? By default in transformers info level isn't logged, but might be useful if someone goes into debug mode
pass | |
logger.info("Unable to get num_parameters from model") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, resolved via a6d09f5
@tomaarsen Let me know if you need me to merge this in once CI is all green |
@amyeroberts I forget what the current merging protocol is for
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
@tomaarsen Once a core maintainer has approved, anyone is free to merge, I just forget who has permission to |
I see! Makes sense :) I'll merge it.
|
What does this PR do?
This PR fixes a dodgy if-statement introduced in #30135 that attempts to check whether a model has a
num_parameters
method. Currently, ifis True, then the model does not necessarily have a
num_parameters
method. Instead, I've replaced it with an "Easier to ask for forgiveness than permission" principle which should be much safer.This is currently breaking Sentence Transformers training with W&B.
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
@amyeroberts as she reviewed #30135
@muellerz