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

Improve LightningCLI documentation and tests #7156

Merged
merged 6 commits into from
Apr 28, 2021
Merged

Improve LightningCLI documentation and tests #7156

merged 6 commits into from
Apr 28, 2021

Conversation

mauvilsa
Copy link
Contributor

@mauvilsa mauvilsa commented Apr 22, 2021

What does this PR do?

  • Added cli unit tests for help, print_config and submodules.
  • Added to cli documentation use of subclass help and print_config, submodules and other minor improvements.
  • Increased minimum jsonargparse version required for new documented features.

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?

Make sure you had fun coding 🙃

- Added to cli documentation use of subclass help and print_config, submodules and other minor improvements.
- Increased minimum jsonargparse version required for new documented features.
@codecov
Copy link

codecov bot commented Apr 22, 2021

Codecov Report

Merging #7156 (4daf5d4) into master (8439aea) will decrease coverage by 8%.
The diff coverage is n/a.

@@           Coverage Diff            @@
##           master   #7156     +/-   ##
========================================
- Coverage      92%     83%     -8%     
========================================
  Files         197     198      +1     
  Lines       12629   13376    +747     
========================================
- Hits        11611   11161    -450     
- Misses       1018    2215   +1197     

@mauvilsa mauvilsa marked this pull request as ready for review April 23, 2021 07:55
@awaelchli awaelchli added docs Documentation related ci Continuous Integration labels Apr 23, 2021
@awaelchli awaelchli added this to the v1.3 milestone Apr 23, 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.

lgtm :)

docs/source/common/lightning_cli.rst Show resolved Hide resolved
tests/utilities/test_cli.py Show resolved Hide resolved
@carmocca carmocca added the ready PRs ready to be merged label Apr 23, 2021
@mergify mergify bot removed the has conflicts label Apr 23, 2021
@carmocca carmocca changed the title LightningCLI documentation and unit tests improvements Improve LightningCLI documentation and tests Apr 23, 2021
@carmocca carmocca enabled auto-merge (squash) April 23, 2021 12:47
auto-merge was automatically disabled April 26, 2021 06:06

Head branch was pushed to by a user without write access

Copy link
Contributor

@tchaton tchaton left a comment

Choose a reason for hiding this comment

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

LGTM !

docs/source/common/lightning_cli.rst Show resolved Hide resolved
@tchaton tchaton merged commit 78d45a1 into Lightning-AI:master Apr 28, 2021
@tchaton
Copy link
Contributor

tchaton commented Apr 28, 2021

Hey @mauvilsa,

Do we think we should consider create a LightningCLIStore.

This would be used to register LightningCLI LightningModule / DataModule.

Example:

# register pair of LightningModule / DataModule
LightningCLIStore.register(VisionModel, MnistDataModule)
LightningCLIStore.register(VisionModel, CIFAR10DataModule)
LightningCLIStore.register(VisionModel, ImagenetteDataModule)
LightningCLIStore.register(VisionModel2, ImagenetteDataModule)


# in train.py
client = LightningCLIStore()

From the command line:

1 / Get the store pairs

python train.py -h 
available:
VisionModel, MnistDataModule
VisionModel, CIFAR10DataModule
VisionModel, ImagenetteDataModule
VisionModel2, ImagenetteDataModule

2 / Filter on the class name

python train.py -h model=visionModel
available:
VisionModel, MnistDataModule
VisionModel, CIFAR10DataModule
VisionModel, ImagenetteDataModule
python train.py -h data= CIFAR10DataModule
available:
VisionModel, CIFAR10DataModule

3 / Normal LightningCLI

python train.py model=VisionModel2 data= ImagenetteDataModule  -h
....

@mauvilsa mauvilsa deleted the cli-doc-tests-improvements branch April 28, 2021 08:41
@tchaton
Copy link
Contributor

tchaton commented Apr 28, 2021

@mauvilsa Opened a feature request there: #7250.
Happy to get your thoughts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci Continuous Integration docs Documentation related ready PRs ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants