accelerate icon indicating copy to clipboard operation
accelerate copied to clipboard

Duplicate W&B initialization in offline mode

Open ShuyUSTC opened this issue 2 months ago • 3 comments

System Info

- `Accelerate` version: 1.10.1

Information

  • [x] The official example scripts
  • [x] My own modified scripts

Tasks

  • [x] One of the scripts in the examples/ folder of Accelerate or an officially supported no_trainer script in the examples folder of the transformers repo (such as run_no_trainer_glue.py)
  • [ ] My own task or dataset (give details below)

Reproduction

When using Accelerate with wandb in offline mode, two separate W&B runs are created for a single training process. This happens because both the start and the store_init_configuration method of WandBTracker call wandb.init(), which leads to redundant initialization.

https://github.com/huggingface/accelerate/blob/a12beee389f6bd37cfae0aba233db03f375f7f80/src/accelerate/tracking.py#L318-L325

https://github.com/huggingface/accelerate/blob/a12beee389f6bd37cfae0aba233db03f375f7f80/src/accelerate/tracking.py#L343-L350

Is there any plan to refine the duplication?

Expected behavior

initialize wandb run only 1 time

ShuyUSTC avatar Oct 23 '25 02:10 ShuyUSTC

Indeed, this was changed due to this PR but we should probably revert it. Would you like to try fix the issue ? I think that for offline mode, it will be eaiser to just prompt the user to pass the config in init_kwargs init_kwargs={"wandb": {"config": {"dropout": "abc"}}} https://github.com/huggingface/accelerate/pull/3648 https://github.com/huggingface/accelerate/issues/3607

SunMarc avatar Nov 13 '25 15:11 SunMarc

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

github-actions[bot] avatar Dec 08 '25 15:12 github-actions[bot]

Hi @SunMarc , I have added a PR for this issue, please review and suggest any changes if required.

shantanugupta2004 avatar Dec 14 '25 07:12 shantanugupta2004