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

Relax hparams in model loading #919

Merged
merged 1 commit into from
Feb 25, 2020
Merged

Relax hparams in model loading #919

merged 1 commit into from
Feb 25, 2020

Conversation

awaelchli
Copy link
Contributor

@awaelchli awaelchli commented Feb 23, 2020

Before submitting

  • Was this discussed/approved via a Github issue? (no need for typos, doc improvements)
  • Did you read the contributor guideline?
  • Did you make sure to update the docs?
  • Did you write any new necessary tests?
  • If you made a notable change (that affects users), did you update the CHANGELOG?

What does this PR do?

Fixes #907. Changes model loading behaviour. Four cases:

  • Case 0: Checkpoint has hparams key and user's LightningModule has hparams argument
    no change

  • Case1: Checkpoint has hparams key and user's LightningModule is missing a hparams argument
    Before: raised exception but did not tell user what's wrong
    Now: raises exception reminding the user to add hparams.

  • Case 2: Checkpoint is missing hparams key and user's LightningModule is also missing it
    Before: raised an exception
    Now: Loads the model without hparams. This is the usecase in Relax hparams in model saving/loading #907.

  • Case 3: Checkpoint is missing hparams key but user's LightningModule has it.
    Before: raised an exception
    Now: Loads the model by passing in an empty Namespace and prints a warning.

All tests pass on my single gpu machine.
Some tests fail on my notebook (lazy_dataloader problem)

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.

Did you have fun?

Make sure you had fun coding 🙃

@awaelchli awaelchli requested a review from Borda February 23, 2020 16:04
@williamFalcon williamFalcon added this to the 0.6.1 milestone Feb 25, 2020
@Borda Borda modified the milestones: 0.6.1, 0.6.2 Feb 25, 2020
@williamFalcon williamFalcon modified the milestones: 0.6.2, 0.6.1 Feb 25, 2020
relax model loading hparams


test wip


wip


fix warning


finish test


remove unused import
@williamFalcon
Copy link
Contributor

williamFalcon commented Feb 25, 2020

@awaelchli can we enable support for just passing in a dictionary instead of a namespace?
@neggert thoughts?

(in a new issue / PR)

@williamFalcon williamFalcon merged commit 20d15c8 into Lightning-AI:master Feb 25, 2020
@ethanwharris
Copy link
Member

LGTM

@williamFalcon
Copy link
Contributor

moving fast guys haha. need to get this release :)

@awaelchli awaelchli deleted the relaxv2 branch February 25, 2020 17:45
@awaelchli
Copy link
Contributor Author

@williamFalcon I will create an issue to discuss the possibility for dict instead of namespace

@Borda
Copy link
Member

Borda commented Feb 25, 2020

@awaelchli cool, could you link it here pls

@Borda Borda added docs Documentation related feature Is an improvement or enhancement labels Mar 3, 2020
tullie pushed a commit to tullie/pytorch-lightning that referenced this pull request Apr 3, 2020
relax model loading hparams


test wip


wip


fix warning


finish test


remove unused import
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation related feature Is an improvement or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Relax hparams in model saving/loading
4 participants