-
Notifications
You must be signed in to change notification settings - Fork 27.7k
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
Add an option to reduce compile() console spam #23938
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.
Or maybe we just make the warning an info?
The documentation is not available anymore as the PR was closed or merged. |
I think we tried that, but then most users would miss it! I think we definitely want to make users aware of what's going on (because this is the one big place we diverge from the Keras training standard), but give them an option to disable the warning once they know. |
I think proper documentation is a better solution than throwing a warning all the time. Users are pretty mad at us with those already. |
This could be a good opportunity to document stuff, actually! Do you prefer a sidebar tutorial, or some text in the docstring that gets added to all of our TF models? |
I think in the official examples where we actually use |
This is TF compilation, not |
Sorry I meant |
Done! I added a comment when we call I moved the warning message to |
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.
Those and the task examples in the doc too if you don't mind :-)
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!
3bf5288
to
34db40c
Compare
* Add an option to reduce compile() console spam * Add annotations to the example scripts * Add notes to the quicktour docs as well * minor fix
* Add an option to reduce compile() console spam * Add annotations to the example scripts * Add notes to the quicktour docs as well * minor fix
This is a very simple PR to add an option to reduce the console spam from our
compile()
method.Briefly, Keras model expect you to pass a loss function to
compile()
. However,transformers
models usually compute loss internally. The solution we used was that if the user didn't pass aloss
argument tocompile()
, we would read the model'sloss
output and use that as the loss. This was non-standard Keras behaviour, though, so we added a warning to make sure users knew what was going on.Now that we've been doing it for a while, though, that warning is probably just more console spam. This PR adds the option to specify
loss="auto"
, which has exactly the same behaviour but eliminates the warning. The warning also includes a line telling users that they can do that.