Integrate Azure OpenAI fine-tuning with Weights & Biases (preview)

Weights & Biases (W&B) is a powerful AI developer platform that enables machine learning practitioners to train, fine-tune, and deploy models efficiently. Azure OpenAI fine-tuning integrates with W&B, allowing you to track metrics, parameters, and visualize your Azure OpenAI fine-tuning training runs within your W&B projects. In this article, we will guide you through setting up the Weights & Biases integration.

Screenshot of the weights and biases dashboards.

Prerequisites

Enable System Managed Identity

First, enable System Managed Identity for your Azure OpenAI resource.

Screenshot of the system managed identity interface.

Retrieve Weights & Biases API key

Sign in to https://wandb.ai and go to the User Settings.

Under API Keys, select Reveal to access your key and copy it to the clipboard.

Screenshot of API keys section of User Settings user experience.

If you would like to create a new key, use https://wandb.ai/authorize, and copy the key to add to your integration configuration later.

Configure Azure Key Vault

To securely send data from Azure OpenAI to your Weights & Biases projects, you'll need to use Azure Key Vault.

Add your Weights & Biases API key as a Secret to your Azure Key Vault

  1. Navigate to the Azure Key Vault you are planning to use.

  2. To read and write secrets to your Azure Key Vault, you must explicitly assign access.

  3. Go to Settings > Access configuration. Under Permission model, we recommend you select Azure role-based access control if this isn't already selected. Learn more about Azure role-based access control.

    Screenshot of key vault access configuration user interface.

Assign Key Vault Secrets Officer role

Now that you have set your permission model to Azure role-based access control, you can give yourself the Key Vault Secrets Officer role.

  1. Go to Access control (IAM) and then Add role assignment

    Screenshot of the access control add role assignment user experience.

  2. Choose Key Vault Secrets Officer, add your account as a member, and select review & assign.

    Screenshot of the key vault secret officer role assignment.

Create secrets

  1. From within your key vault resource under Objects, select Secrets > Generate/Import.

    Screenshot of the key vault secrets user interface.

  2. Provide a name for your secret and save the generated Weights & Biases API key to the secret value.

    Screenshot of the key vault secrets creation user interface.

  3. Make sure to capture the secret name and key vault URL. The key vault URL can be retrieved from Overview section of your key vault.

Give your Key Vault permission on your Azure OpenAI account

If you used a Vault Access policy earlier to read and write secrets to your Azure Key Vault, you should use that again. Otherwise, continue to use Azure role-based access control. We recommend Azure role-based access control. However, if it does not work for you, please try Vault Access policy.

Give your Azure OpenAI resource the Key Vault Secrets Officer role.

Screenshot of the assign managed identity user interface.

  1. Navigate to the AI Foundry portal and select your Azure OpenAI fine-tuning resource.

    Screenshot of the manage integrations button.

  2. Add your key vault URL and secret. Then, select Update.

    Screenshot of the manage integrations for Weights and Biases user experience.

  3. Now, when you create new fine-tuning jobs, you'll have the option to log data from the job to your Weights & Biases account.

    Screenshot of the weights and biases dashboards.