From 49d672ef4f605fddddc4040b650aed76cbf27b2a Mon Sep 17 00:00:00 2001 From: tanaka takashi Date: Sat, 12 Sep 2026 23:20:37 +0900 Subject: test: MCP画像生成ベンチマークを追加 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 実モデルを使用し、in-process MCP clientからgenerate_imageを再現可能に比較するbenchmark_generate_image.pyを追加。MCP schemaを変更せず、ベンチマーク内部だけでseedを固定し、2種類の評価シーンを同条件で生成できるようにした。 config、checkpoint、LoRA、VAE、scheduler、steps、CFGに加え、モデルロード時間、生成時間、prompt token数、PyTorch allocatorのallocated/reserved peakをJSONへ記録する。白背景率、外周白率、外周色分散、edge strengthも算出し、生成PNGと計測結果を指定先へ保存する。 CLIP tokenizerの最大長を生成前に検証し、token切り捨てによる比較条件の欠落を防止。READMEへ実行例と、CUDA初回warm-upを含む1枚目ではなく2枚目の定常生成時間を比較に使う注意事項を追加した。 実GPU検証としてRTX 5050、CUDA 13.2環境で18 configをvalidationし、MCP経由で36枚を生成。Ruff、Pyright、pytest(61 passed)、git diff --checkの成功を確認済み。モデル、config、prompt、生成画像、計測JSONを含むdata/配下は.gitignore対象のためコミットには含めない。 --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index 774e3d7..9b08798 100644 --- a/README.md +++ b/README.md @@ -56,3 +56,17 @@ uv run python script\smoke_generate_image.py ` --config data\config.generate-image.toml ` --output data\outputs\generate-image-mcp-512.png ``` + +同じ2つのseedでMCP生成を行い、処理時間、PyTorch allocatorのpeak VRAM、白背景率、 +prompt token数をJSONへ記録する比較用benchmarkは次のように実行できます。 + +```powershell +uv run python script\benchmark_generate_image.py ` + --config data\config.toml ` + --label anime-quality ` + --output-dir data\outputs\benchmark ` + --result data\outputs\benchmark\results\anime-quality.json +``` + +benchmarkはMCP schemaを変更せず、計測処理内だけでseedを固定します。1枚目にはCUDAの初回 +warm-upが含まれるため、定常速度の比較には2枚目の`elapsed_seconds`を使用してください。 -- cgit v1.2.3