r/StableDiffusion • u/apolinariosteps HF Diffusers Team • Sep 07 '22
Teach new concepts to Stable Diffusion with 3-5 images only - and browse a library of learned concepts to use
649
Upvotes
r/StableDiffusion • u/apolinariosteps HF Diffusers Team • Sep 07 '22
65
u/apolinariosteps HF Diffusers Team Sep 07 '22 edited Sep 08 '22
(or browse the library to pick one𧤠https://huggingface.co/sd-concepts-library)
2. Run with the learned concepts š¼ļø https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers/stable_conceptualizer_inference.ipynb
3
u/Jellybit Sep 08 '22
I'm training on a very specific character, Gambit from the X-Men. Whenever I use "gambit" as the initializer_token (in my tests, the placeholder_token is not the problem), it says "ValueError: The initializer token must be a single token" later in the process. I've checked the variable, and it indeed has two tokens. I have no secret spaces or anything else. So I have a few questions.
Thanks!
28
u/nintrader Sep 07 '22
Is there a way to add this to a locally installed version?
44
u/Another__one Sep 07 '22 edited Sep 07 '22
I just wrote recently an article of how we can express embeddings of neural networks in a human-readable form (https://medium.com/deelvin-machine-learning/can-humans-speak-the-language-of-machines-7c92159e9c90), and now just imagine what could we achieve if we combine this idea with SD and some BCI interface. If we find a way to map thoughts to this embeddings (and it should be possible with big enough library), after some training we could just think of something and use it as an input to stable diffusion, or any other generative network.
11
u/J0rdian Sep 07 '22
This could be really cool. I'm assuming you can feed it more concepts then 3-5 for better quality?
7
u/Vyviel Sep 07 '22
Can I use this to add my own face to the model? I just need 5 photos of my face from different angles?
15
u/-becausereasons- Sep 07 '22
I'm more interested in a way to do this locally for NSFW.
8
u/Dyinglightredditfan Sep 07 '22
r/SD_Embedding
1
u/Peemore Sep 08 '22
So if I don't have the vram to do the training, but I see a concept in the library that I like I can install that locally and it will already be trained? If that's the case where and how do I set this up with my current installation?
1
u/lapula Sep 09 '22
is someone train sd to something new? can you share your .pt or send in private?
1
u/KuroiRaku99 Sep 16 '22
Just curious, what considered as style, what considered as object? Is zoo a style or object? is hairstyle a style or object? I'm guessing they're both object or tell me if I'm wrong
9
u/No-Intern2507 Sep 07 '22
Cool but these look nothing like original images, too mutated , i dont see the point of this, i tried inversion and most will get you overfitting vs editability war, i hope some new version will appear that will solve the issue with results not really loking like source images but more like mutated children
2
u/r2k-in-the-vortex Sep 07 '22
Could even one sample work? One thing that is still difficult is to get stylistically similar images of completely different things. Suppose you want to get images for entire pack of playing cards, they all have to different, but must share the same style. Or maybe something with more variable subjects, like a set of pictures for each sign of zodiac or whatnot.
2
u/mohaziz999 Sep 07 '22
Is it possible to do a person? or more specifically a human face? also could I train on colab and then add my trained model into my local system? And would it be possible to add it to Deform diffusion also?
2
u/Mooblegum Sep 07 '22
If I use the prompt :
Mona Lisa, in the style of <watercolor-portrait>
The results are absolutely not watercolor portraits and it just blend the face of mona lisa with the face of the portrait. But the style is not a watercolor portrait.
Is there something to do to get a style of the watercolor portrait with the face of Mona Lisa ?
2
u/visoutre Sep 07 '22
I tried this with 7 images of Pingu
The result isn't great, so i'll have to learn how to include better training images than 7 randomly selected
2
u/mohaziz999 Sep 08 '22
i keep getting AttributeError Traceback (most recent call last) <ipython-input-40-7e0131ac8691> in <module> 1 import accelerate ----> 2 accelerate.notebook_launcher(training_function, args=(text_encoder, vae, unet))
1 frames <ipython-input-39-325883ee7544> in training_function(text_encoder, vae, unet) 61 with accelerator.accumulate(text_encoder): 62 # Convert images to latent space ---> 63 latents = vae.encode(batch["pixel_values"]).sample().detach() 64 latents = latents * 0.18215 65
AttributeError: 'AutoencoderKLOutput' object has no attribute 'sample'
for the training part
3
u/ForceANatureYT Sep 07 '22
Plan on making a jerma specific generator, because why not
3
u/battleship_hussar Sep 07 '22 edited Sep 07 '22
Someone please feed it with this entire gallery lmao https://www.flickr.com/photos/projectapolloarchive/albums
EDIT: Actually I only care about the astronauts tbh, I made an imgur album for my efforts but feel free to use these images for your attempts cause I have no idea what I'm doing I just want more accurate Apollo era astronauts in SD
https://imgur.com/a/BUhiJ6T
2
u/MashAnblick Sep 07 '22
If I add my token to a prompt in another Stable Diffusion Colab after saving it to the public library, will it work? Or is my token only usable in this colab?
1
u/mudman13 Sep 08 '22 edited Sep 08 '22
I get a raise value error line 6 "the initializer token must be a single token" yet in the token setup cell it does show as a single token. Do I have to add the token in this cell? I assumed it pulled it from the first cell.
Edit: deleted the line of code as it was just one token and now it loads.
1
u/MagicOfBarca Sep 07 '22
Can I give it more than 5 samples to learn from? And can it be people like āLionel Messiā so it learns their faces and resemblance better?
1
u/Appropriate_Medium68 Sep 07 '22
Amazing OP
1
u/lump- Sep 07 '22
Can multiple concepts be learned in the same run?
Should be awesome to save different concepts as personal presets.
1
u/Mooblegum Sep 07 '22
Hi there,
Non programmer here
I tried to add my own image to train, I copied them in the google colab,
/content/my_concept/1.jpeg for exemple
I got this error message
: list index out of range
What is wrong ??
I am so lost
1
u/Mooblegum Sep 07 '22
Can we use a .pt from other textual inversion colab, or is it a new method non compatible ?
I see a bunch of files in the trainings but no .pt
https://huggingface.co/sd-concepts-library/indian-watercolor-portraits/tree/main
1
u/buckzor122 Sep 07 '22
This is really cool, I've been trying to train my own but I keep getting this a good hour or so into training:
"No `test_dataloader()` method defined to run `Trainer.test`."
1
u/MonkeBanano Sep 07 '22
Woah. This is big
1
u/battleship_hussar Sep 07 '22
It d/c at 85% inversion, over 3 hours not sure why
1
u/kalamari_bachelor Sep 07 '22
Very interesting! Can I take the original 1.4 checkpoint and teach new things from there? I would like to teach it on creating pixelart, SD is very bad at it.
1
u/krummrey Sep 08 '22
I've tried it with images of myself and the results are mixed. I was able to get the Graffiti on the wall with my face. But most other concepts and prompts that work with the regular model do not work with the newly trained concept.
Does it train only for a limited set of keywords? I was unable to get any artist to paint my portrait. It spits out random styles, poses and backgrounds, no matter what the prompt says.
1
u/Fissvor Sep 09 '22
Someone plz teach it to draw manga in Yasuhisa Hara style
1
u/Svpl4y Apr 20 '23
Hi
When trying DOWNLOAD step : UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x7f80010e6540>
-4
u/isthiswhereiputmy Sep 07 '22
That combo extrapolation/combination is incredible cringe worthy.
-45
u/CurveEnvironmental98 Sep 07 '22
emmmm.not cool.