Lightning-AI / pytorch-lightning

Pretrain, finetune and deploy AI models on multiple GPUs, TPUs with zero code changes.
https://lightning.ai
Apache License 2.0
27.54k stars 3.3k forks source link

Console output failed to be logged with offline WandbLogger #14173

Open JinchaoLove opened 1 year ago

JinchaoLove commented 1 year ago

🐛 Bug

To Reproduce

https://colab.research.google.com/drive/1k-wWyw-_8P987-Ay7n-rtEZiGU2pIrev#scrollTo=zK7-Gg69kMnG

Expected behavior

The wandb will save the console outputs in the file wandb/latest-run/files/output.log, but no such file when using WandbLogger.

Environment

Additional context

Wandb related: https://github.com/wandb/wandb/issues/3978

cc @awaelchli @morganmcg1 @borisdayma @scottire @parambharat @manangoel99

awaelchli commented 1 year ago

@JinchaoLove You never passed the logger to the Trainer. You are missing

Trainer(
    ...
    logger=wblogger,
)

Once you do that, the logs will be written to the wandb folder.

image
JinchaoLove commented 1 year ago

Hi @awaelchli , thanks for the kind reply. I've updated the code in colab. It's expected to log all console outputs and be saved in wandb/lastest-run/files/output.log, but it's still missing. (It's in the files subfolder, not the logs subfolder). Below are the different logs using WandbLogger with pl.Trainer (bug: no output.log) and self-implemented WandbLogger with pl.lite.LightningLite (normally generated output.log).

JinchaoLove commented 1 year ago
awaelchli commented 1 year ago

@JinchaoLove Thanks. This is very strange, I can't tell exactly what could be the reason for this. I will have to compare what happens with using raw wandb api calls vs. using the WandbLogger wrapper.

stale[bot] commented 1 year ago

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 - the Lightning Team!