Integrate SwanLab for offline/online experiment tracking and local visualization #36433
+223
−9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR introduces SwanLab, a lightweight open-source experiment tracking tool, as a new logging option for the training framework. The integration provides both online and offline tracking capabilities, along with a local dashboard for visualizing results.
SwanLab has previously supported tracking the Transformers training framework through external callbacks (find more information here), serving a wide range of users—especially those in regions with limited network connectivity, such as China. With this official integration, we aim to further enhance the developer experience by making tracking more seamless and user-friendly.
Additional information about this PR is a detailed overview of the changes and usage instructions.
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
@SunMarc I have reviewed recent merges related to training tracking, and it seems that you are the most relevant reviewer for this PR. Could you please help review it or forward it to the appropriate person? Thank you!
Additional information about this PR
Key Features of SwanLab Integration
1. Online and Offline Tracking:
2. Hardware Monitoring:
3. Remote Access:
4. Local Dashboard:
Usage guidline
Step 0: Set Up code and environment
Following the transformers official text classification example:
Step 1: Set Up SwanLab Online Tracking
Install:
To use SwanLab's online tracking, log in to the SwanLab website and obtain your API key from the Settings page. Then, authenticate using the following command:
If you prefer offline mode, skip this step.
Step 2: Configure SwanLab as the Logger and run example
To enable SwanLab as the experiment tracker, add
--use_swanlab
to your training command. For example, using the workflow:visualization demo
If you want to use local tracking, you simply set environment variable following:
Alternatively, you can configure SwanLab using environment variables:
Step 3: View Training Logs
After logging in, you will see a confirmation message:
For more details, refer to the SwanLab Cloud Documentation.
here for more information.
For advanced configurations, such as setting a custom port, refer to the Offline Dashboard Documentation and CLI Documentation.