You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/ai-services/openai/includes/fine-tuning-python.md
+52Lines changed: 52 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -374,6 +374,8 @@ az cognitiveservices account deployment create
374
374
375
375
After your custom model deploys, you can use it like any other deployed model. You can use the **Playgrounds** in [Azure OpenAI Studio](https://oai.azure.com) to experiment with your new deployment. You can continue to use the same parameters with your custom model, such as `temperature` and `max_tokens`, as you can with other deployed models. For fine-tuned `babbage-002` and `davinci-002` models you will use the Completions playground and the Completions API. For fine-tuned `gpt-35-turbo-0613` models you will use the Chat playground and the Chat completion API.
376
376
377
+
# [OpenAI Python 0.28.1](#tab/python)
378
+
377
379
```python
378
380
#Note: The openai-python library support for Azure OpenAI is in preview.
model="gpt-35-turbo-ft", # model = "Custom deployment name you chose for your fine-tuning model"
416
+
messages=[
417
+
{"role": "system", "content": "You are a helpful assistant."},
418
+
{"role": "user", "content": "Does Azure OpenAI support customer managed keys?"},
419
+
{"role": "assistant", "content": "Yes, customer managed keys are supported by Azure OpenAI."},
420
+
{"role": "user", "content": "Do other Azure AI services support this too?"}
421
+
]
422
+
)
423
+
424
+
print(response.choices[0].message.content)
425
+
```
426
+
427
+
---
428
+
400
429
## Analyze your customized model
401
430
402
431
Azure OpenAI attaches a result file named _results.csv_ to each fine-tune job after it completes. You can use the result file to analyze the training and validation performance of your customized model. The file ID for the result file is listed for each customized model, and you can use the Python SDK to retrieve the file ID and download the result file for analysis.
403
432
404
433
The following Python example retrieves the file ID of the first result file attached to the fine-tune job for your customized model, and then uses the Python SDK to download the file to your working directory for analysis.
405
434
435
+
# [OpenAI Python 0.28.1](#tab/python)
436
+
406
437
```python
407
438
# Retrieve the file ID of the first result file from the fine-tune job
408
439
# for the customized model.
@@ -420,6 +451,27 @@ with open(result_file_name, "wb") as file:
420
451
file.write(result)
421
452
```
422
453
454
+
# [OpenAI Python 1.x](#tab/python-new)
455
+
456
+
```python
457
+
# Retrieve the file ID of the first result file from the fine-tune job
print(f'Downloading result file: {result_file_id}')
467
+
468
+
withopen(retrieve.filename, "wb") asfile:
469
+
result = client.files.content(result_file_id).read()
470
+
file.write(result)
471
+
```
472
+
473
+
---
474
+
423
475
The result file is a CSV file that contains a header row and a row for each training step performed by the fine-tune job. The result file contains the following columns:
0 commit comments