-
Notifications
You must be signed in to change notification settings - Fork 28.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate SwanLab for offline/online experiment tracking and local visualization #36433
base: main
Are you sure you want to change the base?
Conversation
…in transformers - Integrated SwanLab into the transformers library as an alternative for experiment tracking. - Users can now log training metrics, hyperparameters, and other experiment details to SwanLab by setting `report_to="swanlab"` in the `TrainingArguments`. - Added necessary dependencies and documentation for SwanLab integration.
012a976
to
2d9b7e2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this ! Just a few nits !
- **SWANLAB_PROJECT** (`str`, *optional*, defaults to `None`): | ||
Set this to a custom string to store results in a different project. If not specified, the name of the running | ||
directory is used. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe typo ?
- **SWANLAB_PROJECT** (`str`, *optional*, defaults to `None`): | |
Set this to a custom string to store results in a different project. If not specified, the name of the running | |
directory is used. | |
- **SWANLAB_PROJECTS** (`str`, *optional*, defaults to `None`): | |
Set this to a custom string to store results in a different project. If not specified, the name of the running | |
directory is used. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! I’ve fixed the typo.
Thanks for the review! I'll update it shortly. |
Co-authored-by: Marc Sun <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have made the required changes and fixed the typo. Thanks to @SunMarc for the review!
- **SWANLAB_PROJECT** (`str`, *optional*, defaults to `None`): | ||
Set this to a custom string to store results in a different project. If not specified, the name of the running | ||
directory is used. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! I’ve fixed the typo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for iterating !
Re-running the test succeeded. 🤔 |
@SunMarc I have updated the code and fixed the incorrect comments. After merging the latest main branch, I noticed that the automated tests seem to have failed. I checked, and it doesn't appear to be an issue caused by my changes. Could you help me restart the tests? |
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.