@@ -110,8 +110,6 @@ For large data files, we recommend that you import from an Azure Blob store. La
110110
111111The following Python example uploads local training and validation files by using the Python SDK, and retrieves the returned file IDs.
112112
113- # [ OpenAI Python 1.x] ( #tab/python-new )
114-
115113``` python
116114# Upload fine-tuning files
117115
@@ -144,42 +142,6 @@ print("Validation file ID:", validation_file_id)
144142
145143```
146144
147- # [ OpenAI Python 0.28.1] ( #tab/python )
148-
149- [ !INCLUDE [ Deprecation] ( ../includes/deprecation.md )]
150-
151- ``` python
152- # Upload fine-tuning files
153-
154- import openai
155- import os
156-
157- openai.api_key = os.getenv(" AZURE_OPENAI_API_KEY" )
158- openai.api_base = os.getenv(" AZURE_OPENAI_ENDPOINT" )
159- openai.api_type = ' azure'
160- openai.api_version = ' 2024-02-01' # This API version or later is required
161-
162- training_file_name = ' training_set.jsonl'
163- validation_file_name = ' validation_set.jsonl'
164-
165- # Upload the training and validation dataset files to Azure OpenAI with the SDK.
166-
167- training_response = openai.File.create(
168- file = open (training_file_name, " rb" ), purpose = " fine-tune" , user_provided_filename = " training_set.jsonl"
169- )
170- training_file_id = training_response[" id" ]
171-
172- validation_response = openai.File.create(
173- file = open (validation_file_name, " rb" ), purpose = " fine-tune" , user_provided_filename = " validation_set.jsonl"
174- )
175- validation_file_id = validation_response[" id" ]
176-
177- print (" Training file ID:" , training_file_id)
178- print (" Validation file ID:" , validation_file_id)
179- ```
180-
181- ---
182-
183145## Create a customized model
184146
185147After you upload your training and validation files, you're ready to start the fine-tuning job.
@@ -205,7 +167,6 @@ print("Job ID:", response.id)
205167print (" Status:" , response.id)
206168print (response.model_dump_json(indent = 2 ))
207169```
208- ---
209170
210171You can also pass additional optional parameters like hyperparameters to take greater control of the fine-tuning process. For initial training we recommend using the automatic defaults that are present without specifying these parameters.
211172
@@ -226,7 +187,7 @@ from openai import AzureOpenAI
226187client = AzureOpenAI(
227188 azure_endpoint = os.getenv(" AZURE_OPENAI_ENDPOINT" ),
228189 api_key = os.getenv(" AZURE_OPENAI_API_KEY" ),
229- api_version = " 2024-02-01 " # This API version or later is required
190+ api_version = " 2024-10-21 " # This API version or later is required
230191)
231192
232193client.fine_tuning.jobs.create(
@@ -336,7 +297,7 @@ resource_group = "<YOUR_RESOURCE_GROUP_NAME>"
336297resource_name = " <YOUR_AZURE_OPENAI_RESOURCE_NAME>"
337298model_deployment_name = " gpt-35-turbo-ft" # custom deployment name that you will use to reference the model when making inference calls.
338299
339- deploy_params = {' api-version' : " 2024-10-21 " }
300+ deploy_params = {' api-version' : " 2024-10-01 " } # control plane API version rather than dataplane API for this call
340301deploy_headers = {' Authorization' : ' Bearer {} ' .format(token), ' Content-Type' : ' application/json' }
341302
342303deploy_data = {
@@ -378,7 +339,7 @@ from openai import AzureOpenAI
378339client = AzureOpenAI(
379340 azure_endpoint = os.getenv(" AZURE_OPENAI_ENDPOINT" ),
380341 api_key = os.getenv(" AZURE_OPENAI_API_KEY" ),
381- api_version = " 2024-02-01 "
342+ api_version = " 2024-10-21 "
382343)
383344
384345response = client.fine_tuning.jobs.create(
0 commit comments