Pointcept / Pointcept

Pointcept: a codebase for point cloud perception research. Latest works: PTv3 (CVPR'24 Oral), PPT (CVPR'24), OA-CNNs (CVPR'24), MSC (CVPR'23)
MIT License
1.3k stars 141 forks source link

Add Weights & Biases Support #280

Open NicoStellwag opened 1 week ago

NicoStellwag commented 1 week ago

Hi all,

this PR adds support to log experiments to Weights & Biases in addition to Tensorboard.

Advantages of wandb include:

To enable wandb logging:

The wandb module is only imported if wandb logging is enabled in the config, so wandb is an optional dependency and existing code should not break.

The abstract writer object is written such that wandb can also fully replace tensorboard to avoid redundancy, but I've decided to not pass that option through to the user yet. (Tensorboard logging is hardcoded to True in build_writer of pointcept/engines/train.py.)

Attention: Due to time constraints I did not add a wandb EventWriter to pointcept/utils/events.py yet.

If you have any questions don't hesitate to contact me! :)

Gofinge commented 1 week ago

Hi @NicoStellwag , thanks for your contribution. I will review the PR after the CVPR conference. Of course, Wandb is great, and I also want to support it. But can we make it optional and can be chosen by our users? Maybe moving the initialization of the writer into the plugin hooker is a good choice. I will also optimize your PR after CVPR.

NicoStellwag commented 1 week ago

Hi @NicoStellwag , thanks for your contribution. I will review the PR after the CVPR conference. Of course, Wandb is great, and I also want to support it. But can we make it optional and can be chosen by our users? Maybe moving the initialization of the writer into the plugin hooker is a good choice. I will also optimize your PR after CVPR.

Hi @Gofinge, the wandb logging should be fully optional as is. If no wandb config section is set (or use_wandb=False), the ExperimentWriter constructor will not import wandb. Instead, it will simply act as a wrapper around the tensorboard writer. So users that don't want to use wandb will not have to change any code and will not be required to have wandb installed.

I'm not sure what you mean by plugin hooker, to be honest. In case you mean implementing the wandb logging as a hook under pointcept/engines/hooks, I would disagree. I think in case you want to support multiple logging solutions, the logging should (for the simple default calls) be abstracted, so you don't have to log the same data manually to different systems. (Of course, that's just my personal opinion from the view of a user.)