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

LightningCLI shouldn't run fit by default #8615

Closed
tchaton opened this issue Jul 29, 2021 · 4 comments · Fixed by #8751
Closed

LightningCLI shouldn't run fit by default #8615

tchaton opened this issue Jul 29, 2021 · 4 comments · Fixed by #8751
Labels
feature Is an improvement or enhancement help wanted Open to be worked on priority: 1 Medium priority task won't fix This will not be worked on

Comments

@tchaton
Copy link
Contributor

tchaton commented Jul 29, 2021

🐛 Bug

To Reproduce

Currently, the LightingCLI runs fit by default which is an anti-pattern for the Lightning API and seems like magic.

Current implementation.

    cli = LightningCLI(LiftModel, MnistDataModule)
    cli.trainer.test(datamodule=cli.datamodule)
    cli.trainer.save_checkpoint("mnist_cnn.pt")

Expected implementation.

    cli = LightningCLI(LiftModel, MnistDataModule)
    cli.trainer.fit(cli.model, datamodule=cli.datamodule)
    cli.trainer.test(datamodule=cli.datamodule)
    cli.trainer.save_checkpoint("mnist_cnn.pt")

Expected behavior

Environment

  • PyTorch Lightning Version (e.g., 1.3.0):
  • PyTorch Version (e.g., 1.8)
  • Python version:
  • OS (e.g., Linux):
  • CUDA/cuDNN version:
  • GPU models and configuration:
  • How you installed PyTorch (conda, pip, source):
  • If compiling from source, the output of torch.__config__.show():
  • Any other relevant information:

Additional context

@tchaton tchaton added bug Something isn't working help wanted Open to be worked on priority: 0 High priority task labels Jul 29, 2021
@ethanwharris
Copy link
Member

Seems related to #7226 (PR in #7508), #8251

@Borda Borda added priority: 1 Medium priority task and removed priority: 0 High priority task labels Jul 29, 2021
@awaelchli
Copy link
Contributor

@tchaton I think strictly this is not a bug as it is documented here right were LightningCLI is first introduced:

The instantiation of the LightningCLI class takes care of parsing command line and config file options, instantiating the classes, setting up a callback to save the config in the log directory and finally running the trainer.

I do however agree with you that this is an issue and it is also my opinion that the instantiation of LightningCLI should not run a trainer.fit.

@Borda Borda added feature Is an improvement or enhancement and removed bug Something isn't working labels Jul 29, 2021
@Borda
Copy link
Member

Borda commented Jul 29, 2021

just for the record, @tchaton #8251 (comment)
cc: @carmocca

@stale
Copy link

stale bot commented Sep 11, 2021

This issue has been automatically marked as stale because it hasn't had any recent activity. This issue will be closed in 7 days if no further activity occurs. Thank you for your contributions, Pytorch Lightning Team!

@stale stale bot added the won't fix This will not be worked on label Sep 11, 2021
@stale stale bot closed this as completed Sep 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Is an improvement or enhancement help wanted Open to be worked on priority: 1 Medium priority task won't fix This will not be worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants