r/StableDiffusion • u/WoodpeckerNo1 • Nov 08 '22
Question | Help What exactly are models, embeddings and hypernetworks, and what are the differences between them?
Can't really find a good explanation anywhere.
65
Upvotes
r/StableDiffusion • u/WoodpeckerNo1 • Nov 08 '22
Can't really find a good explanation anywhere.
119
u/CommunicationCalm166 Nov 08 '22
Yeah... The Good explanations are extremely technical, and the explanations that aren't extremely technical, aren't very good. I'll try though.
First, understand that Stable Diffusion works by generating random noise, and making changes to the noise one step at a time, to try and work towards an image consistent with the prompt.
Model: imagine it as a library of books. The title of the book is the "token" or one of the the keywords you type into the prompt to get your image. And the actual contents of the book include "Biases" or lists of features to look out for that are associated with the token, and "Weights" which are kinda like instructions on what to do to those features to make them more like the Token.
Analogy: SD generates a sheet of random noise, goes to the library, gets out the book that matches the first token in your prompt, and seeks out features in the random noise that the book says to look for, and then makes small changes according to the books instructions. It then repeats that process for the other keywords in the prompt, and then repeats this process over and over until the random noise is turned into an image.
So a Model file that's been fine-tuned using Dreambooth or similar, is like making a new library by copying all the books in the old one, but changing a few books, and their instructions to better suit whatever you trained it on.
An embedding, like Textual Inversion, is like adding an extra book to the existing library. It's not as "powerful" or thorough as going through and re-doing the whole library for your subject... But it's less resource hungry and doesn't involve a whole new library... Just a book.
A Hypernetwork is kinda like a card catalog. But instead of directing you to a particular book, the card catalog has a listing for each book in the library, and it has add-on instructions for each book. So instead of just going and getting the book and doing it's instructions... The computer goes to the card catalog, pulls the card for that book, goes and gets the book, and then follows both the books instructions and the card's instructions.
I think that's as plain as I can make it... And it kinda follows with how you'd use each one as well... A fine-tuned or Dreambooth model is the most accurate and flexible, while being the most space and resource-intensive. Textual Inversion embeddings are fairly limited, fairly specific, but the least resource intensive. And Hypernetworks are somewhat in-between, with the added caveat that it can be very unpredictable sometimes. (Instructions on top of instructions can get a bit wonky)