Fine Tune Azure OpenAI With Weights And Biases
Fine-tune ChatGPT-3.5-turbo with Weights & Biases on Microsoft Azure
If you use OpenAI's API to fine-tune ChatGPT-3.5, you can now use the WandbLogger integration to track experiments, models, and datasets in your central dashboard with just two lines of code:
from wandb.integration.openai.fine_tuning import WandbLogger
# Your fine-tuning logic
WandbLogger.sync(id=fine_tune_job_id)
See the OpenAI section in the Weights & Biases documentation for full details of the integration.
Imports and Setup
Note: Follow the instructions from the official Azure documentation to set up a working Azure OpenAI service
Create our Dataset
Load and Validate our Datasets
Begin our Finetuning on Azure!
Connect to Azure
Upload our Validated Training Data
Run Fine-tuning!
Sync metrics, data, and more with 2 lines of code!
this takes a varying amount of time. Feel free to check the Azure service you set up to ensure the finetuning is running
Logging the fine-tuning job to W&B is straight forward. The integration will automatically log the following to W&B:
- training and validation metrics (if validation data is provided)
- log the training and validation data as W&B Tables for storage and versioning
- log the fine-tuned model's metadata.
The integration automatically creates the DAG lineage between the data and the model.
You can call the
WandbLoggerwith the job id. The cell will keep running till the fine-tuning job is not complete. Once the job's status issucceeded, theWandbLoggerwill log metrics and data to W&B. This way you don't have to wait for the fine-tune job to be completed to callWandbLogger.sync.
Calling WandbLogger.sync without any id will log all un-synced fine-tuned jobs to W&B
See the OpenAI section in the Weights & Biases documentation for full details of the integration
The fine-tuning job is now successfully synced to Weights and Biases. Click on the URL above to open the W&B run page. The following will be logged to W&B:
Training and validation metrics

Training and validation data as W&B Tables

The data and model artifacts for version control (go to the overview tab)

The configuration and hyperparameters (go to the overview tab)

The data and model DAG
