question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

run=False in CLI prevents some config keys from being accepted

See original GitHub issue

🐛 Bug

Instantiating LightningCLI with run=False prevents some config keys (namely seed_everything and ckpt_path) from being accepted. This seems to be because these config keys are defined by a subcommand parser, and these are not initialized when run=False is passed.

This makes it impossible to load config files created by Lightning during training since they contain the seed_everything ckpt_path key.

To Reproduce

Boring model

error: 'Configuration check failed :: No action for destination key "ckpt_path" to check its value.'

Expected behavior

Should run without error.

Environment

  • CUDA:
    • GPU:
      • Tesla K80
    • available: True
    • version: 11.1
  • Packages:
    • numpy: 1.21.5
    • pyTorch_debug: False
    • pyTorch_version: 1.10.0+cu111
    • pytorch-lightning: 1.5.10
    • tqdm: 4.63.0
  • System:
    • OS: Linux
    • architecture:
      • 64bit
    • processor: x86_64
    • python: 3.7.12
    • version: # 1 SMP Tue Dec 7 09:58:10 PST 2021

cc @carmocca @mauvilsa

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
mauvilsacommented, Mar 13, 2022

LightningCLI is a class intended to ease the implementation of command line tools. Any change in the python source code in general is a new CLI. For more context also read lightning_cli.html#notes-related-to-reproducibility.

With run=False only the classes are instantiated. It is up to the developer to implement which and how the Trainer methods are called. And to add to the argument parser any additional needed parameters.

0reactions
JiangWenPLcommented, Apr 27, 2022

I would say loading a model from a configuration file in jupyter notebook is a quite common scenario for many research projects. For example, we may want to create colab demo for our research projects or run some interactive visualization or experiment on downstream tasks with our model. A simple workaround for current version could be something like this:

class NBCLI(LightningCLI):
    def fit(self, *args, **kwargs):
        pass

You just need to instantiate this CLI instead of the CLI you are currently using. But still I think it would be good if those scenarios can be addressed by the LightningCLI or have some documentations or examples to make the LightningCLI much easier to use for researchers. I would like to help if you think instantiating the model with CLI follows the philosophy of this library.

Read more comments on GitHub >

github_iconTop Results From Across the Web

run=False in CLI prevents some config keys from being ...
Bug Instantiating LightningCLI with run=False prevents some config keys (namely seed_everything and ckpt_path) from being accepted.
Read more >
Lightning CLI and config files
Lightning CLI and config files. Another source of boilerplate code that Lightning can help to reduce is in the implementation of command line...
Read more >
Configuration basics - AWS Command Line Interface
This section explains how to quickly configure basic settings using the config and credentials files that the AWS Command Line Interface (AWS CLI)...
Read more >
Command Line Reference | SSN Docs
It is used once a series of configuration changes have been made, and an administrator wishes to "activate" those configuration changes. When run...
Read more >
Specifying that keys are used only once
You can use the command-line interface or REST interface to set the ... Turning on this flag can cause key serving to stop...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found