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

Fix comet logger to log after train #892

Merged
merged 2 commits into from
Feb 22, 2020

Conversation

fdelrio89
Copy link
Contributor

What does this PR do?

Fixes issue #760.

Updates the CometLogger class for it to support logging data after the training is done. For this an ExistingCometExperiment is created inside the CometLogger object once the training is finalized. When this happens, CometExperiment.end is called, which makes this object not to log any more data.

PR review

Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.

@fdelrio89
Copy link
Contributor Author

Some tests failed, but I'm not really sure why. Looks like nothing related to what I change though...

@rank_zero_only
def finalize(self, status):
self.experiment.end()
self.reset_experiment()
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the need for setting self._experiment to None?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When calling self.experiment.end(), that experiment won't log any more data to Comet (that was issue #760 about). That's why, if you need to log any more data you need to create an ExistingCometExperiment. For example, to log data when testing your model after training, because when training is finalized CometLogger.finalize is called.

With this PR, this happens automatically in the CometLogger.experiment property, when self._experiment is set to None.

Tell me if anything is not clear yet :)

Copy link
Member

Choose a reason for hiding this comment

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

I think it would be nice to write this your explanation also to code as a comment for future... 🤖

@xssChauhan
Copy link
Contributor

@fdelrio89 Thanks! The PR seems to work.

@Borda Borda added the bug Something isn't working label Feb 21, 2020
Copy link
Member

@Borda Borda left a comment

Choose a reason for hiding this comment

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

LGTM, just write the reasoning for the existing experiment (copy-paste)

@rank_zero_only
def finalize(self, status):
self.experiment.end()
self.reset_experiment()
Copy link
Member

Choose a reason for hiding this comment

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

I think it would be nice to write this your explanation also to code as a comment for future... 🤖

@Borda Borda added the ready PRs ready to be merged label Feb 21, 2020
Explains the need to use CometExistingExperiment in the CometLogger class after
CometLogger.finalize.
@pep8speaks
Copy link

Hello @fdelrio89! Thanks for updating this PR.

Line 182:101: E501 line too long (117 > 100 characters)
Line 183:101: E501 line too long (118 > 100 characters)
Line 186:101: E501 line too long (111 > 100 characters)

@fdelrio89
Copy link
Contributor Author

fdelrio89 commented Feb 22, 2020

LGTM, just write the reasoning for the existing experiment (copy-paste)

Good idea @Borda, I already uploaded this change to the PR. Let me know if there's anything else I can do to improve this code ✌️

@williamFalcon williamFalcon merged commit 4ac9925 into Lightning-AI:master Feb 22, 2020
@Borda Borda added this to the 0.7.0 milestone Mar 7, 2020
tullie pushed a commit to tullie/pytorch-lightning that referenced this pull request Apr 3, 2020
* Fix comet logger to log after train

* Add clarifying comment to COmetLogger code

Explains the need to use CometExistingExperiment in the CometLogger class after
CometLogger.finalize.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ready PRs ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants