Skip to main content

Prerequisites

To log data from your job runs, you need access to an ML Repository (MLRepo). ML Repositories store models, data, artifacts, and prompts and are backed by blob storage like S3, GCS, or Azure Blob Storage.

Step 1: Create or Access an ML Repository

If you don’t have an ML Repository yet, you’ll need to create one:
  1. Prerequisite - Blob Storage Integration: Before creating a Repository, connect one or more Blob Storages to TrueFoundry:
  2. Create Repository: Go to Platform → Repositories tab and create a new ML Repository

Grant ML Repository Access to Workspace

To enable your job to log data, you need to grant access to the ML Repository for your workspace:
  1. Go to Platform → Workspaces tab
  2. Edit your workspace
  3. In the “ML Repositories” section, grant access to your ML Repository
  4. Choose appropriate permissions (Viewer or Editor)

Creating Run and Logging Data

A run is used to represent a single 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 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. Once you’ve created runs and logged data, you can view them in the TrueFoundry dashboard. Navigate to your job in the Platform → Applications tab, click on the job name, and go to the “Job Runs” tab to see all executions with their status, metrics, and parameters.
Job runs dashboard showing multiple runs with different statuses including finished, terminated, and failed runs

Job Runs Dashboard - Example showing multiple runs with different statuses

Logging Different Types of Data

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 the dashboard

Filtering runs based on parameter value

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

Capturing command-line arguments in the run

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 in the run

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 in the run?

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.

Complete Examples

Here are comprehensive examples that demonstrate how to deploy a job and log data during machine learning training:
This example shows the complete training script that logs parameters, metrics, and models:

Key Features Demonstrated:

  • Parameter Logging: Hyperparameters like learning rate, epochs, and model configuration
  • Metrics Logging: Training and validation accuracy/loss for each epoch
  • Model Logging: Saved model with metadata and framework information
  • Tag Organization: Categorizing the run for easy filtering
  • Error Handling: Proper exception handling to ensure runs are marked correctly
This example shows how to deploy a parameterized job that can be run multiple times with different configurations:

Key Features:

  • Parameterized Job: Uses Param objects to make the job configurable
  • Python Build: Automatically builds the container from source code
  • Resource Configuration: Specifies CPU and memory requirements
  • ML Repository Integration: Links to an ML repository for logging

Accessing Detailed Run Information

In the Job Runs table, you’ll notice that the “RUN DETAILS” column contains clickable links. When you click on any run details link, you’ll be taken to a comprehensive view of that specific run, which includes:
  • Overview Tab: Key metrics and hyperparameters used in the run
  • Results Tab: Detailed metrics and performance data
  • Models Tab: All logged models with their metadata
  • Artifacts Tab: Files and artifacts associated with the run
Pro Tip: Use the run details view to analyze your experiments, compare different hyperparameter configurations, and track the progress of your machine learning projects over time.