Create a speech synthesis fine-tuning training job. Datasets can be uploaded via API or mounted from OSS.
Prerequisites
-
Supported region: The features described in this document are only available in the China (Beijing) region. You must use an API Key from that region.
-
Account permissions: If using an Alibaba Cloud sub-account (RAM user), you need to grant model invocation, training, and deployment permissions to the sub-account.
-
Configure environment variables: You have successfully obtained an API Key and configured it as an environment variable.
-
Preparation: You have read Fine-tune CosyVoice models to understand supported models, fine-tuning steps, data formats, and billing.
Create a fine-tuning job
China (Beijing)
POST https://dashscope.aliyuncs.com/api/v1/fine-tunes
For Windows CMD, replace$DASHSCOPE_API_KEYwith%DASHSCOPE_API_KEY%. For PowerShell, replace with$env:DASHSCOPE_API_KEY
Request parameters |
Using file_id dataset
Using OSS-mounted dataset
|
Headers |
|
|
Content-Type Fixed value: |
|
|
Authorization API Key authentication. Format: |
|
Request Body |
|
|
model The base model for fine-tuning. Currently supported:
|
|
|
training_type Fine-tuning type. Currently only |
|
|
hyper_parameters Hyperparameter configuration. CosyVoice fine-tuning involves two sub-networks that are decoupled and can be adjusted independently:
|
|
|
training_datasets Training dataset file list. Mutually exclusive with |
|
|
validation_datasets Validation dataset file list. Same structure as Mutually exclusive with |
|
|
training_file_ids Array of training dataset file IDs. Multiple IDs can be provided. Mutually exclusive with |
|
|
validation_file_ids Array of validation dataset file IDs. Multiple IDs can be provided. Mutually exclusive with |
|
|
job_name Fine-tuning job name. |
|
|
model_name Name of the model after fine-tuning is complete. |
Response parameters |
Success response exampleKey fields:
Error response example
|
|
request_id Unique identifier for the request. |
|
|
output Job details. |
|
|
code Error code. Returned on failure. See the error code table below. |
|
|
message Detailed error description. Returned on failure. |
Error codes
If the API call fails and returns an error message, refer to the following table for troubleshooting.
|
HTTP Status Code |
Error Code |
Solution |
|
400 |
InvalidParameter |
Parameter error: missing parameters or incorrect parameter format. Fix the parameters according to the error message. |
|
400 |
UnsupportedOperation |
The resource cannot be operated on while in a specific state. Wait until the resource reaches an operable state before retrying. |
|
404 |
NotFound |
The resource to query or operate on does not exist. Verify the resource ID. |
|
409 |
Conflict |
A deployment instance with the same name already exists. Add a suffix to differentiate. |
|
429 |
Throttling |
Resource creation has triggered platform limits. Delete models that are no longer in use. If you need to increase the concurrent fine-tuning job limit or retain more successfully fine-tuned models, contact your account manager. |
|
500 |
InternalError |
Internal error. Record the request_id and contact Alibaba Cloud engineers via a support ticket. |
Next steps
Fine-tuning is an asynchronous operation. After calling this API, you can use the Query and Manage Fine-Tuning Jobs API to check job status.