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

Write complete json log after training #1445

Merged
merged 5 commits into from
Sep 5, 2019
Merged

Write complete json log after training #1445

merged 5 commits into from
Sep 5, 2019

Conversation

bhancock8
Copy link
Member

Description of proposed changes

As part of closing the LogManager at the end of training, write the run log to file.
This appears to have been neglected before because when the log_writer is set to tensorboard (the default), the TensorBoard log is written incrementally over the course of training, whereas the json log is written all at once at the end.

Related issue(s)

Fixes #1439

Test plan

New unit test confirms that log is written at the end of training.

Checklist

Need help on these? Just ask!

  • I have read the CONTRIBUTING document.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@codecov
Copy link

codecov bot commented Sep 5, 2019

Codecov Report

Merging #1445 into master will increase coverage by 0.25%.
The diff coverage is 100%.

@@            Coverage Diff            @@
##           master   #1445      +/-   ##
=========================================
+ Coverage   97.54%   97.8%   +0.25%     
=========================================
  Files          55      55              
  Lines        1996    2140     +144     
  Branches      327     369      +42     
=========================================
+ Hits         1947    2093     +146     
+ Misses         22      19       -3     
- Partials       27      28       +1
Impacted Files Coverage Δ
...rkel/classification/training/loggers/log_writer.py 100% <100%> (ø) ⬆️
...ssification/training/loggers/tensorboard_writer.py 100% <100%> (ø) ⬆️
...kel/classification/training/loggers/log_manager.py 100% <100%> (ø) ⬆️
snorkel/classification/training/trainer.py 92.89% <100%> (ø) ⬆️
snorkel/synthetic/synthetic_data.py 100% <0%> (ø) ⬆️
snorkel/classification/multitask_classifier.py 96.53% <0%> (ø) ⬆️
snorkel/labeling/model/label_model.py 97.29% <0%> (+2.11%) ⬆️

@bhancock8 bhancock8 requested a review from a team September 5, 2019 05:44
Copy link
Member

@vincentschen vincentschen left a comment

Choose a reason for hiding this comment

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

can we clean up the naming of writing to disk on close? or at the minimum with a comment?

@@ -131,4 +131,4 @@ def write_json(self, dict_to_write: Mapping[str, Any], filename: str) -> None:

def close(self) -> None:
"""Close writer if necessary."""
pass
self.write_log("log.json")
Copy link
Member

Choose a reason for hiding this comment

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

naming-wise, this (.close) feels like the wrong place to do the actual dump to disk, it feels like some cleanup operation should be happening here instead.

If it's a special case / hard to fix class names, let's make it clear in the comments for now

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point. Refactored close() to cleanup() and added some clarifying docstrings.

Copy link
Member

@vincentschen vincentschen left a comment

Choose a reason for hiding this comment

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

nice, this feels clearer!

@bhancock8 bhancock8 merged commit 77f49b4 into master Sep 5, 2019
@bhancock8 bhancock8 deleted the issue_1439 branch September 5, 2019 20:10
@Peter-Devine
Copy link

Much thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Logging functions do not get called
3 participants