A. Make it possible to initialize wandb outside Trainer class.
B. Add use_wandb argument to the Trainer arguments.
A. Currently, wandb inside Trainer configuration if very limited. There are only three environment variables WANDB_WATCH, WANDB_PROJECT, and WANDB_DISABLED. (And WANDB_DISABLED does not work properly in some cases).
Making it possible to initialize wandb outside Trainer will allow us to:
wandb.log more safely outside the Transformers codeIt will also make the interaction with wandb more clear.
B. It is a much more clear interface then an env variable. The question here is which option should have the priority?
There's a picture in my mind about how to do this and not to destroy backward compatibility. I can make a PR, but maybe need some minor help on writing tests.
Yeah I agree with the motivations here. From my experience I like to initialize wandb as soon as the main script starts which has benefits like
Doesn't it work already when initializing wandb outside?
I believe that wandb.init does not create a new run if one is already running so all the functions should be available anywhere in the script.
When looking over the code, I was pretty sure it will initialize a new run. However, I checked and everything (mentioned in the issue) works smoothly.
Ok, thanks for checking @Guitaricet
Most helpful comment
When looking over the code, I was pretty sure it will initialize a new run. However, I checked and everything (mentioned in the issue) works smoothly.