Skip to main content
The following example demonstrates how to use the TrueFoundry Huggingface TrainerCallback to automatically log metrics and checkpoints to TrueFoundry. As an example, we will train a small language model on a small dataset but you can use this callback for any model. We also log the model at the end of the training.

Training Script with Huggingface Trainer Callback

TrueFoundryMLCallback is available in truefoundry>=0.11.4
Please choose logging_steps and save_steps in TrainingArguments carefully.
  • logging_steps controls how often the metrics are logged
  • save_steps controls how often the checkpoints are uploaded
train.py

Running the script

  1. Create a ML Repo if not already created
  2. Setup TrueFoundry CLI
  3. Run the script

Viewing the Run on UI

If you ran the script as a TrueFoundry Job, you can access the run in the Job Details column of job run

Click on the Run Name to view the run details

Navigate to the ML Repo, you should see the run in the Runs Tab. All metrics, checkpoints and models should be available in this run.

Run Details

Metrics

Checkpoints

Models