Skip to content

Commit 747267f

Browse files
Merge pull request #6734 from mrbullwinkle/mrb_08_24_2025_copy_model
[Azure OpenAI] [v1] [Copy model]
2 parents 4f386a0 + f6d367d commit 747267f

File tree

1 file changed

+56
-9
lines changed

1 file changed

+56
-9
lines changed

articles/ai-foundry/openai/includes/fine-tuning-rest.md

Lines changed: 56 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ For large data files, we recommend that you import from an Azure Blob store. Lar
100100
### Upload training data
101101

102102
```bash
103-
curl -X POST $AZURE_OPENAI_ENDPOINT/openai/files?api-version=2024-10-21 \
103+
curl -X POST $AZURE_OPENAI_ENDPOINT/openai/v1/files \
104104
-H "Content-Type: multipart/form-data" \
105105
-H "api-key: $AZURE_OPENAI_API_KEY" \
106106
-F "purpose=fine-tune" \
@@ -110,7 +110,7 @@ curl -X POST $AZURE_OPENAI_ENDPOINT/openai/files?api-version=2024-10-21 \
110110
### Upload validation data
111111

112112
```bash
113-
curl -X POST $AZURE_OPENAI_ENDPOINT/openai/files?api-version=2024-10-21 \
113+
curl -X POST $AZURE_OPENAI_ENDPOINT/openai/v1/files \
114114
-H "Content-Type: multipart/form-data" \
115115
-H "api-key: $AZURE_OPENAI_API_KEY" \
116116
-F "purpose=fine-tune" \
@@ -124,7 +124,7 @@ After you uploaded your training and validation files, you're ready to start the
124124
In this example we are also passing the seed parameter. The seed controls the reproducibility of the job. Passing in the same seed and job parameters should produce the same results, but can differ in rare cases. If a seed is not specified, one will be generated for you.
125125

126126
```bash
127-
curl -X POST $AZURE_OPENAI_ENDPOINT/openai/fine_tuning/jobs?api-version=2024-10-21 \
127+
curl -X POST $AZURE_OPENAI_ENDPOINT/openai/v1/fine_tuning/jobs \
128128
-H "Content-Type: application/json" \
129129
-H "api-key: $AZURE_OPENAI_API_KEY" \
130130
-d '{
@@ -151,7 +151,7 @@ The current supported hyperparameters for fine-tuning are:
151151
After you start a fine-tune job, it can take some time to complete. Your job might be queued behind other jobs in 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:
152152

153153
```bash
154-
curl -X GET $AZURE_OPENAI_ENDPOINT/openai/fine_tuning/jobs/<YOUR-JOB-ID>?api-version=2024-10-21 \
154+
curl -X GET $AZURE_OPENAI_ENDPOINT/openai/v1/fine_tuning/jobs/<YOUR-JOB-ID> \
155155
-H "api-key: $AZURE_OPENAI_API_KEY"
156156
```
157157

@@ -180,19 +180,66 @@ curl -X POST $AZURE_OPENAI_ENDPOINT/openai/v1/fine_tuning/jobs/{fine_tuning_job_
180180
To examine the individual fine-tuning events that were generated during training:
181181

182182
```bash
183-
curl -X POST $AZURE_OPENAI_ENDPOINT/openai/fine_tuning/jobs/{fine_tuning_job_id}/events?api-version=2024-10-21 \
183+
curl -X POST $AZURE_OPENAI_ENDPOINT/openai/v1/fine_tuning/jobs/{fine_tuning_job_id}/events \
184184
-H "Content-Type: application/json" \
185185
-H "api-key: $AZURE_OPENAI_API_KEY"
186186
```
187187

188+
### Copy model (preview)
189+
190+
You can now copy a fine-tuned checkpointed model from one region to another, across different subscriptions but within the same tenant. The process uses dedicated APIs to ensure efficient and secure transfers. This feature is currently available only with the API and not through the Foundry portal.
191+
Once the model is copied from region A to region B, you can continually fine-tune the model in region B and deploy the model from this location.
192+
193+
> [!NOTE]
194+
> Deletion of the model checkpoint in the source region will not cause the model to be deleted in the destination region. To delete the model in both regions once it has been copied, the model must be deleted separately in each region.
195+
196+
**Pre-requisites**
197+
198+
- Destination resource/account should have at least one fine-tuning job.
199+
- Destination resource/account should not disable public network access. (At least while sending copying request).
200+
- You can only copy to the destination account, if the account initiating the copy has sufficient permissions to access the destination account.
201+
202+
**Permissions configuration**
203+
204+
1. Create a [user-assigned managed identity](/entra/identity/managed-identities-azure-resources/how-manage-user-assigned-managed-identities?pivots=identity-mi-methods-azp).
205+
2. Give Cognitive Services OpenAI contributor role to your user-assigned managed identity on your destination resource/account.
206+
3. [Assign the user-assigned managed identity](/entra/identity/managed-identities-azure-resources/how-to-assign-access-azure-resource?pivots=identity-mi-access-portal#use-azure-rbac-to-assign-a-managed-identity-access-to-another-resource-using-the-azure-portal) to your source resource account.
207+
208+
**Copy model**
209+
210+
```bash
211+
curl --request POST \
212+
--url 'https://<aoai-resource>.openai.azure.com/openai/v1/fine_tuning/jobs/<ftjob>/checkpoints/<checkpoint-name>/copy' \
213+
--header 'Content-Type: application/json' \
214+
--header 'api-key: <api-key>' \
215+
--header 'aoai-copy-ft-checkpoints: preview' \
216+
--data '{
217+
  "destinationResourceId": "<resourceId>",
218+
  "region": "<region>"
219+
}'
220+
```
221+
222+
Since this is a long running operation, check the status of the Fine-tuned model copy by providing the checkpoint ID of the source account used in the POST call.
223+
224+
**Check copy status**
225+
226+
```bash
227+
curl --request GET \
228+
--url 'https://<aoai-resource>.openai.azure.com//openai/v1/fine_tuning/jobs/<ftjob>/checkpoints/<checkpoint-name>/copy' \
229+
--header 'Content-Type: application/json' \
230+
--header 'api-key: <api-key>' \
231+
--header 'aoai-copy-ft-checkpoints: preview'
232+
```
233+
234+
188235
## Checkpoints
189236

190237
When each training epoch completes a checkpoint is generated. A checkpoint is a fully functional version of a model which can both be deployed and used as the target model for subsequent fine-tuning jobs. Checkpoints can be particularly useful, as they may provide snapshots prior to overfitting. When a fine-tuning job completes you will have the three most recent versions of the model available to deploy. The final epoch will be represented by your fine-tuned model, the previous two epochs will be available as checkpoints.
191238

192239
You can run the list checkpoints command to retrieve the list of checkpoints associated with an individual fine-tuning job:
193240

194241
```bash
195-
curl -X POST $AZURE_OPENAI_ENDPOINT/openai/fine_tuning/jobs/{fine_tuning_job_id}/checkpoints?api-version=2024-10-21 \
242+
curl -X POST $AZURE_OPENAI_ENDPOINT/openai/v1/fine_tuning/jobs/{fine_tuning_job_id}/checkpoints \
196243
-H "Content-Type: application/json" \
197244
-H "api-key: $AZURE_OPENAI_API_KEY"
198245
```
@@ -204,12 +251,12 @@ Azure OpenAI attaches a result file named _results.csv_ to each fine-tune job af
204251
The following Python example uses the REST API to retrieve the file ID of the first result file attached to the fine-tuning job for your customized model, and then downloads the file to your working directory for analysis.
205252

206253
```bash
207-
curl -X GET "$AZURE_OPENAI_ENDPOINT/openai/fine_tuning/jobs/<JOB_ID>?api-version=2023-12-01-preview" \
254+
curl -X GET "$AZURE_OPENAI_ENDPOINT/openai/v1/fine_tuning/jobs/<JOB_ID>" \
208255
-H "api-key: $AZURE_OPENAI_API_KEY")
209256
```
210257

211258
```bash
212-
curl -X GET "$AZURE_OPENAI_ENDPOINT/openai/files/<RESULT_FILE_ID>/content?api-version=2023-12-01-preview" \
259+
curl -X GET "$AZURE_OPENAI_ENDPOINT/openai/v1/files/<RESULT_FILE_ID>/content" \
213260
-H "api-key: $AZURE_OPENAI_API_KEY" > <RESULT_FILENAME>
214261
```
215262

@@ -274,7 +321,7 @@ Once you have created a fine-tuned model, you might want to continue to refine t
274321
To perform fine-tuning on a model that you have previously fine-tuned, you would use the same process as described in [create a customized model](#create-a-customized-model) but instead of specifying the name of a generic base model you would specify your already fine-tuned model's ID. The fine-tuned model ID looks like `gpt-4.1-2025-04-14.ft-5fd1918ee65d4cd38a5dcf6835066ed7`
275322

276323
```bash
277-
curl -X POST $AZURE_OPENAI_ENDPOINT/openai/fine_tuning/jobs?api-version=2023-12-01-preview \
324+
curl -X POST $AZURE_OPENAI_ENDPOINT/openai/v1/fine_tuning/jobs \
278325
-H "Content-Type: application/json" \
279326
-H "api-key: $AZURE_OPENAI_API_KEY" \
280327
-d '{

0 commit comments

Comments
 (0)