Textual inversion (TI) files are small models that customize the output of Stable Diffusion image generation. They can augment SD with specialized subjects and artistic styles. They are also known as “embeds” in the machine learning world.
Each TI file introduces one or more vocabulary terms to the SD model. These are
known in InvokeAI as “triggers.” Triggers are denoted using angle brackets
as in “<trigger-phrase>”. The two most common type of
TI files that you’ll encounter are .pt
and .bin
files, which are produced by
different TI training packages. InvokeAI supports both formats, but its
built-in TI training system produces .pt
.
Hugging Face has amassed a large library of >800 community-contributed TI files covering a broad range of subjects and styles. You can also install your own or others’ TI files by placing them in the designated directory for the compatible model type
Here are a few examples to illustrate how it works. All these images were generated using the legacy command-line client and the Stable Diffusion 1.5 model:
Japanese gardener | Japanese gardener <ghibli-face> | Japanese gardener <hoi4-leaders> | Japanese gardener <cartoona-animals> |
---|---|---|---|
You can also combine styles and concepts:
You may install any number of .pt
and .bin
files simply by copying them into
the embedding
directory of the corresponding InvokeAI models directory (usually invokeai
in your home directory). For example, you can simply move a Stable Diffusion 1.5 embedding file to
the sd-1/embedding
folder. Be careful not to overwrite one file with another.
For example, TI files generated by the Hugging Face toolkit share the named
learned_embedding.bin
. You can rename these, or use subdirectories to keep them distinct.
At startup time, InvokeAI will scan the various embedding
directories and load any TI
files it finds there for compatible models. At startup you will see a message similar to this one:
>> Current embedding manager terms: <HOI4-Leader>, <princess-knight>
To use these when generating, simply type the <
key in your prompt to open the Textual Inversion WebUI and
select the embedding you’d like to use. This UI has type-ahead support, so you can easily find supported embeddings.