fix swanlab get_run#9547
Conversation
There was a problem hiding this comment.
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.
No description provided.