feat: support wandb project env#1469
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the WandbLogger initialization in diffsynth/diffusion/logger.py to allow setting the Weights & Biases project name via the WANDB_PROJECT environment variable. The reviewer noted that this environment variable would override an explicitly passed project_name argument, and suggested only falling back to the environment variable if the default project name is used.
|
@firefighter-eric Thanks for your contribution. We will add this parameter to the parsers immediately, and also support configure this parameter in SwanLab. |
Thanks for merging this and for planning parser / SwanLab support. One related follow-up request: it would be very helpful if DiffSynth could log more training runtime metrics to W&B / SwanLab, not only the basic training metrics. For example:
These metrics would make it much easier to monitor training performance and diagnose runtime bottlenecks. |
This PR allows the W&B logger to respect the WANDB_PROJECT
environment variable.
Previously, WandbLogger always used the explicit
project_name argument passed to wandb.init(), which
defaulted to DiffSynth-Studio. This meant that setting
WANDB_PROJECT in the environment did not change the W&B
project name.
With this change, WandbLogger reads WANDB_PROJECT before
calling wandb.init(), while preserving the existing default
behavior when the environment variable is not set.
Changes:
Validation:
这个 PR 让 W&B logger 支持读取 WANDB_PROJECT 环境变量。
之前 WandbLogger 会把显式传入的 project_name 传给
wandb.init(),默认值是 DiffSynth-Studio。因此即使用户在环境
变量里设置了 WANDB_PROJECT,W&B project 名称也不会被覆盖。
这个改动会在调用 wandb.init() 前读取 WANDB_PROJECT。如果没
有设置该环境变量,则保持原来的默认行为不变。
变更内容:
验证:
logger.py