Generate high quality images using Negative Embedding (Textual Inversion)
What is Negative Embedding (Textual Inversion)?
Negative Embedding (Textual Inversion) is one of the techniques used to help computers understand the meaning of words. Normally, a computer understands a word as a collection of numbers, or vector. This vector represents the meaning or relevance of the word.
For instance, suppose we have the word “dog”. The computer represents “dog” as a certain vector and thereby understands that “dog” is an animal, a pet, etc. However, in Negative Embedding, this vector of “dog” is reversed. The computer then starts looking for concepts that are the opposite or opposite of “dog”. In other words, it can find other animals that are not “dogs,” such as “cats” or “birds.
This technique is especially useful in situations that require a deeper understanding of the meaning of the words. For example, when analyzing a text to find conflicting ideas or emotions within it. However, this method is not yet perfect and the computer may find wrong associations. So, care should be taken when using it.
It may be difficult for beginners to understand such a complex technology, but in short, we hope you can think of Negative Embedding (Textual Inversion) as a tool to invert the meaning of words to find new perspectives and associations. It is an interesting technique, and if you want to learn more, you may want to look into word embedding models such as Word2Vec
and GloVe
. These are basic tools for representing word meanings as vectors.
How to install Negative Embedding (Textual Inversion)
Move the downloaded file to the \stable-diffusion-webui\embeddings
folder.
- Open the browser in the Web UI and open the “Textual Inversion” in the Generated Parameters area.
- Press the Refresh button to the right to see the file in the list.
If SD1.5 is selected as the checkpoint model, the only models displayed are those suitable for SD1.5. Please note that other models (SDXL) will not be displayed.
How to use Negative Embedding (Textual Inversion)
First, open the “Textual Inversion” page. If you want to apply a negative prompt, click on the position where you want to insert the negative prompt and select the Negative Embedding you want to apply from the list, and its name will appear in the negative prompt input field.
If you wish to cancel the adaptation, you can do so by selecting Negative Embedding again.
Negative Embedding (Textual Inversion) weighting adjustment
To adjust the weight (strength) of Negative Embedding, perform the following steps
- Select a name for the negative prompt input field.
- The weights can be increased or decreased by holding down the
Ctrl
key and pressing the↑
or↓
key (arrow keys).
(EasyNegative:1.2)
In the above example, this means that “EasyNegative” is applied at 1.2x weighting.
How to use the UI for Negative Embedding (Textual Inversion)
\stable-diffusion-webui\embeddings
folder, you can activate this button to switch to the tree view.
How to Edit Metadata for Negative Embedding (Textual Inversion) Models
Basically, you do not need to include any metadata. However, as the number of models increases, it becomes difficult to understand what kind of models they are, so we store descriptions of the models as metadata.
Move the mouse over the model you want to edit from the list, and the mark will appear in the upper right corner.
- Description: Enter a description of the metadata.
- Thumbnail: Thumbnails of metadata are displayed.
- Notes: Metadata notes and other information will be included.
- Replace preview: Use this when you want to update metadata thumbnails.
How to update metadata thumbnails
Generate images with models in portrait (SD1.5 -> 512×768/ SDXL -> 768×1344) with txt2img.
Once the image you want to use as a thumbnail has been generated, open the model edit screen on the “Textual Inversion” page.
Press “Replace preview” to replace the image with the one you just generated.
If you want to remove the thumbnails, you can find the model name.preview.png in the \stable-diffusion-webui\embeddings
folder and delete the PNG image to restore the initial state.
Conclusion
In this article, we have explained Negative Embedding (Textual Inversion); please try using Negative Embedding as it improves the quality of text generation. Also, please select an appropriate model, taking into consideration its compatibility with the checkpoint model.
We will be compiling a separate article on the recommended models, so please refer to that as well. Thank you for reading to the end.