Skip to content
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

feat: sync wandb #785

Merged
merged 6 commits into from
Jan 17, 2025
Merged

feat: sync wandb #785

merged 6 commits into from
Jan 17, 2025

Conversation

Zeyi-Lin
Copy link
Member

@Zeyi-Lin Zeyi-Lin commented Jan 16, 2025

Description

实现在训练时同步wandb的实验到swanlab,只需在脚本的最开头增加,即可实现跟踪:

import swanlab

swanlab.sync_wandb()

测试代码:

import wandb
import random
import swanlab

swanlab.sync_wandb()
# swanlab.init(project="sync_wandb")

wandb.init(
  project="test",
  config={"a": 1, "b": 2},
  name="test",
  )

epochs = 10
offset = random.random() / 5
for epoch in range(2, epochs):
  acc = 1 - 2 ** -epoch - random.random() / epoch - offset
  loss = 2 ** -epoch + random.random() / epoch + offset

  wandb.log({"acc": acc, "loss": loss})

Closes: #784

Details

This pull request introduces a new feature to integrate wandb (Weights & Biases) with swanlab by adding a synchronization mechanism. The changes include importing necessary modules, defining the sync_wandb function, and updating the package's initialization and export lists.

Key changes include:

Integration with wandb:

  • swanlab/sync/wandb.py: Added the sync_wandb function to synchronize wandb with swanlab, including patching wandb.init, wandb.log, and wandb.finish to integrate with swanlab's logging and configuration management.

Module and package updates:

@Zeyi-Lin Zeyi-Lin requested a review from SAKURA-CAT January 16, 2025 15:06
@Zeyi-Lin Zeyi-Lin self-assigned this Jan 16, 2025
@SAKURA-CAT SAKURA-CAT added the 💪 enhancement New feature or request label Jan 17, 2025
@SAKURA-CAT SAKURA-CAT merged commit ffaaf97 into main Jan 17, 2025
5 checks passed
@SAKURA-CAT SAKURA-CAT deleted the feat-sync-wandb branch January 17, 2025 05:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💪 enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[REQUEST] sync wandb
2 participants