mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
55 lines
2.9 KiB
Markdown
55 lines
2.9 KiB
Markdown
## Using Textual Inversion Files
|
|
|
|
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](TRAINING.md) produces `.pt`.
|
|
|
|
[Hugging Face](https://huggingface.co/sd-concepts-library) 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
|
|
|
|
### An Example
|
|
|
|
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:
|
|
|
|
<figure markdown>
|
|
| A portrait of <alf> in <cartoona-animal> style |
|
|
| :--------------------------------------------------------: |
|
|
|  |
|
|
</figure>
|
|
|
|
|
|
## Installing your Own TI Files
|
|
|
|
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:
|
|
|
|
```bash
|
|
>> 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. |