Skip to main content
A run is used to represent a single invocation of a job, a script or a ML experiment. You can create a run at the beginning of your script or notebook, log parameters, metrics, artifacts, models, tags and finally end the run. This provides an easy to keep track of all data related to job runs or ML experiments. A quick code snippet to create a run and end it:
You can organize multiple runs under a single ml_repo. For example, the run svm-model will be created under the ml_repo iris-demo. You can view these runs in the TrueFoundry dashboard.

TrueFoundry Dashboard

Python
You can view the tags from the dashboard and also create new tags.
Parameters are used to store the configuration of a run. This can be either the inputs to your script or the hyperparameters of your model during training like learning_rate, cache_size. The parameter values are stringified before storing.You can log parameters using the log_params as shown below:
Parameters are immutable and you cannot change the value of param once logged. If you need to change the value of param, it basically means that you are changing your input configuration and it’s best to create a new run for that.

Viewing logged parameter in dashboard

Filtering runs bases on parameter value

To filters runs, click on top right corner of the screen to apply the required filter.

Capturing command-line arguments

We can capture command-line arguments directly from the argparse.Namespace object.
Metrics are values that help you to evaluate and compare different runs - for e.g. accuracy, f1 score. You can log any output of your script as a metric.You can capture metrics using the log_metrics method.
These metrics can be seen in Truefoundry dashboard. Filters can be used on metrics values to filter out runs as shown in the figure.

Metrics Overview

Filter runs on the basis of metrics

Step-wise metric logging

You can capture step-wise metrics too using the step argument.
The stepwise-metrics can be visualized as graphs in the dashboard.

Step-wise metrics

Should I use epoch or global step as a value for the step argument?

If available you should use the global step as a value for the step argument. To capture epoch-level metric aggregates, you can use the following pattern.

Accessing Runs in TrueFoundry

To interact with runs in TrueFoundry, you can use the provided methods in the TrueFoundryClient class. Here are the different possibilities to access runs:
To retrieve an existing run by its ID, use theget_run_by_id method:
If you have the fully qualified name (FQN) of a run, which follows the pattern tenant_name/ml_repo/run_name, you can use the get_run_by_fqn method:
Python
To retrieve all the runs’ names and IDs for a project, use the get_all_runs method:
Python
You can search for runs that match specific criteria using the search_runs method:
Python
You can use the get_tags method. It returns a dictionary.
You can use the get_params method. It returns a dictionary
You can use the get_metricsmethod. It returns a dictionary.

FAQs

You will need to have minimum of Project Editor role to create a run under a ml_repo. Project Viewer role does not have permission to create a run.
Yes, we can use runs as a context manager. A run will be automatically ended after the execution exits the with block.
Yes. run names under a ml_repo are unique. If a run name already exists, we add a suffix to make it unique.
If you do not pass a run name while creating a run, we generate a random name.
Runs are identified by by their id.