Skip to main content

Experiment Tracking

Experiment tracking involves systematically recording and managing details of machine learning experiments, such as code, data, configurations, parameters, metrics, and results. It ensures reproducibility, comparability, and accountability across experiments, aiding in efficient model development and deployment. Weights & Biases (wandb) is one approach to achieving this. Follow the next instructions to log experiments to your wandb account.

Setting Up the Weights and Biases Secret

To enable seamless integration with wandb in your experiments, follow these steps to create the wandb secret:
  1. Retrieve Your API Key Visit your Weights & Biases Settings page to find your API key. Copy the key for use in the next step.
  2. Create the Secret Use the flexai secret create command to store your wandb API key as a secret. Replace <WANDB_API_KEY_SECRET_NAME> with your desired name for the secret:
    Then past your wandb API key value.
  3. Note on Project Name Keep in mind that the project name used in your wandb setup does not need to be an FlexAI Secret. Additionally, the project name does not need to be pre-created in wandb β€” it will be automatically created if it doesn’t exist when you log your first experiment.

Log to Weights and Biases

You can now log experiments to your wandb account by adding the following flags to any flexai training run command:
You can optionally set your run name using the --run_name <YOUR_RUN_NAME> HuggingFace arg. For more ways to customize and configure your wandb environment, check out the Weights & Biases Environment Variables Guide.

Setting Up the Experiment

1

Connect to GitHub (if needed)

If you haven’t already connected FlexAI to GitHub, you’ll need to set up a code registry connection:
This will allow FlexAI to pull repositories directly from GitHub using the -u flag in training commands.
2

Preparing the Dataset

In this experiment, we will use a pre-processed version of the the wikitext dataset that has been set up for the GPT-2 model.
  1. Download the dataset:
  2. Upload the dataset (located in gpt2-tokenized-wikitext/) to FlexAI:

Running the Training Job with Experiment Tracking

Now that all the pieces are in place (wandb Secret, Source, and Dataset), you can run the training job with experiment tracking enabled.
You can now visit your wandb dashboard and look for your project’s name to follow the progress of the Training Job and analyze its results in near real-time.

Code

code/causal-language-modeling/train.py

code/causal-language-modeling/requirements.txt

πŸš€ Run this on FlexAI

Managed checkpoints mean you never lose a run to preemption. Jobs launch in under 60 seconds β€” no infra setup, built-in observability.

Get started β†’Talk to us