Skip to main content
App version: 3.4.11

Create an experiment

To create an experiment, use the Run() constructor.

For example, to create a run that becomes the head of the seabird-flying-skills experiment, use:

from neptune_scale import Run


if __name__ == "__main__":
run = Run(
experiment_name="seabird-flying-skills",
)
  • The custom run ID provided to the run_id argument must be unique within the project. It can't contain the / character.

  • To make the name easy to read in the app, ensure that it's at most 190 characters long.

  • The line if __name__ == "__main__": ensures safe importing of the main module. For details, see the Python documentation.

Then, to track experiment metadata, call a logging method on the Run object:

for step in epoch:
# your training loop
acc = ...
loss = ...

run.log_metrics(
data={"metrics/accuracy": acc, "metrics/loss": loss},
step=1,
)

To get a link to the experiment in the Neptune web app:

run = Run(experiment_name=...)
run.get_experiment_url()

For details, see Construct Neptune URLs.

Set target project

To specify the Neptune project, use the project argument:

run = Run(
experiment_name="seabird-flying-skills",
project="team-alpha/project-x", # replace with your workspace and project name
)

You can also save the project name as an environment variable. For details, see Get started.

Set custom run ID

To override the auto-generated run identifier with a custom one, pass a string to the run_id argument:

run = Run(
experiment_name="seabird-flying-skills",
run_id="astute-kittiwake-23",
)