Upload Offline Experiment Data
Synchronize local experiment data to SwanLab cloud/private deployment
Use Cases:
- Network interruption during training: The server lost connection for 1 hour during model training, causing SwanLab cloud records to break.
- Training environment without internet: You unfortunately discover that your company/school's training server has no internet access and doesn't allow Docker installation.
- Multi-device synchronization: You're using private deployment but also want to sync experiment records to the cloud.
- Experiment replication: The experiment is universally applicable to multiple projects you've created (e.g., baseline, benchmark experiments) and you want to replicate it across projects.
When encountering the above scenarios, the swanlab sync command can help. API Documentation.
Version Compatibility
The swanlab sync command is not backward-compatible with log files produced by older SwanLab SDK versions.
Starting from SwanLab SDK v0.8.0, the local log format underwent significant changes. Log files generated by v0.8.0 and above cannot be synced by older swanlab sync versions, and conversely, old swanlog files cannot be synced by newer SDK versions.
Before syncing, please verify that:
- The
swanlab syncCLI version matches (or is older than) the SDK version that produced the log files. - If your log files were generated by an SDK older than
v0.8.0, use that same version to runswanlab sync; do not upgrade. - If you encounter parse errors or missing data during sync, the log format is likely incompatible — install the original SDK version that generated the logs and retry.
Local Experiment Data Directory
SwanLab saves experiment log files by default in the swanlog directory of your project. You can also customize the save path using the logdir parameter. Documentation.
Each time you create an experiment, SwanLab automatically creates a run-[experiment ID] directory under swanlog and continuously records data to this directory.

Tips
This run- prefixed directory is crucial—it's the foundation for swanlab sync.
Upload Experiment Data
Locate the data directory you want to upload to the cloud, then execute the command:
swanlab sync ./swanlog/run-xxxINFO
By default, data will be synced to the project recorded in the log files (i.e., the project specified when running the experiment).
To sync to a different project, use the -p option.
If you see the following output, the upload was successful:

Sync to Original Experiment
If you don't want to create a new experiment but instead sync to the original one (it will automatically compare data and add differential parts), use the --id parameter:
swanlab sync ./swanlog/run-xxx --id <experiment ID>For how to obtain the experiment ID, see: Resume Experiment/Checkpoint Training
Batch Upload
You can use wildcards for batch uploads:
swanlab sync ./swanlog/run-*Upload to a Specific Project/Team Workspace
swanlab sync ./swanlog/run-xxx -p <project_name> -w <workspace_name>Experiment Replication Scenario
If you want an experiment to appear in multiple projects, use the above command to upload it to multiple projects.
Upload to Private Deployment
swanlab sync ./swanlog/run-xxx --h <private_deployment_address>