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-rest.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -150,7 +150,7 @@ For large data files, we recommend that you import from an Azure Blob store. Lar
150
150
### Upload training data
151
151
152
152
```bash
153
-
curl -X POST $AZURE_OPENAI_ENDPOINT/openai/files?api-version=2023-09-15-preview \
153
+
curl -X POST $AZURE_OPENAI_ENDPOINT/openai/files?api-version=2023-10-01-preview \
154
154
-H "Content-Type: multipart/form-data" \
155
155
-H "api-key: $AZURE_OPENAI_KEY" \
156
156
-F "purpose=fine-tune" \
@@ -160,7 +160,7 @@ curl -X POST $AZURE_OPENAI_ENDPOINT/openai/files?api-version=2023-09-15-preview
160
160
### Upload validation data
161
161
162
162
```bash
163
-
curl -X POST $AZURE_OPENAI_ENDPOINT/openai/files?api-version=2023-09-15-preview \
163
+
curl -X POST $AZURE_OPENAI_ENDPOINT/openai/files?api-version=2023-10-01-preview \
164
164
-H "Content-Type: multipart/form-data" \
165
165
-H "api-key: $AZURE_OPENAI_KEY" \
166
166
-F "purpose=fine-tune" \
@@ -172,7 +172,7 @@ curl -X POST $AZURE_OPENAI_ENDPOINT/openai/files?api-version=2023-09-15-preview
172
172
After you uploaded your training and validation files, you're ready to start the fine-tuning job. The following code shows an example of how to create a new fine-tuning job with the REST API:
173
173
174
174
```bash
175
-
curl -X POST $AZURE_OPENAI_ENDPOINT/openai/fine_tuning/jobs?api-version=2023-09-15-preview \
175
+
curl -X POST $AZURE_OPENAI_ENDPOINT/openai/fine_tuning/jobs?api-version=2023-10-01-preview \
176
176
-H "Content-Type: application/json" \
177
177
-H "api-key: $AZURE_OPENAI_KEY" \
178
178
-d '{
@@ -187,7 +187,7 @@ curl -X POST $AZURE_OPENAI_ENDPOINT/openai/fine_tuning/jobs?api-version=2023-09-
187
187
After you start a fine-tune job, it can take some time to complete. Your job might be queued behind other jobsin the system. Training your model can take minutes or hours depending on the model and dataset size. The following example uses the REST API to check the status of your fine-tuning job. The example retrieves information about your job by using the job ID returned from the previous example:
188
188
189
189
```bash
190
-
curl -X GET $AZURE_OPENAI_ENDPOINT/openai/fine_tuning/jobs/<YOUR-JOB-ID>?api-version=2023-09-15-preview \
190
+
curl -X GET $AZURE_OPENAI_ENDPOINT/openai/fine_tuning/jobs/<YOUR-JOB-ID>?api-version=2023-10-01-preview \
191
191
-H "api-key: $AZURE_OPENAI_KEY"
192
192
```
193
193
@@ -266,12 +266,12 @@ Azure OpenAI attaches a result file named _results.csv_ to each fine-tune job af
266
266
The following Python example uses the REST API to retrieve the file ID of the first result file attached to the fine-tune job for your customized model, and then downloads the file to your working directory for analysis.
267
267
268
268
```bash
269
-
curl -X GET "$AZURE_OPENAI_ENDPOINT/openai/fine_tuning/jobs/<JOB_ID>?api-version=2023-09-15-preview" \
269
+
curl -X GET "$AZURE_OPENAI_ENDPOINT/openai/fine_tuning/jobs/<JOB_ID>?api-version=2023-10-01-preview" \
270
270
-H "api-key: $AZURE_OPENAI_KEY")
271
271
```
272
272
273
273
```bash
274
-
curl -X GET "$AZURE_OPENAI_ENDPOINT/openai/files/<RESULT_FILE_ID>/content?api-version=2023-09-15-preview" \
274
+
curl -X GET "$AZURE_OPENAI_ENDPOINT/openai/files/<RESULT_FILE_ID>/content?api-version=2023-10-01-preview" \
Unlike the previous Python SDK commands in this tutorial, since the introduction of the quota feature, model deployment must be done using the [REST API](/rest/api/cognitiveservices/accountmanagement/deployments/create-or-update?tabs=HTTP), which requires separate authorization, a different API path, and a different API version.
@@ -504,6 +611,8 @@ It isn't uncommon for this process to take some time to complete when dealing wi
504
611
505
612
After your fine-tuned model is deployed, you can use it like any other deployed model in either the [Chat Playground of Azure OpenAI Studio](https://oai.azure.com), or via the chat completion API. For example, you can send a chat completion call to your deployed model, as shown in the following Python example. You can continue to use the same parameters with your customized model, such as temperature and max_tokens, as you can with other deployed models.
506
613
614
+
# [OpenAI Python 0.28.1](#tab/python)
615
+
507
616
```python
508
617
#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"
653
+
messages=[
654
+
{"role": "system", "content": "You are a helpful assistant."},
655
+
{"role": "user", "content": "Does Azure OpenAI support customer managed keys?"},
656
+
{"role": "assistant", "content": "Yes, customer managed keys are supported by Azure OpenAI."},
657
+
{"role": "user", "content": "Do other Azure AI services support this too?"}
658
+
]
659
+
)
660
+
661
+
print(response.choices[0].message.content)
662
+
```
663
+
664
+
---
665
+
530
666
## Delete deployment
531
667
532
668
Unlike other types of Azure OpenAI models, fine-tuned/customized models have [an hourly hosting cost](https://azure.microsoft.com/pricing/details/cognitive-services/openai-service/#pricing) associated with them once they are deployed. It is **strongly recommended** that once you're done with this tutorial and have tested a few chat completion calls against your fine-tuned model, that you **delete the model deployment**.
0 commit comments