7. トークンとチャンク 7. Token & Chunking
Stable Diffusionで思い通りの画像を生成するために避けて通れない、「75トークンの壁」と「チャンク分割」について解説します。 This section explains the "75-token wall" and "chunking," which are unavoidable for generating images exactly as you envision in Stable Diffusion.
1. トークンとは? 1. What is a Token?
AIは言葉をそのまま理解するのではなく、「トークン (Token)」という数値に変換して理解します。「1単語=1トークン」とは限らず、長い単語は分割されることがあります。 AI converts words into numbers called "tokens". It's not always "1 word = 1 token"; long words may be split.
2. 75トークンの制限とチャンク 2. The 75-Token Limit & Chunking
Stable
Diffusionは、プロンプトを75トークンごとの塊(チャンク)に区切って処理します。
あふれた分は捨てられるわけではなく、2つ目、3つ目のチャンクとして処理されますが、「チャンクを跨ぐと文脈が途切れやすい」という性質があります。
Stable Diffusion processes prompts in
chunks of 75 tokens.
Overflow is not discarded but processed as a 2nd or 3rd chunk.
However,
"context is easily broken across chunks".
仕様上の最大長は77トークンですが、開始(Start)と終了(End)のタグが自動挿入されるため、ユーザーが使えるのは実質75トークンです。 The max length is 77 tokens, but Start/End tags are auto-inserted, so users effectively have 75 tokens.
3. 【重要】画質崩壊の罠 (チャンク跨ぎ) 3. The Trap: Chunk Straddling
「プロンプトを少し微調整しただけなのに、生成された画像が真っ白になったり、色がぐちゃぐちゃになったりした」
その原因は、重要な単語がチャンクの境界で分断された(跨いだ)ことにあるかもしれません。
"I just tweaked the prompt a little, but the image turned white
or messy."
The cause might be that a crucial word was split (straddled)
across the chunk boundary.
AI: The connection between "blue" and "sky" is broken!
解決策:
本ツールの可視化機能を見て、警告が出ているタグを移動させるか、手前で
BREAK を入れて区切りを調整してください。
Solution: Check the visualization in this tool. If
you see a warning, move the tag or insert a
BREAK before it to adjust the split.
AI: "blue sky" is recognized as a single unit!
4. 本ツールの機能 4. Tool Features
75トークンごとの境界線を表示します。 Displays boundary lines for every 75 tokens.
タグの途中でチャンクが切れてしまっている場合、警告アイコンでお知らせします。 Alerts you with a warning icon if a chunk is cut off in the middle of a tag.