-
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
ref: deprecated results obj, added support for simpler comms (1/n) #3681
Conversation
Hello @williamFalcon! Thanks for updating this PR.
Comment last updated at 2020-09-28 02:48:30 UTC |
This pull request is now in conflict... :( |
pytorch_lightning/trainer/logging.py
Outdated
m = f""" | ||
The {{{k}:dict keyword}} was deprecated in 0.9.1 and will be removed in 1.0.0 | ||
Please use self.log(...) inside the lightningModule instead. | ||
|
||
# log on a step or aggregate epoch metric to the logger and/or progress bar | ||
# (inside LightningModule) | ||
self.log('train_loss', loss, on_step=True, on_epoch=True, prog_bar=True) | ||
""" |
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.
Please, do not use triple quote strings for warnings and logs since they include all the extra whitespace to the left:
>>> import warnings
>>> m1 = (
... "this is "
... "a "
... "test"
... )
>>> warnings.warn(m1)
<stdin>:1: UserWarning: this is a test
>>> m2 = """
... this
... is a
... test
... """
>>> warnings.warn(m2)
<stdin>:1: UserWarning:
this
is a
test
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.
i disagree with this...
these long strings are more readable to the user when the get this kind of warning.
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.
The problem is not that it is multiline, the problem is is that the whitespace at the beginning depends on the indentation level.
For that case in particular:
<stdin>:1: UserWarning:
The {{{k}:dict keyword}} was deprecated in 0.9.1 and will be removed in 1.0.0
Please use self.log(...) inside the lightningModule instead.
# log on a step or aggregate epoch metric to the logger and/or progress bar
# (inside LightningModule)
self.log('train_loss', loss, on_step=True, on_epoch=True, prog_bar=True)
You would have to either remove the indentation:
m = f"""
The {{{k}:dict keyword}} was deprecated in 0.9.1 and will be removed in 1.0.0
Please use self.log(...) inside the lightningModule instead.
# log on a step or aggregate epoch metric to the logger and/or progress bar
# (inside LightningModule)
self.log('train_loss', loss, on_step=True, on_epoch=True, prog_bar=True)
"""
(pretty ugly if you ask me)
or split it and print it with more than one warnings/logs
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.
I agree with @carmocca, if you need an extra line, just use \n
This pull request is now in conflict... :( |
53a461d
to
c1295bf
Compare
c1295bf
to
7e05977
Compare
…es logging from loops
…es logging from loops
…es logging from loops
…es logging from loops
…es logging from loops
…es logging from loops
2558310
to
4f6ad40
Compare
cc @ananthsub @awaelchli @justusschock
Any help appreciated and also apologies if i am making any mistake |
ok, will fix asap. thanks for reporting! mind replicating it on a boring model? @edenafek (p0) |
@nazim1021! Thank you for reporting! I created an issue to track this, would be great if you can try to repro using boring model and paste a colab link in the new issue](#4452) |
@williamFalcon @edenlightning sure, of course. Thanks for prompt reply |
Here we move to deprecate results objects in favor of simpler syntax. Results obj support will remain until 0.10.0 but not 1.0.0.
(ie: 0.10.0 is 1.0.0 but backwards compatible for anyone who really needs it).
The new pattern is to decouple logging from hooks. That means that step, step_end, epoch_end are independent from logging.
example
Passing around step results.
In the case the user still needs/wants to do something with the output of each batch, the other hooks are still there.
Hooks and .log are decoupled...
user can log from anywhere
cc @ananthsub @awaelchli @justusschock