跳至內容

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 會使用 google/gemma-4-31B-it 呼叫 dataset-captioner,而 Off 會保留每個圖像都必須有相同檔名主幹的 .txt 描述檔,或使用 trigger_phrase 作為後備方案的既有要求。對於生成的描述,trigger_phrase 會加入描述提示詞,並根據選取的 LoRA 描述慣例在產生的 sidecar 檔案中正規化。

預設

當 `auto_captioning` 為 Off 且任何圖像缺少說明檔時所需的 DreamBooth-style 實例片語。它會為缺少 .txt 檔的圖像提供說明,並提供預設驗證提示詞的起始文字。

預設 0.0005

LoRA B-factor 學習率;當 `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 會使用 google/gemma-4-31B-it 呼叫 dataset-captioner,而 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-factor 學習率;當 `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}以 safetensors 格式提供的訓練後 Krea-2 LoRA 權重下載 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-TW/developers/models/krea-2-trainer.md. 所有模型與指南: https://doitong.com/developers/llms.txt