Personalizedtxt2imgAddModelTrainJob

更新时间:
复制 MD 格式

Personalized text-to-image: Create a model training task.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

aicontent:Personalizedtxt2imgAddModelTrainJob

create

*All Resource

*

None None

Request syntax

POST /api/v1/personalizedtxt2img/addModelTrainJob HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

body

object

No

The request body.

name

string

Yes

The name of the model training job.

熊猫图片生成

objectType

string

Yes

A single word that defines the object type in the training images, such as "girl", "person", "man", "boy", or "dog".

dog

imageUrl

array

Yes

A list of one or more image URLs for training. For example: ["url_1", "url_2", ...]

string

No

A publicly accessible URL for a training image.

https://img.alicdn.com/imgextra/i2/O1CN011Ps6OK1LdWZQSUZD1_!!6000000001322-0-tps-572-1096.jpg

trainSteps

integer

No

The number of training steps for the model training job.

800

Response elements

Element

Type

Description

Example

object

The response object.

{"success":true,"errCode":null,"errMessage":null,"requestId":"8f6b1cd2-5390-478a-9968-2a5678601df5","data":{"id":"2","name":"熊猫图片生成","objectType":"panda","imageUrl":["https://pic1.zhimg.com/v2-6154d925bcebd8b41a30051695e5a134_720w.jpg","https://k.sinaimg.cn/n/tech/crawl/114/w550h364/20211103/24e2-2bc49a39210ce2ac520c876dcaee7bcd.jpg/w700d1q75cms.jpg"],"jobStatus":"NOT_START","inferenceJobList":null,"inferenceImageCount":0,"createTime":"2024-06-28T11:02:32.0598209"}}

requestId

string

The request ID.

xxxx-xxxx-xxxx-xxxxxxxx

success

boolean

Indicates whether the request succeeded.

true

errCode

string

The error code.

UNKNOWN_ERROR

errMessage

string

The error message.

未知错误

httpStatusCode

integer

The HTTP status code.

200

data

object

The response data.

[]

id

string

The model training job ID.

456

modelId

string

The model ID.

modelId-xxxx-xxxx-xxxx

name

string

The model training job name.

可爱熊猫模型训练任务

objectType

string

The training subject.

panda

imageUrl

array

A list of image URLs for model training.

string

An image URL for model training.

https://img.alicdn.com/imgextra/i2/O1CN011Ps6OK1LdWZQSUZD1_!!6000000001322-0-tps-572-1096.jpg

jobStatus

string

The status of the model training job.

TRAINING

jobTrainProgress

number

The progress of the model training job.

0.5

inferenceJobList

array<object>

A list of inference jobs.

object

Details of a single inference job.

id

string

The inference job ID.

3220

promptId

string

The prompt ID.

promptId-xxxx-xxxx-xxxx

modelId

string

The model ID.

modelId-xxxx-xxxx-xxxx

jobStatus

string

The status of the inference job.

FINISHED

jobTrainProgress

number

The progress of the inference job.

0.5

resultImageUrl

array

A list of URLs for the resulting images.

0000.png

string

A URL for a resulting image.

0000.png

createTime

string

The creation time of the inference job.

2023-12-25T12:00:00

inferenceImageCount

integer

The total number of images generated by this model.

5

createTime

string

The creation time of the model training job.

2023-12-25T12:00:00

Examples

Success response

JSON format

{
  "requestId": "xxxx-xxxx-xxxx-xxxxxxxx",
  "success": true,
  "errCode": "UNKNOWN_ERROR",
  "errMessage": "未知错误",
  "httpStatusCode": 200,
  "data": {
    "id": "456",
    "modelId": "modelId-xxxx-xxxx-xxxx",
    "name": "可爱熊猫模型训练任务",
    "objectType": "panda",
    "imageUrl": [
      "https://img.alicdn.com/imgextra/i2/O1CN011Ps6OK1LdWZQSUZD1_!!6000000001322-0-tps-572-1096.jpg\n"
    ],
    "jobStatus": "TRAINING",
    "jobTrainProgress": 0.5,
    "inferenceJobList": [
      {
        "id": "3220",
        "promptId": "promptId-xxxx-xxxx-xxxx",
        "modelId": "modelId-xxxx-xxxx-xxxx",
        "jobStatus": "FINISHED",
        "jobTrainProgress": 0.5,
        "resultImageUrl": [
          "0000.png"
        ],
        "createTime": "2023-12-25T12:00:00"
      }
    ],
    "inferenceImageCount": 5,
    "createTime": "2023-12-25T12:00:00"
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.