Train Character Loraのロゴ

Train Character Lora

コミュニティ
artokun
train-character-lora

comfyui-mcpのtrain_*ツール(GPU Docker + ostris ai-toolkit)を使って、FLUX.1-dev向けのキャラクター/人物のLoRAをローカルで学習します。ユーザーがローカルGPUで写真から人物やキャラクターのLoRAを学習したい場合に使用します。データセットの準備、学習の開始とモニタリング、ComfyUIでの学習結果の使用方法を解説します。WAN/Z-Image向けのai-toolkit UIを使った学習については、ai-toolkit-trainerを参照してください。

Add to TypingMind

概要

公開者artokun
リポジトリcomfyui-mcp
スキル名train-character-lora
スター
811
フォーク
137
同梱ファイル
指示のみ
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

    artokunがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Train Character Lora」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/artokun/comfyui-mcp/tree/main/plugin/skills/train-character-lora
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/artokun/comfyui-mcp.git /tmp/comfyui-mcp
mkdir -p .claude/skills
cp -r /tmp/comfyui-mcp/plugin/skills/train-character-lora .claude/skills/train-character-lora
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでTrain Character Loraを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にTrain Character Loraを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Train Character Loraは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Train a Character LoRA (local, Flux.1-dev)

Overview

The trainer runs ostris ai-toolkit's run.py inside a headless GPU Docker container, driven through the three train_* MCP tools. You (the LLM) are the UI. Each takes an action: train_prepare_dataset owns the datasets, train_start owns the jobs, and train_doctor owns the trainer itself. You generate the dataset, launch the job, watch progress, and the finished LoRA lands in ComfyUI models/loras/ and the LoRA catalog without further steps.

  • Base model: FLUX.1-dev (the best proven character consistency; needs ~24GB VRAM with quantization, RTX 4090 class).
  • Phase-1 scope: character LoRAs only. Style/slider/edit and other bases come later.

The flow (tool sequence)

  1. train_doctor {action:"doctor"}. Preflight once per session. Checks docker daemon, --gpus all GPU passthrough, trainer image, HF_TOKEN. If image:false, run train_doctor {action:"build_image"} (one-time, several minutes, since it builds CUDA plus torch plus ai-toolkit). If hfTokenSet:false, warn the user: the first run downloads FLUX.1-dev (gated HF repo) and needs HF_TOKEN in the MCP server env.
  2. train_prepare_dataset {action:"prepare"}. Stage the images. See "Dataset" below.
  3. train_start {action:"start"}. Launch. Returns a job id at once; training runs detached.
  4. train_start {action:"status", id}. Poll progress (progress.step/totalSteps/loss, recent samples, log tail). Poll on a slow cadence (every few minutes). A 2000-step run is roughly an hour on a 4090. Don't block on it.
  5. Done. status:"completed" means the .safetensors was copied to models/loras/<name>.safetensors and upserted into the LoRA catalog (result has the paths and catalog id). Verify by loading it in a Flux workflow (LoraLoaderModelOnly, strength 1.0) with the trigger word in the prompt.

Dataset guidance

Call train_prepare_dataset {action:"prepare"} with name, items: [{path, caption?}, ...] and a defaultCaption.

  • 10 to 30 varied images of the subject: different angles, expressions, lighting, backgrounds, distances (close-up, half-body, full-body). Variety beats count.
  • Trigger word: pick something rare and stable (e.g. ohwx, zxc_person), NOT a real word. Use it as defaultCaption and pass it as trigger to train_start.
  • Captions: describe what changes between images (pose, setting, clothing, expression); the model learns the constant identity from the images themselves. Start each caption with the trigger word, e.g. ohwx person sitting in a cafe, laughing, natural light. Keep them short and factual. When in doubt, the trigger word alone (defaultCaption) is a workable baseline.
  • Images are copied and renamed img_00001.<ext> etc. Source files are never modified.

Params (sane defaults — override sparingly)

ParamDefaultWhen to change
steps2000200 for a smoke test; 1500–3000 real runs. More ≠ better (overbake = plasticky).
lr1e-45e-5 for a tighter/subtler identity.
rank1632 for very detailed characters.
resolution[512,768,1024][512] if VRAM-constrained.
quantizetrueKeep true on 24GB.
saveEvery / sampleEvery250Lower (100) to watch early progress.

Monitoring & judgement

  • train_start {action:"status"}'s progress.samples are host paths. Look at them. (ai-toolkit prints no saved-sample lines, so they populate at finalize from the output dir; mid-run you can look directly in the job's output/<name>/samples/ folder.) Identity should be recognizable by ~1/3 of the run; if samples stay generic past halfway, the run will likely underfit. Cancel (train_start {action:"cancel", id}) and check captions and trigger.
  • Loss should trend down and stabilize (~0.1 to 0.3); wild spikes usually mean lr too high.
  • Checkpoints save every saveEvery steps under the job's output/ dir, so a cancelled run isn't a total loss.

Failure modes

  • no_docker / no_image from train_start {action:"start"}: run train_doctor {action:"doctor"}, follow its hints.
  • OOM / CUDA errors in the log tail: drop resolution to [512], keep quantize:true, batch stays 1.
  • handoff failed in job error: training itself finished; the LoRA is still under the job's output/<name>/ dir. Copy it into models/loras/ manually and upsert the catalog.
  • First run is slow before step 1. FLUX.1-dev download (~24GB) plus latent caching. As long as the log tail moves, it's fine. The HF cache persists across runs.

Sources

  • Official: none found.
  • Empirical: sampler values, wiring, and prompt notes from working graphs in packs/ and observed renders; not a vendor prompting guide.

よくある質問

AIスキル「Train Character Lora」では何ができますか?

comfyui-mcpのtrain_*ツール(GPU Docker + ostris ai-toolkit)を使って、FLUX.1-dev向けのキャラクター/人物のLoRAをローカルで学習します。ユーザーがローカルGPUで写真から人物やキャラクターのLoRAを学習したい場合に使用します。データセットの準備、学習の開始とモニタリング、ComfyUIでの学習結果の使用方法を解説します。WAN/Z-Image向けのai-toolkit UIを使った学習については、ai-toolkit-trainerを参照してください。

TypingMindでTrain Character Loraを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Train Character Loraはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにTrain Character Loraをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/artokun/comfyui-mcp/tree/main/plugin/skills/train-character-loraを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

Train Character Loraを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Train Character Loraで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもTrain Character Loraを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Train Character Lora」は無料ですか?

はい。artokunがMITライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇