Skip to content

Troyanovsky/stable_diffusion_prompt_optimizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Stable Diffusion Prompt Optimizer

This colab notebook (https://colab.research.google.com/drive/1nCoa55cm8JpIXxBW9RaVSvb8B1WO2ZFz?usp=sharing) is an attempt to automatically optimize stable diffusion prompts.

Rationale

The rationale is that for a good prompt, you need to have the objects, art movement, art medium, artists, and flavor modifiers.

For all these tags, the closer they are, the most harmonious they are and thus produces higher quality images from stable diffusion. For example, for an impressionism painting (an art movement), it pairs well with Claude Monet, Edouard Manet, Pierre-Auguste Renoir (artists), oil paiting (medium), and unblended color and natural lights (flavors).

Process

To do this process automatically, I did the following:

  1. Collected lists of art movements, artists, art medium, and flavors tags that work in stable diffusion.
  2. Turn them into vector embeddings with pre-trained embeddings.
  3. Compare them with the user's existing tags to find art movements, artists, art medium, and flavors to add to the prompt.

How to use

To use the notebook, first read and run the pre-req section, put the tags files from Github (https://github.com/Troyanovsky/stable_diffusion_prompt_optimizer) into your google drive.

The first section creates embeddings as preparation. It only needs to be run once.

The second section is for optimizng the prompt. Once it's run, you can just change and run the "Inference" section.

Examples:

Before: mountains and rivers, traditional chinese painting

image

After: mountains and rivers,traditional chinese painting,national geographic,Theophanes the Greek,a renaissance painting,arts and crafts movement

image

About

A tool to automatically optimize stable diffusion prompts

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published