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.

Lightning CLI not working with WandbLogger

See original GitHub issue

🐛 Bug

Using Lightning CLI with --trainer.logger=WandbLogger results in the following error:

ValueError: Value "Namespace(class_path='pytorch_lightning.loggers.WandbLogger', init_args=Namespace(agg_default_func=None, agg_key_funcs=None, anonymous=None, experiment=None, id=None, log_model=False, name=None, offline=False, prefix='', project=None, save_dir='/tmp/save_dir', version=None))" does not validate against any of the types in typing.Union[pytorch_lightning.loggers.base.LightningLoggerBase, typing.Iterable[pytorch_lightning.loggers.base.LightningLoggerBase], bool]:
  - init() got an unexpected keyword argument 'agg_key_funcs'
  - Expected a List but got "Namespace(class_path='pytorch_lightning.loggers.WandbLogger', init_args=Namespace(agg_default_func=None, agg_key_funcs=None, anonymous=None, experiment=None, id=None, log_model=False, name=None, offline=False, prefix='', project=None, save_dir='/tmp/save_dir', version=None))"
  - Expected a <class 'bool'> but got "Namespace(class_path='pytorch_lightning.loggers.WandbLogger', init_args=Namespace(agg_default_func=None, agg_key_funcs=None, anonymous=None, experiment=None, id=None, log_model=False, name=None, offline=False, prefix='', project=None, save_dir='/tmp/save_dir', version=None))"

To Reproduce

https://colab.research.google.com/gist/cifkao/eb6b18cf2b30f9b617b5cdc3146a1cb1/bug_report_model.ipynb

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.6.0
    • tqdm: 4.63.0
  • System:
    • OS: Linux
    • architecture:
      • 64bit
    • processor: x86_64
    • python: 3.7.13
    • version: # 1 SMP Tue Dec 7 09:58:10 PST 2021

cc @awaelchli @morganmcg1 @AyushExel @borisdayma @scottire @manangoel99 @carmocca @mauvilsa

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
tshu-wcommented, Apr 11, 2022
1reaction
cifkaocommented, Apr 11, 2022

Workaround:

def before_instantiate_classes(self):
    config = self.config[self.subcommand]
    logger = config.trainer.logger
    del logger.init_args.agg_key_funcs, logger.init_args.agg_default_func
Read more comments on GitHub >

github_iconTop Results From Across the Web

Support for Weights and Biases logger (and possibly others ...
Currently, instantiating a weights and biases logger from lightning CLI is not supported, and causes an error:.
Read more >
WandbLogger — PyTorch Lightning 1.8.5.post0 documentation
A new W&B run will be created when training starts if you have not created one manually before with wandb.init() . Log metrics....
Read more >
Improved Lightning External Loggers
Lightning 1.5 adds new methods to WandbLogger that help you elevate your logging experience inside PL by giving you the ability to monitor...
Read more >
PyTorch Lightning - Documentation - Weights & Biases - WandB
PyTorch Lightning has a WandbLogger class that can be used to seamlessly log metrics, model weights, media and more. Just instantiate the WandbLogger...
Read more >
pytorch lightning wandb
Pytorch Lightning Wandbloggers import WandbLogger from pytorch_lightning import Trainer ... This is however a problem for multi-gpu training as the wandb…
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