pytorch/ignite

Initialization of WandBLogger with `init=True` fails

zubatyuk opened this issue · 2 comments

wandb.init function does not have 'init' keyword argument.
Therefore, this code fails:

        if kwargs.get("init", True):
            wandb.init(*args, **kwargs)

Solution is to pop 'init' key from kwargs.

@zubatyuk Thanks for reporting the issue and sending a PR! Seems like init arg never existed for wandb.init function.

In pytorch-ignite code looks like it worked as no one previously tried to pass init as kwargs and by default it calls wandb.init.
In your use case are you passing it explicitly and which value do you pass?

There are two usage patterns.
1.

import wandb
from ignite.handlers import WandBLogger

wandb_logger = WandBLogger()
wandb.init(**wandb_kwargs)
wandb_log_dir = wandb.log.dir
from ignite.handlers import WandBLogger

wandb_logger = WandBLogger(init=True, **wandb_kwargs)
wandb_log_dir = wandb_logger.log.dir 

Apparently, everyone was using first pattern, even though proper __getattr__ implemented in WandBLogger.