Skip to main content

Documentation Index

Fetch the complete documentation index at: https://wb-21fd5541-style-guide-models-integrations-20260527-015516.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

With W&B, you can log your Cohere model’s fine-tuning metrics and configuration to analyze your models’ performance and share results with your colleagues. This page shows you how to connect a Cohere fine-tuning run to a W&B project so that W&B captures training and validation metrics, hyperparameters, and run metadata automatically in your workspace. It’s intended for users who are already fine-tuning Cohere models and want centralized experiment tracking. For a full example of how to start a fine-tuning run, see the Cohere fine-tuning guide, and refer to the Cohere API reference for the wandb setting.

Log Cohere fine-tuning results

To add Cohere fine-tuning logging to your W&B workspace, do the following:
  1. Create a WandbConfig with your W&B API key, W&B entity, and project name. The API key authenticates the Cohere job with W&B, and the entity and project determine where W&B logs your runs. Create an API key in your W&B user settings. Replace [WANDB-API-KEY] in the following example with your API key.
  2. Pass this config to the FinetunedModel object along with your model name, dataset, and hyperparameters to start your fine-tuning run. The wandb setting configures Cohere to stream metrics to your W&B project during the run.
    from cohere.finetuning import WandbConfig, FinetunedModel
    
    # create a config with your W&B details
    wandb_ft_config = WandbConfig(
        api_key="[WANDB-API-KEY]",
        entity="my-entity", # must be a valid enitity associated with the provided API key
        project="cohere-ft",
    )
    
    ...  # set up your datasets and hyperparameters
    
    # start a fine-tuning run on cohere
    cmd_r_finetune = co.finetuning.create_finetuned_model(
      request=FinetunedModel(
        name="command-r-ft",
        settings=Settings(
          base_model=...
          dataset_id=...
          hyperparameters=...
          wandb=wandb_ft_config  # pass your W&B config here
        ),
      ),
    )
    
  3. View your model’s fine-tuning training and validation metrics and hyperparameters in the W&B project that you created.
    Cohere fine-tuning dashboard
After the run starts, your Cohere fine-tuning job reports metrics to W&B in real time, giving you a single place to compare runs and inspect training progress.

Organize runs

W&B organizes your runs automatically. You can filter and sort them by any configuration parameter such as job type, base model, learning rate, and any other hyperparameter. You can also rename your runs, add notes, or create tags to group them.

Resources

For a complete example, see the Cohere fine-tuning example notebook.