-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Lite: Support self.log
from a LightningModule
#16311
Lite: Support self.log
from a LightningModule
#16311
Conversation
aae1ebb
to
b30b51e
Compare
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.
LGTM in general. One thing: should we warn the user the first time they pass in unsupported arguments? Otherwise, this may silently lead to unexpected behavior
I initially wanted to do that. But it would add quite some code to do this correctly and nicely, with added complexity. As a consequence, all types and default values would change in the signature to |
Co-authored-by: Carlos Mocholí <[email protected]>
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Head branch was pushed to by a user without write access
Head branch was pushed to by a user without write access
What does this PR do?
Enables LightningModule users to call
self.log()
andself.log_dict()
in any hook when used together with Fabric.torchmetrics.Metric
object. You need to call.compute()
yourself at the right time. This is not a limitation, this is a feature. Sincecompute()
is expensive, Fabric users need to control themselves when to do it.self.log
namely: prog_bar, on_step, on_epoch, reduce_fx, enable_graph, add_dataloader_idx, batch_size, sync_dist, sync_dist_fn, sync_dist_group, metric_attribute, rank_zero_only. Supporting them would require making assumptions about loop structure and features that do not exist, and will never exist in Fabric. We silently ignore them.Before submitting
PR review
Anyone in the community is free to review the PR once the tests have passed.
Before you start reviewing make sure you have read Review guidelines. In short, see the following bullet-list:
Did you have fun?
I made sure I had fun coding 🙃