Novita.ai
  1. 培训 API
Novita.ai
  • Novita.ai
  • 账户接口
    • 配置s3配置
      POST
    • 查询s3配置
      GET
    • 删除 s3 配置
      DELETE
    • 用户信息
      GET
  • 基本 API
    • 文字转图像
      POST
    • 图像到图像
      POST
    • 进步
      GET
    • 广告商
      POST
  • 基础 API V3
    • 使用 lcm 将文本转为图像
      POST
    • 使用 lcm 进行图像到图像
      POST
    • 获取异步任务结果
      GET
    • 文字转图像
      POST
    • 图像到图像
      POST
  • 模型 API
    • 同步 civitai 模型
      POST
    • 查询 civitai 模型
      GET
    • 查询模型
      GET
  • 案例 API
    • Upscale
      POST
    • 清除
      POST
    • 外画
      POST
    • 删除背景
      POST
    • 删除文字
      POST
    • 重新想象
      POST
    • 涂鸦
      POST
    • 混合姿势
      POST
    • 替换背景
      POST
    • 替换天空
      POST
    • 恢复面容
      POST
    • 创建图块
      POST
    • 去除水印
      POST
    • 合并面
      POST
    • 替换对象
      POST
    • 图片提示
      POST
    • 制作照片
      POST
    • 要遮罩的图像
      POST
  • 培训 API
    • 获取图片网址
      POST
    • 接受学科培训
      GET
    • 创建学科培训
      POST
    • 创建风格训练
      POST
    • 接受风格培训
      GET
    • 列出训练任务
      GET
  • 视频 API
    • 图像转视频 API
    • 图像到视频运动 API
    • 文本转视频 API
  1. 培训 API

创建学科培训

开发环境
http://dev-cn.your-api-server.com
开发环境
http://dev-cn.your-api-server.com
POST
/v3/training/subject
该 API 有助于启动训练任务和配置参数。
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'http://dev-cn.your-api-server.com/v3/training/subject' \
--header 'Authorization;' \
--header 'Content-Type: application/json' \
--data-raw '{
  "name": "test_1208_01",
  "base_model": "v1-5-pruned-emaonly",
  "width": 512,
  "height": 512,
  "image_dataset_items": [
    {
      "assets_id": 26,
      "caption": ""
    }
  ],
  "expert_setting": {
    "train_batch_size": 2,
    "learning_rate": 0.0001,
    "max_train_steps": 1,
    "seed": 2023,
    "lr_scheduler": "constant",
    "lr_warmup_steps": null,
    "instance_prompt": "Xstyle, of a young woman, profile shot, from side,sitting, looking at viewer, smiling, head tilt, eyes open,long black hair, glowing skin,light smile,cinematic lighting,dark environment",
    "class_prompt": "person",
    "with_prior_preservation": true,
    "prior_loss_weight": null,
    "train_text_encoder": false,
    "lora_r": null,
    "lora_alpha": null,
    "lora_text_encoder_r": null,
    "lora_text_encoder_alpha": null
  },
  "components": [
    {
      "name": "face_crop_region",
      "args": [
        {
          "name": "ratio",
          "value": "1.0"
        }
      ]
    },
    {
      "name": "resize",
      "args": [
        {
          "name": "width",
          "value": "512"
        },
        {
          "name": "height",
          "value": "512"
        }
      ]
    },
    {
      "name": "face_restore",
      "args": [
        {
          "name": "method",
          "value": "gfpgan_1.4"
        },
        {
          "name": "upscale",
          "value": "1.0"
        }
      ]
    }
  ]
}'
响应示例响应示例
{
  "task_id": "fe84ac1b-5a01-487c-a56d-2c6c93b61f49"
}

请求参数

Header 参数
Authorization
string 
必需
Content-Type
string 
必需
示例值:
application/json
Body 参数application/json
name
string 
必需
该模型训练的任务名称。
base_model
string 
必需
用于训练的基础模型。
width
integer 
训练图像宽度
必需
height
integer 
训练图像高度
必需
image_dataset_items
array [object {2}] 
必需
imageUrl 和图像标题
assets_id
integer 
图片资产 ID
可选
caption
string 
图片标题
可选
expert_setting
object 
可选
train_batch_size
integer 
训练批量大小
可选
learning_rate
number 
可选
学习率,控制单次迭代中模型参数的更新范围
max_train_steps
integer 
可选
最大火车步数。如果“max_train_steps”设置为 2000,参数“image_dataset_items”中的图像数量为 10,则每个图的训练步骤数为 200。
seed
integer 
可选
用于训练的随机种子。
lr_scheduler
string 
学习调度器。
可选
lr_warmup_steps
null 
可选
预热步骤,仅当 lr_scheduler 设置为“linear”、“cosine”、“cosine_with_restarts”、“polynomial”、“constant_with_warmup”中的枚举时生效。
instance_prompt
string 
必需
表示最能描述“实例图像”的提示
class_prompt
string 
使训练更有针对性。
必需
with_prior_preservation
boolean 
保留优先选项。
可选
prior_loss_weight
null 
必须大于 0
可选
train_text_encoder
boolean 
没有什么
可选
lora_r
null 
可选
lora_alpha
null 
可选
lora_text_encoder_r
null 
可选
lora_text_encoder_alpha
null 
可选
components
array [object {2}] 
必需
为训练配置的通用参数。
name
string 
必需
组件类型。当设置为 'face_crop_region' 时,args 可以设置为 "args": [{"name": "ratio", "value": "1.0"}],ratio > 1 表示将包含更多的非面部区域。当设置为 'resize' 时,args 可以设置为 "args": [{"name": "width", "value": "512"}, {"name": "height", "value": "512 "}],这意味着所有图像将被裁剪为512*512。当设置为 'face_restore' 时,args 可以设置为 "args": [{"name": "method", "value":"gfpgan_1.4"}],即开启人脸恢复功能。
args
array [object {2}] 
组件详细设置。
必需
示例

返回响应

🟢200成功
application/json
Body
task_id
string 
必需
上一页
接受学科培训
下一页
创建风格训练
Built with