Skip to content

fix swanlab get_run#9547

Merged
hjh0119 merged 3 commits into
modelscope:mainfrom
hjh0119:fix-swanlab
Jun 12, 2026
Merged

fix swanlab get_run#9547
hjh0119 merged 3 commits into
modelscope:mainfrom
hjh0119:fix-swanlab

Conversation

@hjh0119

@hjh0119 hjh0119 commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a helper function swanlab_get_run in swift/utils/utils.py to safely retrieve the current SwanLab run and replaces direct calls to swanlab.get_run() across various RLHF trainers. The review feedback points out that if swanlab is not installed, importing it inside swanlab_get_run will raise a ModuleNotFoundError. It suggests wrapping the import statement in the try-except block and catching ImportError alongside RuntimeError to prevent potential crashes.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread swift/utils/utils.py
@hjh0119 hjh0119 merged commit b7e15af into modelscope:main Jun 12, 2026
2 of 3 checks passed
@hjh0119 hjh0119 deleted the fix-swanlab branch June 12, 2026 11:34
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.

3 participants