Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Docs for Azure OpenAI fine-tuning #552

Merged
merged 9 commits into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions docs/guides/integrations/other/azure-openai-fine-tuning.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
slug: /guides/integrations/azure-openai-fine-tuning
description: How to Fine-Tune Azure OpenAI models using W&B.
displayed_sidebar: default
---

# Azure OpenAI Fine-Tuning

Check warning on line 7 in docs/guides/integrations/other/azure-openai-fine-tuning.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/guides/integrations/other/azure-openai-fine-tuning.md#L7

[Google.Headings] 'Azure OpenAI Fine-Tuning' should use sentence-style capitalization.
Raw output
{"message": "[Google.Headings] 'Azure OpenAI Fine-Tuning' should use sentence-style capitalization.", "location": {"path": "docs/guides/integrations/other/azure-openai-fine-tuning.md", "range": {"start": {"line": 7, "column": 3}}}, "severity": "WARNING"}

## Introduction
Fine-tuning GPT-3.5 or GPT-4 models on Microsoft Azure using W&B allows for detailed tracking and analysis of model performance. This guide extends the concepts from the [OpenAI Fine-Tuning guide](/guides/integrations/openai) with specific steps and features for Azure OpenAI.

Check notice on line 10 in docs/guides/integrations/other/azure-openai-fine-tuning.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/guides/integrations/other/azure-openai-fine-tuning.md#L10

[Google.Acronyms] Spell out 'GPT', if it's unfamiliar to the audience.
Raw output
{"message": "[Google.Acronyms] Spell out 'GPT', if it's unfamiliar to the audience.", "location": {"path": "docs/guides/integrations/other/azure-openai-fine-tuning.md", "range": {"start": {"line": 10, "column": 13}}}, "severity": "INFO"}

Check notice on line 10 in docs/guides/integrations/other/azure-openai-fine-tuning.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/guides/integrations/other/azure-openai-fine-tuning.md#L10

[Google.Acronyms] Spell out 'GPT', if it's unfamiliar to the audience.
Raw output
{"message": "[Google.Acronyms] Spell out 'GPT', if it's unfamiliar to the audience.", "location": {"path": "docs/guides/integrations/other/azure-openai-fine-tuning.md", "range": {"start": {"line": 10, "column": 24}}}, "severity": "INFO"}

![](/images/integrations/open_ai_auto_scan.png)

:::info
The Weights and Biases fine-tuning integration works with `openai >= 1.0`. Please install the latest version of `openai` by doing `pip install -U openai`.
:::


## Prerequisites
- Azure OpenAI service set up as per [official Azure documentation](https://learn.microsoft.com/en-us/azure/ai-services/openai/tutorials/fine-tune).
- Latest versions of `openai`, `wandb`, and other required libraries installed.

## Sync Azure OpenAI fine-tuning results in W&B in 2 lines

```python
from openai import AzureOpenAI

# Connect to Azure OpenAI
client = AzureOpenAI(
azure_endpoint=os.getenv("AZURE_OPENAI_ENDPOINT"),
api_key=os.getenv("AZURE_OPENAI_KEY"),
)

# Create and validate your training and validation datasets in JSONL format,
# upload them via the client,
# and start a fine-tuning job.

from wandb.integration.openai.fine_tuning import WandbLogger

# Sync your fine-tuning results with W&B!
WandbLogger.sync(
fine_tune_job_id=job_id, openai_client=client, project="your_project_name"
)
```

### Check out interactive examples

* [Demo Colab](http://wandb.me/azure-openai-colab)

## Visualization and versioning in W&B
- Utilize W&B for versioning and visualizing training and validation data as Tables.
- The datasets and model metadata are versioned as W&B Artifacts, allowing for efficient tracking and version control.

Check notice on line 52 in docs/guides/integrations/other/azure-openai-fine-tuning.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/guides/integrations/other/azure-openai-fine-tuning.md#L52

[Google.Passive] In general, use active voice instead of passive voice ('are versioned').
Raw output
{"message": "[Google.Passive] In general, use active voice instead of passive voice ('are versioned').", "location": {"path": "docs/guides/integrations/other/azure-openai-fine-tuning.md", "range": {"start": {"line": 52, "column": 35}}}, "severity": "INFO"}

![](/images/integrations/openai_data_artifacts.png)

![](/images/integrations/openai_data_visualization.png)

## Retrieving the fine-tuned model
- The fine-tuned model ID is retrievable from Azure OpenAI and is logged as a part of model metadata in W&B.

Check notice on line 59 in docs/guides/integrations/other/azure-openai-fine-tuning.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/guides/integrations/other/azure-openai-fine-tuning.md#L59

[Google.Passive] In general, use active voice instead of passive voice ('is logged').
Raw output
{"message": "[Google.Passive] In general, use active voice instead of passive voice ('is logged').", "location": {"path": "docs/guides/integrations/other/azure-openai-fine-tuning.md", "range": {"start": {"line": 59, "column": 64}}}, "severity": "INFO"}

![](/images/integrations/openai_model_metadata.png)

## Additional resources
- [OpenAI Fine-tuning Documentation](https://platform.openai.com/docs/guides/fine-tuning/)
- [Azure OpenAI Fine-tuning Documentation](https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/fine-tuning?tabs=turbo%2Cpython&pivots=programming-language-python)
- [Demo Colab](http://wandb.me/azure-openai-colab)
2 changes: 2 additions & 0 deletions sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ const sidebars = {
items: [
// 'guides/integrations/intro',
'guides/integrations/add-wandb-to-any-library',
'guides/integrations/other/azure-openai-fine-tuning',
'guides/integrations/other/catalyst',
'guides/integrations/dagster',
'guides/integrations/other/databricks',
Expand Down Expand Up @@ -782,6 +783,7 @@ const sidebars = {
link: { type: 'doc', id: 'guides/integrations/intro' },
items: [
'guides/integrations/add-wandb-to-any-library',
'guides/integrations/other/azure-openai-fine-tuning',
'guides/integrations/other/catalyst',
'guides/integrations/dagster',
'guides/integrations/other/databricks',
Expand Down
Loading