Experiment Metadata
Requires swanlab>=0.3.25 to obtain experiment metadata.
There are times when you want to retrieve experiment metadata in your code, such as the project name, ID, experiment name, URL, etc.
Here's how to do it:
python
import swanlab
run = swanlab.init(
project="test-project",
experiment="test-exp",
)
# Print all metadata
print(run.public.json())
# Print individual metadata
print(run.public.project_name)
print(run.public.cloud.experiment_url)
The run
class returned by swanlab.init
carries a public
attribute, which replaces the previous settings
attribute. It returns:
project_name
: The name of the current running projectversion
: The current version of swanlab being usedrun_id
: A unique IDswanlog_dir
: The directory where swanlab saves filesrun_dir
: The directory where the current experiment is savedcloud
: Information related to the cloud environmentavailable
: Whether it is running in cloud mode. If not, all the following attributes will be None.project_name
: The name of the current running projectproject_url
: The URL of the current running project in the cloudexperiment_name
: The name of the current running experimentexperiment_url
: The URL of the current running experiment in the cloud