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.
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-xxx
INFO
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>