Skip to content

Conversation

ShaohonChen
Copy link
Contributor

感谢社区用户@laniakea 报bug

image

在使用accelerate 1.7.0及以下版本会出现无法正确初始化swanlab的问题

具体表现是

[rank0]: Traceback (most recent call last):
[rank0]:   File "/home/chenshaohon/projects/accelerate/examples/complete_cv_example.py", line 331, in <module>
[rank0]:     main()
[rank0]:   File "/home/chenshaohon/projects/accelerate/examples/complete_cv_example.py", line 327, in main
[rank0]:     training_function(config, args)
[rank0]:   File "/home/chenshaohon/projects/accelerate/examples/complete_cv_example.py", line 260, in training_function
[rank0]:     accelerator.log(
[rank0]:   File "/home/chenshaohon/miniconda3/envs/acc_itg/lib/python3.12/site-packages/accelerate/accelerator.py", line 787, in _inner
[rank0]:     return PartialState().on_main_process(function)(*args, **kwargs)
[rank0]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[rank0]:   File "/home/chenshaohon/miniconda3/envs/acc_itg/lib/python3.12/site-packages/accelerate/accelerator.py", line 2999, in log
[rank0]:     tracker.log(values, step=step, **log_kwargs.get(tracker.name, {}))
[rank0]:   File "/home/chenshaohon/miniconda3/envs/acc_itg/lib/python3.12/site-packages/accelerate/tracking.py", line 81, in execute_on_main_process
[rank0]:     return PartialState().on_main_process(function)(self, *args, **kwargs)
[rank0]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[rank0]:   File "/home/chenshaohon/miniconda3/envs/acc_itg/lib/python3.12/site-packages/swanlab/integration/accelerate.py", line 114, in log
[rank0]:     self.run.log(values, step=step, **kwargs)
[rank0]:     ^^^^^^^^
[rank0]: AttributeError: 'SwanLabTracker' object has no attribute 'run'

原因是accelerate团队在1.8.0版本后调整了tracker的初始化位置,使得适配于新版本的tracker不能初始化了,目前该PR已经修复了这个问题。

image

@ShaohonChen ShaohonChen requested a review from Zeyi-Lin June 10, 2025 16:55
@ShaohonChen ShaohonChen self-assigned this Jun 10, 2025
@ShaohonChen ShaohonChen merged commit ca2aaaf into main Jun 10, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants