Skip to content

Commit 2d27e3e

Browse files
committed
Merge branch 'pyannam/update-aoai-doc' of https://github.com/PavanReddy28/azure-ai-docs into mrb_09_09_2024_pm_fine_tuning
2 parents 38f5347 + bfd3292 commit 2d27e3e

File tree

2 files changed

+619
-18
lines changed

2 files changed

+619
-18
lines changed

articles/ai-services/openai/tutorials/fine-tune.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ recommendations: false
1313
ms.custom: devx-track-python
1414
---
1515

16-
# Azure OpenAI GPT-3.5 Turbo fine-tuning tutorial
16+
# Azure OpenAI GPT-4o-mini fine-tuning tutorial
1717

18-
This tutorial walks you through fine-tuning a `gpt-35-turbo-0613` model.
18+
This tutorial walks you through fine-tuning a `gpt-4o-mini-2024-07-18` model.
1919

2020
In this tutorial you learn how to:
2121

@@ -24,7 +24,7 @@ In this tutorial you learn how to:
2424
> * Create environment variables for your resource endpoint and API key.
2525
> * Prepare your sample training and validation datasets for fine-tuning.
2626
> * Upload your training file and validation file for fine-tuning.
27-
> * Create a fine-tuning job for `gpt-35-turbo-0613`.
27+
> * Create a fine-tuning job for `gpt-4o-mini-2024-07-18`.
2828
> * Deploy a custom fine-tuned model.
2929
3030
## Prerequisites
@@ -33,7 +33,7 @@ In this tutorial you learn how to:
3333
- Python 3.8 or later version
3434
- The following Python libraries: `json`, `requests`, `os`, `tiktoken`, `time`, `openai`, `numpy`.
3535
- [Jupyter Notebooks](https://jupyter.org/)
36-
- An Azure OpenAI resource in a [region where `gpt-35-turbo-0613` fine-tuning is available](../concepts/models.md). If you don't have a resource the process of creating one is documented in our resource [deployment guide](../how-to/create-resource.md).
36+
- An Azure OpenAI resource in a [region where `gpt-4o-mini-2024-07-18` fine-tuning is available](../concepts/models.md). If you don't have a resource the process of creating one is documented in our resource [deployment guide](../how-to/create-resource.md).
3737
- Fine-tuning access requires **Cognitive Services OpenAI Contributor**.
3838
- If you do not already have access to view quota, and deploy models in Azure OpenAI Studio you will require [additional permissions](../how-to/role-based-access-control.md).
3939

@@ -106,7 +106,7 @@ source /etc/environment
106106

107107
### Create a sample dataset
108108

109-
Fine-tuning `gpt-35-turbo-0613` requires a specially formatted JSONL training file. OpenAI provides the following example in their documentation:
109+
Fine-tuning `gpt-4o-mini-2024-07-18` requires a specially formatted JSONL training file. OpenAI provides the following example in their documentation:
110110

111111
```json
112112
{"messages": [{"role": "system", "content": "Marv is a factual chatbot that is also sarcastic."}, {"role": "user", "content": "What's the capital of France?"}, {"role": "assistant", "content": "Paris, as if everyone doesn't know that already."}]}
@@ -206,7 +206,7 @@ First example in validation set:
206206

207207
In this case we only have 10 training and 10 validation examples so while this will demonstrate the basic mechanics of fine-tuning a model this in unlikely to be a large enough number of examples to produce a consistently noticeable impact.
208208

209-
Now you can then run some additional code from OpenAI using the tiktoken library to validate the token counts. Individual examples need to remain under the `gpt-35-turbo-0613` model's input token limit of 4096 tokens.
209+
Now you can then run some additional code from OpenAI using the tiktoken library to validate the token counts. Individual examples need to remain under the `gpt-4o-mini-2024-07-18` model's input token limit of 4096 tokens.
210210

211211
```python
212212
# Validate token counts
@@ -381,7 +381,7 @@ In this example we're also passing the seed parameter. The seed controls the rep
381381
response = client.fine_tuning.jobs.create(
382382
training_file = training_file_id,
383383
validation_file = validation_file_id,
384-
model = "gpt-35-turbo-0613", # Enter base model name. Note that in Azure OpenAI the model name contains dashes and cannot contain dot/period characters.
384+
model = "gpt-4o-mini-2024-07-18", # Enter base model name. Note that in Azure OpenAI the model name contains dashes and cannot contain dot/period characters.
385385
seed = 105 # seed parameter controls reproducibility of the fine-tuning job. If no seed is specified one will be generated automatically.
386386
)
387387

@@ -404,7 +404,7 @@ print(response.model_dump_json(indent=2))
404404
response = openai.FineTuningJob.create(
405405
training_file = training_file_id,
406406
validation_file = validation_file_id,
407-
model = "gpt-35-turbo-0613",
407+
model = "gpt-4o-mini-2024-07-18",
408408
)
409409

410410
job_id = response["id"]
@@ -435,7 +435,7 @@ Status: pending
435435
"batch_size": -1,
436436
"learning_rate_multiplier": 1
437437
},
438-
"model": "gpt-35-turbo-0613",
438+
"model": "gpt-4o-mini-2024-07-18",
439439
"object": "fine_tuning.job",
440440
"organization_id": null,
441441
"result_files": null,
@@ -540,7 +540,7 @@ Status: pending
540540
"batch_size": -1,
541541
"learning_rate_multiplier": 1
542542
},
543-
"model": "gpt-35-turbo-0613",
543+
"model": "gpt-4o-mini-2024-07-18",
544544
"object": "fine_tuning.job",
545545
"organization_id": null,
546546
"result_files": null,
@@ -753,7 +753,7 @@ This command isn't available in the 0.28.1 OpenAI Python library. Upgrade to the
753753
{
754754
"id": "ftchkpt-148ab69f0a404cf9ab55a73d51b152de",
755755
"created_at": 1715743077,
756-
"fine_tuned_model_checkpoint": "gpt-35-turbo-0613.ft-372c72db22c34e6f9ccb62c26ee0fbd9",
756+
"fine_tuned_model_checkpoint": "gpt-4o-mini-2024-07-18.ft-372c72db22c34e6f9ccb62c26ee0fbd9",
757757
"fine_tuning_job_id": "ftjob-372c72db22c34e6f9ccb62c26ee0fbd9",
758758
"metrics": {
759759
"full_valid_loss": 1.8258173013035255,
@@ -770,7 +770,7 @@ This command isn't available in the 0.28.1 OpenAI Python library. Upgrade to the
770770
{
771771
"id": "ftchkpt-e559c011ecc04fc68eaa339d8227d02d",
772772
"created_at": 1715743013,
773-
"fine_tuned_model_checkpoint": "gpt-35-turbo-0613.ft-372c72db22c34e6f9ccb62c26ee0fbd9:ckpt-step-90",
773+
"fine_tuned_model_checkpoint": "gpt-4o-mini-2024-07-18.ft-372c72db22c34e6f9ccb62c26ee0fbd9:ckpt-step-90",
774774
"fine_tuning_job_id": "ftjob-372c72db22c34e6f9ccb62c26ee0fbd9",
775775
"metrics": {
776776
"full_valid_loss": 1.7958603267428241,
@@ -787,7 +787,7 @@ This command isn't available in the 0.28.1 OpenAI Python library. Upgrade to the
787787
{
788788
"id": "ftchkpt-8ae8beef3dcd4dfbbe9212e79bb53265",
789789
"created_at": 1715742984,
790-
"fine_tuned_model_checkpoint": "gpt-35-turbo-0613.ft-372c72db22c34e6f9ccb62c26ee0fbd9:ckpt-step-80",
790+
"fine_tuned_model_checkpoint": "gpt-4o-mini-2024-07-18.ft-372c72db22c34e6f9ccb62c26ee0fbd9:ckpt-step-80",
791791
"fine_tuning_job_id": "ftjob-372c72db22c34e6f9ccb62c26ee0fbd9",
792792
"metrics": {
793793
"full_valid_loss": 1.6909511662736725,
@@ -848,7 +848,7 @@ Alternatively, you can deploy your fine-tuned model using any of the other commo
848848
| resource_group | The resource group name for your Azure OpenAI resource |
849849
| resource_name | The Azure OpenAI resource name |
850850
| model_deployment_name | The custom name for your new fine-tuned model deployment. This is the name that will be referenced in your code when making chat completion calls. |
851-
| fine_tuned_model | Retrieve this value from your fine-tuning job results in the previous step. It will look like `gpt-35-turbo-0613.ft-b044a9d3cf9c4228b5d393567f693b83`. You'll need to add that value to the deploy_data json. |
851+
| fine_tuned_model | Retrieve this value from your fine-tuning job results in the previous step. It will look like `gpt-4o-mini-2024-07-18.ft-b044a9d3cf9c4228b5d393567f693b83`. You'll need to add that value to the deploy_data json. |
852852

853853
[!INCLUDE [Fine-tuning deletion](../includes/fine-tune.md)]
854854

@@ -862,7 +862,7 @@ token = os.getenv("TEMP_AUTH_TOKEN")
862862
subscription = "<YOUR_SUBSCRIPTION_ID>"
863863
resource_group = "<YOUR_RESOURCE_GROUP_NAME>"
864864
resource_name = "<YOUR_AZURE_OPENAI_RESOURCE_NAME>"
865-
model_deployment_name = "YOUR_CUSTOM_MODEL_DEPLOYMENT_NAME"
865+
model_deployment_name = "gpt-4o-mini-2024-07-18-ft" # Custom deployment name you chose for your fine-tuning model
866866

867867
deploy_params = {'api-version': "2023-05-01"}
868868
deploy_headers = {'Authorization': 'Bearer {}'.format(token), 'Content-Type': 'application/json'}
@@ -872,7 +872,7 @@ deploy_data = {
872872
"properties": {
873873
"model": {
874874
"format": "OpenAI",
875-
"name": "<YOUR_FINE_TUNED_MODEL>", #retrieve this value from the previous call, it will look like gpt-35-turbo-0613.ft-b044a9d3cf9c4228b5d393567f693b83
875+
"name": "<YOUR_FINE_TUNED_MODEL>", #retrieve this value from the previous call, it will look like gpt-4o-mini-2024-07-18.ft-b044a9d3cf9c4228b5d393567f693b83
876876
"version": "1"
877877
}
878878
}
@@ -915,7 +915,7 @@ client = AzureOpenAI(
915915
)
916916

917917
response = client.chat.completions.create(
918-
model = "gpt-35-turbo-ft", # model = "Custom deployment name you chose for your fine-tuning model"
918+
model = "gpt-4o-mini-2024-07-18-ft", # model = "Custom deployment name you chose for your fine-tuning model"
919919
messages = [
920920
{"role": "system", "content": "You are a helpful assistant."},
921921
{"role": "user", "content": "Does Azure OpenAI support customer managed keys?"},
@@ -941,7 +941,7 @@ openai.api_version = "2024-02-01"
941941
openai.api_key = os.getenv("AZURE_OPENAI_API_KEY")
942942

943943
response = openai.ChatCompletion.create(
944-
engine = "gpt-35-turbo-ft", # engine = "Custom deployment name you chose for your fine-tuning model"
944+
engine = "gpt-4o-mini-2024-07-18-ft", # engine = "Custom deployment name you chose for your fine-tuning model"
945945
messages = [
946946
{"role": "system", "content": "You are a helpful assistant."},
947947
{"role": "user", "content": "Does Azure OpenAI support customer managed keys?"},

0 commit comments

Comments
 (0)