Skip to content

Conversation

@mauvilsa
Copy link
Contributor

@mauvilsa mauvilsa commented Apr 30, 2021

What does this PR do?

It can be a common use case that both the model and data module classes require the same input parameter. This pull request updates the computer_vision_fine_tuning.py by using LightningCLI and linking parameters. Also the LightningCLI documentation is updated explaining this.

There is also a change in the LightningCLI methods. The linking must be done after adding all arguments. But the method to override for adding arguments was run before the add of core arguments. Furthermore it makes sense that in the same method arguments are added and links are configured, see computer_vision_fine_tuning.py#L276-L286. So the add_arguments_to_parser method was moved after the core arguments and the before_parse_arguments was removed since it was redundant.

The linking of arguments was briefly discussed in #6862.

Before submitting

  • Was this discussed/approved via a GitHub issue? (not for typos and docs)
  • 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?
  • Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests? (not for typos and docs)
  • Did you verify new and existing tests pass locally with your changes?
  • Did you update the CHANGELOG? (not for typos, docs, test updates, or internal minor changes/refactorings)

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

Did you have fun?

Always 🙃

- Added documentation for linking of arguments in LightningCLI.
@codecov
Copy link

codecov bot commented Apr 30, 2021

Codecov Report

Merging #7299 (d07f0f0) into master (393b252) will decrease coverage by 4%.
The diff coverage is 100%.

@@           Coverage Diff           @@
##           master   #7299    +/-   ##
=======================================
- Coverage      91%     87%    -4%     
=======================================
  Files         200     200            
  Lines       12875   12873     -2     
=======================================
- Hits        11765   11240   -525     
- Misses       1110    1633   +523     

@mauvilsa mauvilsa marked this pull request as ready for review May 3, 2021 06:07
@carmocca carmocca added argparse (removed) Related to argument parsing (argparse, Hydra, ...) docs Documentation related example labels May 3, 2021
@carmocca carmocca added this to the v1.3 milestone May 3, 2021
Copy link
Contributor

@awaelchli awaelchli left a comment

Choose a reason for hiding this comment

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

Maybe also bump the jsonargparse version? It's anyway new for 1.3. I Had to upgrade when running the example.

@carmocca carmocca added the ready PRs ready to be merged label May 3, 2021
@awaelchli awaelchli enabled auto-merge (squash) May 3, 2021 19:59
@awaelchli awaelchli merged commit 78a6fd5 into Lightning-AI:master May 3, 2021
@mauvilsa mauvilsa deleted the cli_link_arguments branch May 4, 2021 07:15
kaushikb11 pushed a commit to kaushikb11/pytorch-lightning that referenced this pull request May 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

argparse (removed) Related to argument parsing (argparse, Hydra, ...) docs Documentation related example ready PRs ready to be merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants