tencent cloud

APIs

CreateTrainingTask

다운로드
포커스 모드
폰트 크기
마지막 업데이트 시간: 2026-09-02 15:45:19

1. API Description

Domain name for API request: tione.intl.tencentcloudapi.com.

This API is used to create a model training task.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: CreateTrainingTask.
Version Yes String Common Params. The value used for this API: 2021-11-11.
Region Yes String Common Params. For more information, please see the list of regions supported by the product.
Name Yes String Training task name. The name cannot exceed 60 characters in length, and can contain only Chinese characters, letters, digits, underscores (_), and hyphens (-). It must start with a Chinese character, letter, or digit.
ChargeType Yes String Billing mode. For example, PREPAID indicates yearly/monthly subscription (resource group).
POSTPAID_BY_HOUR indicates pay-as-you-go mode.
ResourceConfigInfos.N Yes Array of ResourceConfigInfo Resource configuration. Specify the CVM instance specification ID and number of nodes. The API for querying the CVM instance specification ID is DescribeBillingSpecsPrice. For example, [{"Role":"WORKER", "InstanceType": "TI.S.MEDIUM.POST", "InstanceNum": 1}].
TiProjectId No String TI Workspace ID. Used solely for the "Workspace" allowlist feature. To use this feature, please contact a TI administrator to enable allowlisting.
FrameworkName No String Training framework name, which can be queried via the DescribeTrainingFrameworks API. For example, SPARK, PYSPARK, TENSORFLOW, and PYTORCH.
FrameworkVersion No String Training framework version, which can be queried via the DescribeTrainingFrameworks API. For example, 1.15 and 1.9.
FrameworkEnvironment No String Training framework environment, which can be queried via the DescribeTrainingFrameworks API. For example, tf1.15-py3.7-cpu and torch1.9-py3.8-cuda11.1-gpu.
ResourceGroupId No String ID of the prepaid dedicated resource group, which can be queried via the DescribeBillingResourceGroups API.
Tags.N No Array of Tag Tag configuration.
ImageInfo No ImageInfo Custom image information.
CodePackagePath No CosPathInfo COS code package path.
StartCmdInfo No StartCmdInfo Task startup command. Specify this parameter based on the task training mode. If the configuration fails due to special characters, use the EncodedStartCmdInfo parameter instead.
TrainingMode No String Training mode, which can be queried via the DescribeTrainingFrameworks API. For example, PS_WORKER, DDP, MPI, and HOROVOD.
DataConfigs.N No Array of DataConfig Data configurations. This parameter depends on the DataSource field. The maximum number of configurations is 10.
VpcId No String VPC Id
SubnetId No String Subnet ID.
Output No CosPathInfo COS training output path.
LogConfig No LogConfig CLS logging configuration.
TuningParameters No String Tuning parameters. The value of this parameter cannot exceed 2048 characters in length.
LogEnable No Boolean Indicates whether to report logs.
Remark No String Remarks. The value of this parameter cannot exceed 1024 characters.
DataSource No String Data source. For example, DATASET, COS, CFS, CFSTurbo, HDFS, and GooseFSx.
CallbackUrl No String Callback URL. This parameter is used for the asynchronous callback to create, start, or stop training tasks. For the callback format and content, see [TI-ONE API Callback Description].
EncodedStartCmdInfo No EncodedStartCmdInfo Encoded task startup command. If StartCmdInfo is also configured, only this parameter takes effect.
CodeRepos.N No Array of CodeRepoConfig Code repository configuration.
ExposeNetworkConfig No ExposeNetworkConfig Network exposure configuration.
Envs.N No Array of EnvVar Environment Variables.
TrainToolConfig No TrainToolConfig Train tool configuration.
ResourceSupplyAttribute No ResourceSupplyAttribute Training Diagnostic Tool Configuration.
Queues.N No Array of String Queue ID.

3. Output Parameters

Parameter Name Type Description
Id String Training task ID.
RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

4. Example

Example1 Creating a Training Task

This example shows you how to create a training task.

Input Example

POST / HTTP/1.1
Host: tione.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateTrainingTask
<Common request parameters>

{
    "Name": "zhangsan-lora",
    "FrameworkName": "PYTORCH",
    "FrameworkEnvironment": "tilearn-llm1.0-torch2.1-angel-vllm1.0-py3.10-cuda12.1-gpu",
    "TrainingMode": "DDP",
    "ChargeType": "PREPAID",
    "ResourceConfigInfos": [
        {
            "Role": "WORKER",
            "Cpu": 1000,
            "Memory": 1024,
            "GpuType": "",
            "Gpu": 0,
            "InstanceType": "",
            "InstanceTypeAlias": "",
            "InstanceNum": 1
        }
    ],
    "ResourceGroupId": "ersg-rf6p8zb8",
    "Tags": [],
    "Remark": "",
    "CodePackagePath": {
        "Bucket": "test-gz-1256580188",
        "Region": "ap-guangzhou",
        "Paths": [
            "test/"
        ]
    },
    "EncodedStartCmdInfo": {
        "StartCmdInfo": "eyJTdGFydENtZCI6IiIsIlBzU3RhcnRDbWQiOiIiLCJXb3JrZXJTdGFydENtZCI6InNsZWVwIDEwIn0="
    },
    "DataConfigs": [
        {
            "DataSourceType": "CFS",
            "MappingPath": "/opt/ml/input/data/",
            "CFSSource": {
                "Id": "cfs-pchxhlg9",
                "Path": "/bin"
            }
        }
    ],
    "TuningParameters": "{\"test\":\"test\"}",
    "Output": {
        "Bucket": "test-gz-1256580188",
        "Region": "ap-guangzhou",
        "Paths": [
            "cos_test/"
        ]
    },
    "LogEnable": false,
    "VpcId": "vpc-a26qv3af",
    "SubnetId": "subnet-m7xhqcyc"
}

Output Example

{
    "Response": {
        "Id": "train-1208038387393233920",
        "RequestId": "0161f5a9-3f60-4e39-86ab-fb87b225964d"
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
FailedOperation Operation failed.
FailedOperation.DuplicateNameTaskIsCreating The training task name already exists. Change the name.
FailedOperation.FreezeBillFailed Failed to freeze due to insufficient balance.
FailedOperation.QueryResourceSpecFailed Failed to query billable item details.
InternalError Internal error.
InternalError.BindingTagsFailed Failed to bind the tag.
InternalError.CFSNotFound The file system does not exist.
InternalError.CheckFSPathAccessibilityFailed Failed to validate the permissions of the file system path.
InternalError.CreateTcrInstanceTokenFailed Failed to create the long-term access credential for the TCR image repository.
InternalError.GetCFSFileSystemsFailed Failed to query the file system information.
InternalError.GetCFSMountInfoFailed Failed to query the file system mount information.
InternalError.QueryHDFSInfoFailed Failed to retrieve the HDFS storage information.
InternalError.QueryResourceGroupFailed Failed to query prepaid resource group details.
InternalError.QueryResourceSpecFailed Failed to query the resource package specification.
InternalError.QuerySubnetInfoFailed Failed to query the subnet information.
InternalError.QueryVPCInfoFailed Failed to query VPC information.
InternalError.ValidateCreateTaskFailed Failed to validate task parameters.
InvalidParameter Parameter error.
InvalidParameterValue Parameter value error.
InvalidParameterValue.AIMarketOutputConfigEmpty The platform's built-in CFS code is selected for the task, but the /opt/ml/output/data output path is incorrect. Unable to submit the task.
InvalidParameterValue.AIMarketPublicAlgoVersionNotExist The version ID of the AI market public algorithm does not exist.
InvalidParameterValue.BackOffLimitIllegal Invalid auto-restart count.
InvalidParameterValue.BackOffLimitNotSupport Auto-restart is not supported for this task.
InvalidParameterValue.CosPathNotExist The COS path does not exist.
InvalidParameterValue.DatasetNumLimitExceeded The number of data sets has exceeded the limit.
InvalidParameterValue.DuplicateName Instance name conflict. Change the name and try again.
InvalidParameterValue.FSPathInaccessible Access to the file system path is restricted.
InvalidParameterValue.FrameworkVersionNotSupport Unsupported training framework version. Read the documentation to view the frameworks and versions supported by TI-ONE.
InvalidParameterValue.GetCFSMountIPFailed Failed to retrieve the mount IP address for CFS.
InvalidParameterValue.GetGooseFSFailed Failed to retrieve the GooseFS instance.
InvalidParameterValue.GooseFSNotExist The selected GooseFS instance does not exist.
InvalidParameterValue.ImageIllegal Invalid image address.
InvalidParameterValue.ImageNotFound The training task image does not exist.
InvalidParameterValue.NotAllow The operation is not allowed.
InvalidParameterValue.ParamLengthExceedLimit The parameter length has exceeded the limit.
InvalidParameterValue.PathIllegal Invalid local disk path.
InvalidParameterValue.QueryVPCInfoFailed Failed to query the VPC information.
InvalidParameterValue.RDMAConfigIllegal Invalid RDMA configuration.
InvalidParameterValue.ResourceConfigIllegal Invalid resource configuration.
InvalidParameterValue.TAIJIResourceConfigIllegal Failed to create a fine-tuning task. Configure the resources according to the template recommendations.
InvalidParameterValue.UnsupportedDataConfig Bare metal resource groups do not support input data configuration.
MissingParameter Error of missing parameters.
OperationDenied.BalanceInsufficient Insufficient balance. Failed to create or update.
OperationDenied.BillingException Billing platform error.
OperationDenied.BillingStatusResourceInsufficient Pay-as-you-go resources are sold out.
OperationDenied.IpIllegal Invalid IP address.
OperationDenied.MIYINGBalanceInsufficient Insufficient balance in the Miying resource package. Top up first.
OperationDenied.NetworkCidrIllegal Invalid IP address range.
OperationDenied.NotAllow The operation is not allowed.
OperationDenied.ResourceGroupInsufficient Insufficient remaining quota in the prepaid resource group.
OperationDenied.SubnetIllegal Invalid subnet.
OperationDenied.TAIJIApplicationGroupInsufficient Insufficient resources in the Taiji application group to meet training requirements.
OperationDenied.WhitelistQuotaExceed Insufficient free quota for the allowlist.
ResourceNotFound.CfsNotFound The file system does not exist.
ResourceNotFound.VPCNotFound The VPC does not exist.
UnknownParameter Unknown parameter error.

도움말 및 지원

문제 해결에 도움이 되었나요?

피드백