@@ -110,8 +110,6 @@ For large data files, we recommend that you import from an Azure Blob store. La
110
110
111
111
The following Python example uploads local training and validation files by using the Python SDK, and retrieves the returned file IDs.
112
112
113
- # [ OpenAI Python 1.x] ( #tab/python-new )
114
-
115
113
``` python
116
114
# Upload fine-tuning files
117
115
@@ -144,42 +142,6 @@ print("Validation file ID:", validation_file_id)
144
142
145
143
```
146
144
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
-
183
145
## Create a customized model
184
146
185
147
After 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)
205
167
print (" Status:" , response.id)
206
168
print (response.model_dump_json(indent = 2 ))
207
169
```
208
- ---
209
170
210
171
You 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.
211
172
@@ -226,7 +187,7 @@ from openai import AzureOpenAI
226
187
client = AzureOpenAI(
227
188
azure_endpoint = os.getenv(" AZURE_OPENAI_ENDPOINT" ),
228
189
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
230
191
)
231
192
232
193
client.fine_tuning.jobs.create(
@@ -336,7 +297,7 @@ resource_group = "<YOUR_RESOURCE_GROUP_NAME>"
336
297
resource_name = " <YOUR_AZURE_OPENAI_RESOURCE_NAME>"
337
298
model_deployment_name = " gpt-35-turbo-ft" # custom deployment name that you will use to reference the model when making inference calls.
338
299
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
340
301
deploy_headers = {' Authorization' : ' Bearer {} ' .format(token), ' Content-Type' : ' application/json' }
341
302
342
303
deploy_data = {
@@ -378,7 +339,7 @@ from openai import AzureOpenAI
378
339
client = AzureOpenAI(
379
340
azure_endpoint = os.getenv(" AZURE_OPENAI_ENDPOINT" ),
380
341
api_key = os.getenv(" AZURE_OPENAI_API_KEY" ),
381
- api_version = " 2024-02-01 "
342
+ api_version = " 2024-10-21 "
382
343
)
383
344
384
345
response = client.fine_tuning.jobs.create(
0 commit comments