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

Added changeable extension variable for model checkpoints #4977

Merged
merged 20 commits into from
Dec 6, 2020
Merged

Added changeable extension variable for model checkpoints #4977

merged 20 commits into from
Dec 6, 2020

Conversation

janhenriklambrechts
Copy link
Contributor

@janhenriklambrechts janhenriklambrechts commented Dec 4, 2020

What does this PR do?

This PR adds a variable FILE_EXTENSION to ModelCheckpoint that allows the user to change the file extension of their model checkpoints as per #4963

Before submitting

  • Was this discussed/approved via a Github issue? (no need for typos and docs improvements)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together? Otherwise, we ask you to create a separate PR for every change.
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?
  • Did you verify new and existing tests pass locally with your changes?
  • If you made a notable change (that affects users), did you update the CHANGELOG?

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:

  • Is this pull request ready for review? (if not, please submit in draft mode)
  • Check that all items from Before submitting are resolved
  • Make sure the title is self-explanatory and the description concisely explains the PR
  • Add labels and milestones (and optionally projects) to the PR so it can be classified; Bugfixes should be including in bug-fix release milestones (m.f.X) and features should be included in (m.X.b) releases.

Did you have fun?

Make sure you had fun coding 🙃

@pep8speaks
Copy link

pep8speaks commented Dec 4, 2020

Hello @janhenriklambrechts! Thanks for updating this PR.

Line 274:121: E501 line too long (122 > 120 characters)

Comment last updated at 2020-12-06 12:39:27 UTC

@edenlightning edenlightning linked an issue Dec 4, 2020 that may be closed by this pull request
@edenlightning edenlightning added the feature Is an improvement or enhancement label Dec 4, 2020
@codecov
Copy link

codecov bot commented Dec 4, 2020

Codecov Report

Merging #4977 (1181a49) into master (2e838e6) will increase coverage by 0%.
The diff coverage is 100%.

@@          Coverage Diff           @@
##           master   #4977   +/-   ##
======================================
  Coverage      93%     93%           
======================================
  Files         129     129           
  Lines        9371    9372    +1     
======================================
+ Hits         8688    8689    +1     
  Misses        683     683           

@rohitgr7
Copy link
Contributor

rohitgr7 commented Dec 4, 2020

@janhenriklambrechts can you add a test for this?

@janhenriklambrechts
Copy link
Contributor Author

@rohitgr7 sure, Ill write a test

@Borda Borda added the checkpointing Related to checkpointing label Dec 4, 2020
@Borda Borda added this to the 1.1 milestone Dec 4, 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.

I think that the .ckpt is used also in other places...

@@ -140,6 +140,7 @@ class ModelCheckpoint(Callback):

CHECKPOINT_JOIN_CHAR = "-"
CHECKPOINT_NAME_LAST = "last"
FILE_EXTENSION = "ckpt"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
FILE_EXTENSION = "ckpt"
FILE_EXTENSION = ".ckpt"

lets keep the . as os.path.extsplit(...) holds it too

rohitgr7
rohitgr7 previously approved these changes Dec 5, 2020
tests/checkpointing/test_model_checkpoint.py Outdated Show resolved Hide resolved
tests/checkpointing/test_model_checkpoint.py Outdated Show resolved Hide resolved
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

tests/checkpointing/test_model_checkpoint.py Outdated Show resolved Hide resolved
@rohitgr7 rohitgr7 added the ready PRs ready to be merged label Dec 6, 2020
@rohitgr7 rohitgr7 merged commit b00991e into Lightning-AI:master Dec 6, 2020
Borda pushed a commit that referenced this pull request Dec 6, 2020
* Added changeable extension variable for model checkpoints

* Removed whitespace

* Removed the last bit of whitespace

* Wrote tests for FILE_EXTENSION

* Fixed formatting issues

* More formatting issues

* Simplify test by just using defaults

* Formatting to PEP8

* Added dummy class that inherits ModelCheckpoint; run only one batch instead of epoch for integration test

* Fixed too much whitespace formatting

* some changes

Co-authored-by: rohitgr7 <rohitgr1998@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
checkpointing Related to checkpointing feature Is an improvement or enhancement ready PRs ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom Checkpoint file extension
6 participants