跳转到内容

Krea 2 Trainer

集成

模型 id krea-2-trainer
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.com/v1/run/krea-2-trainer?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "images_data_url": "https://content.doitong.com/images/showcase/v3/gen_fox_cartoon.jpg"
  }'

# Still "queued" or "running"? Poll with the id from the response:
curl "https://api.doitong.com/v1/requests/REQUEST_ID?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY"

与示例类似的文件: $0.30 300 API 积分 运行前会测量你的文件 在此页面运行

获取 API 密钥
Krea 训练 #lora#personalization

从图像 zip 文件训练自定义 Krea 2 LoRA,可选自动添加说明

Krea · 文件

你的第一个结果将在此显示

在下方构建请求,并使用你的 API 密钥运行。输出会复制到我们的存储中,可永久保存或免费保存 7 天。

构建请求

控件根据模型架构生成。更改控件时,代码和价格会同步更新。

resolution 默认 768

训练分辨率:1024 更注重最大精细度,768 可使训练速度提升约 1.7 倍、减少 VRAM 使用量,同时风格质量几乎相同。图像会缩放至覆盖目标正方形,然后从中心裁剪。

•必填

训练图像 .zip 的 URL,其中包含 PNG/JPG/JPEG/WebP 文件;如果任何图像既没有字幕文件,`trigger_phrase` 又为空,请求将以 422 失败。当 `trigger_phrase` 提供备用内容时,字幕可选;否则使用匹配的文件名主体:ROOT.EXT 与 ROOT.txt 配对,例如 001.jpg 与 001.txt。

默认 100

LoRA 训练的步骤数。

高级 auto_captioning · trigger_phrase · learning_rate · debug_dataset
auto_captioning 默认 Off

可选的字幕模式:Object/Character、Style 和 Custom 会调用 dataset-captioner 与 google/gemma-4-31B-it,而 Off 保留现有要求:每个图像都必须有匹配主文件名的 .txt 字幕文件,或使用 trigger_phrase 作为后备方案。对于生成的字幕,trigger_phrase 会进入字幕提示词,并根据所选 LoRA 字幕约定在生成的 sidecar 文件中进行规范化。

默认

当 `auto_captioning` 为 Off 且任何图像缺少字幕文件时所需的 DreamBooth-style 实例短语。它会为缺少 .txt 文件的图像提供字幕,并作为默认验证提示词的起始文本。

默认 0.0005

LoRA B 因子的学习率;当 `lora_a_lr_multiplier=1` 时也应用于 A;在 muon 下,它表示按 match_rms_adamw 缩放的等效 AdamW 学习率。对于恒定调度,Krea 建议范围为 3e-4–7e-4。

POST /run/krea-2-trainer?wait=20 报价 → $0.30
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.com/v1/run/krea-2-trainer?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "images_data_url": "https://content.doitong.com/images/showcase/v3/gen_fox_cartoon.jpg"
  }'

# Still "queued" or "running"? Poll with the id from the response:
curl "https://api.doitong.com/v1/requests/REQUEST_ID?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY"

运行此请求

你的密钥会保留在此浏览器中:仅发送到 Doitong API;只有勾选“记住”后才会保存到 localStorage。 获取 API 密钥

关于 Krea 2 Trainer

在 `images_data_url` 中的图像 .zip 文件上微调 LoRA,可选使用同名 .txt 说明和 `trigger_phrase`。`auto_captioning` 模式包括 Off、Object/Character、Style 和 Custom。`steps` 为 50 到 10000(默认 100),`resolution` 为 768 或 1024。输出 LoRA 权重和配置文件。

参数

名称类型 默认值允许值 描述
images_data_url必填
类型string
训练图像 .zip 的 URL,其中包含 PNG/JPG/JPEG/WebP 文件;如果任何图像既没有字幕文件,`trigger_phrase` 又为空,请求将以 422 失败。当 `trigger_phrase` 提供备用内容时,字幕可选;否则使用匹配的文件名主体:ROOT.EXT 与 ROOT.txt 配对,例如 001.jpg 与 001.txt。
trigger_phrase可选
类型string
默认值
当 `auto_captioning` 为 Off 且任何图像缺少字幕文件时所需的 DreamBooth-style 实例短语。它会为缺少 .txt 文件的图像提供字幕,并作为默认验证提示词的起始文本。
auto_captioning可选
类型enum
默认值Off
OffObject/CharacterStyleCustom
可选的字幕模式:Object/Character、Style 和 Custom 会调用 dataset-captioner 与 google/gemma-4-31B-it,而 Off 保留现有要求:每个图像都必须有匹配主文件名的 .txt 字幕文件,或使用 trigger_phrase 作为后备方案。对于生成的字幕,trigger_phrase 会进入字幕提示词,并根据所选 LoRA 字幕约定在生成的 sidecar 文件中进行规范化。
steps可选
类型integer
默认值100
50 – 10,000
LoRA 训练的步骤数。
learning_rate可选
类型number
默认值0.0005
0.000001 – 0.01
LoRA B 因子的学习率;当 `lora_a_lr_multiplier=1` 时也应用于 A;在 muon 下,它表示按 match_rms_adamw 缩放的等效 AdamW 学习率。对于恒定调度,Krea 建议范围为 3e-4–7e-4。
resolution可选
类型enum
默认值768
7681024
训练分辨率:1024 更注重最大精细度,768 可使训练速度提升约 1.7 倍、减少 VRAM 使用量,同时风格质量几乎相同。图像会缩放至覆盖目标正方形,然后从中心裁剪。
debug_dataset可选
类型boolean
默认值false
数据集下载选项,公开训练实际使用的内容,并在字幕回填或自动字幕生成后打包为归档文件。
必填

输出

GET /requests/req_8k2m4q7x1z9c3v5b6n0p2r4t
{
  "id": "req_8k2m4q7x1z9c3v5b6n0p2r4t",
  "object": "request",
  "model": "krea-2-trainer",
  "status": "succeeded",
  "created_at": "2026-10-20T12:00:00Z",
  "started_at": "2026-10-20T12:00:02Z",
  "completed_at": "2026-10-20T12:00:09Z",
  "queue_position": null,
  "cost": {
    "credits": 300,
    "usd": "0.30",
    "charged": 300,
    "refunded": 0
  },
  "input": {
    "images_data_url": "https://content.doitong.com/images/showcase/v3/gen_fox_cartoon.jpg"
  },
  "output": {
    "lora_file": {
      "url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.jpeg",
      "content_type": "image/jpeg",
      "file_name": "0-output.jpeg",
      "file_size": 1843200
    },
    "config_file": {
      "url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.jpeg",
      "content_type": "image/jpeg",
      "file_name": "0-output.jpeg",
      "file_size": 1843200
    },
    "prompt_enhancement_system_prompt": "string",
    "debug_dataset": {
      "url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.jpeg",
      "content_type": "image/jpeg",
      "file_name": "0-output.jpeg",
      "file_size": 1843200
    }
  },
  "outputs": [
    {
      "type": "file",
      "url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.jpeg",
      "content_type": "image/jpeg",
      "file_size": 1843200,
      "stored": true
    }
  ],
  "error": null,
  "metrics": {
    "inference_seconds": 6.8
  },
  "urls": {
    "self": "https://api.doitong.com/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t",
    "cancel": "https://api.doitong.com/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t/cancel"
  }
}
你的文件,由你选择每个 outputs[].url 都是存储中的副本:可永久保存(按 GB-月付费),也可免费保存 7 天,由账户设置或 ?storage= 决定。
每个模型的结构相同图像、视频和音频均包含 type、url、content_type、width、height 和 duration。output 是模型自身的结果对象。
输出字段
lora_file
object {url, content_type, file_name, file_size}训练得到的 Krea-2 LoRA 权重的 safetensors 格式下载 URL。
config_file
object {url, content_type, file_name, file_size}包含训练/LoRA 配置的 JSON 文件链接。
prompt_enhancement_system_prompt
string | null启用 `auto_captioning` 时返回的系统提示词,用于帮助编写或优化推理提示词,并遵循与自动生成字幕的训练数据相同的字幕约定。
debug_dataset
object {url, content_type, file_name, file_size} | null启用 `debug_dataset` 时提供的训练数据下载:包含准备好的数据集及其自动生成字幕的归档文件。

更多模型:训练

对于 AI 代理:此页面的 Markdown 版本位于 https://doitong.com/zh/developers/models/krea-2-trainer.md. 所有模型和指南: https://doitong.com/developers/llms.txt