-
Notifications
You must be signed in to change notification settings - Fork 650
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement logger adapter to handle different loggers (TensorBoard and Wandb for now) #816
base: main
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #816 +/- ##
==========================================
- Coverage 89.05% 88.97% -0.09%
==========================================
Files 24 28 +4
Lines 3829 3881 +52
==========================================
+ Hits 3410 3453 +43
- Misses 419 428 +9
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Think we might also have to amend the tutorial notebooks |
Yep, definitely. I'll give them a look tonight. Do you also have any tip on how to structure tests for the logger adapter? |
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
I've updated the stallion notebook so that it uses the |
Any news on this? |
There actually turns out to be a nice workaround for this. For more info see here. |
Hey @B-Deforce! That's actually pretty nice, thanks for the heads up, I didn't know about that! So, you're suggesting to replace the |
Yes @mikcnt, I was actually also struggling to get Wandb running with Pytorch Forecasting and used your implementation above (which worked great btw). But then I found this neat little feature of wandb! Yes, that's correct. Just using the standard logger (which is the |
That's terrific! Actually, my original plan was to include a large variety of loggers, not just Tensorboard or Wandb (e.g., MLFlow), but, since it appears like this won't be merged anytime soon, I guess I would go with your solution too if I were in your position! 😆 |
Description
This PR resolves #89.
loggers.ForecastingLoggerBase
) to handle different loggers (e.g., TensorBoard, Wandb) using the same syntax. This inherits from the PyTorch Lightning logger base class, and implements three new methods used across the PyTorch Forecasting project:add_figure
,add_embeddings
, andlog_gradient_flow
.loggers.ForecastingLoggerBase
, and inheriting from their PyTorch Lightning counterparts (respectivelypytorch_lightning.loggers.TensorBoardLogger
andpytorch_lightning.loggers.WandbLogger
).pytorch_lightning.loggers.TensorBoardLogger
instances with the newly createdloggers.ForecastingTensorBoardLogger
.As for the Wandb logger,
loggers.ForecastingWandbLogger
, I was wondering if someone could guide me on how to structure its tests.Moreover, notice how the
ForecastingWandbLogger
'slog_gradient_flow
method is empty. This is due to the fact that Wandb automatically logs the distribution of gradients. It is sufficient to calllogger.watch(model)
upon initialization, as in the example below:Finally, I noticed that the tests won't give all greens, even on the master branch, unless I don't move
p.grad
to the cpu inside thelog_gradient_flow
method of theBaseModel
. Again, I empathize that this is still true in the master branch.Checklist
pre-commit install
.To run hooks independent of commit, execute
pre-commit run --all-files