How to use Stable Diffusion. Automatic1111 Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Hello friends in this video I'm going to teach you how to use stable diffusion now if you need to install stable diffusion you need to check my previous video up here where I go through every step of the installation what extensions to install and how to install your very first model all in preparation for this guide here so let's get started and I'm going to show you how to create some amazing generative AI art in my opinion stable Fusion is the king of generative AI art let's get started by the way do you know what happens when doctors get frustrated they lose their patience of course now this is the first thing you will see after launching stable fusion and if this looks confusing don't worry I'm using dark mode in my browser so I'm having a dark background here if yours is white don't worry that is just your browser settings and can be changed the first thing you will see up here is the stable diffusion checkpoint that is your model and if you follow my previous video you will probably have something installed here or multiples you can choose which model to use by selecting the drop down here now these models are what is referred as the model numbers of stable diffusion you might have a 1.5 a 2.0 2.1 Etc this will be the stable diffusion model the user interface that we're using here automatically 11 11 is not the stable diffusion version don't confuse the two now in your version you will probably not have these three here the vae the Laura and the hyper Network for this tutorial you will not need them however if you want to install them as I get this question a lot you're going to need to go into settings you're going to go into user interface here and then scroll down info here quick settings list here you can select what you will see in the top bar there are lots of settings to choose from and I have the VA the Laura and the hyper network but we're not going to cover those in this guide as uh you will not need them for now you're only going to need the checkpoint here but remember if you downloading luras or Vees you can add them up here and just select them easily here now the first tab here text to image that will be your main tool of generating images in stable diffusion you have two boxes one positive prompt here and one negative prompt box here and the first prompt here this is where you're going to select what you want so let's say we have puppy dog and let's say you don't want a cat this would be the most simplistic way of generating an image now this won't be a particularly great image I'm just just going to press generate here to show you and I mean it's a puppy dog it's okay nothing special where stable Fusion starts to shine is first having a good checkpoint I'm currently using the deliberate model so that is a custom checkpoint then you can find a site like civit AI or similar again follow my previous guide for how to install those now we're going to add some Styles and these Styles can be found in the video description and they are made by me and the people of my community in Discord Community we're going to choose the default negative and the digital oil painting if you want to see how these interact with the prompt here you can press this little Buton apply selected styles to current prompt and you will see the text here now I'm just going to remove that because I don't want that to mess it up if you have them selected here on the right side they are still applied to the image without you seeing them in the prompt so the easiest way is to have them here and this type what you want puppy dog and now if we generate something we will have a large negative prompt here to help with our image and our puppy dog here is a little better than our first image now there are a lot of settings to use in stable Fusion now while this image is very good for not having changed much at all you're going to want to learn how to change some of the more advanced settings so let's look at what's available here so the first settings we're going to have a look at here are the sampling method here and the sampling steps the sampling method are a lot of tools that you can choose from or a lot of samplers that takes your prompt and your model and turns that into an image in a set amount of steps the steps you can see on the right side here let me show you a couple of examples here that I've put together so here on the top let me zoom in a little bit for you here on the top are the steps count so an image goes through steps like frames of a video in this example to the right we have 15 steps to a complete image on the first line here you can see the first step is just a bunch of noise so the sampler is trying to get this noise and turn that into an image and in each step or each iteration or frame of the image it gets a little better so every iteration every step forward the image gets a little better now there's a diminishing returns to this so putting it at 100 steps or a th000 steps whatever is not going to make it better each step but we get to how many steps you need in a little bit this is just to show you what happens as the sampler goes through these steps to create an image now this is just an example with two Samplers we're going to look at a few more in a bit but just remember that stable diffusion goes from noise and one step at a time tries to create your image now there are a lot of Samplers and looking at this list you might think oh what am I going to choose and I will tell you this but first let me show you a a quick comparison of what's going on so we have here are on the left axis we have all the Samplers and on the top axis we have steps so it's a step of 5 10 15 20 etc etc up to 50 steps and there are two sets of Samplers like two main sets of one something called convergent and one are not so if you're looking at the top one here the oiler a you can see that the starting image is far from the ending image it's a different dog so that means that this sampler is not convergent it converges into something else each step it can drastically change now the oiler a is a very popular sampler because it produces as you can see good images in low step counts and is particularly fast while some of the other Samplers here you can see that the first image is more similar to the last image here that means they're converging ing on the same path towards the same image now does that make any difference it makes a difference if you're trying to recreate or have consistency in your images if you're just trying to create good images and don't really care about consistency well no then it doesn't matter but it's good for you to know what's going on under the hood now I've been using Oiler a for a very long time because it is fast but what I would recommend you to use now base is something called the DPM Plus+ 2m Caris which is a newer model and it is converging towards the same image and it's also pretty fast as you can see here this is 15 Steps at around 15 Steps it starts producing good images five steps 10 steps not great but here at 15 it starts producing great images so if you're just looking for a quick answer use DPM Plus+ 2 m Caris at between 15 to 25 steps now as you can see there are Samplers like DD im here 10 steps produce a good result and as well the first one that that we looked at the oiler a can produce good images even at lower step counts so play around with them but I'd recommend going for Oiler a or the DPM Plus+ 2m Caris now you might see that some of these are getting quite weird results like the artifacts and the coloring here here in in the dog and that's because some Samplers are not great at firstly low step counts and secondly High CFG scales and you might be scratching your head what is a CFG scale now this is advanced stuff SE well let me quickly show you there's a slider down here called the CFG scale and that's a slider here that goes from one to 30 and that is how much stable Fusion will listen to your prom prompt so if you set this High it will try to force your prompt as much as possible but it also might break your image and if you set this low it'll be more creative it might not it might it'll see your prompt and be like yeah yeah whatever I'll do something maybe it's a dog but it might not be a puppy maybe it's a you know whatever it'll do their thing but get more consistent of an image and here's a quick test to show you the CFG scale and you can see it's very clear on the oiler a and the LMS sampler here on the oiler a you can see the first images well it's still a dog but it's uh completely different to what we tried to achieve and in the LMS sampler the first image is kind of weird and then it starts breaking down as CFG scale goes up so I would recommend setting CFG at around 3 to 7 depending on what model are you using if you just want to know set and forget it five six 7 so following that advice we're going to change our sampling method to DPM Plus+ to M Caris we said sampling steps between 15 and 25 we're going to set it to 20 for now and we're going to set a CFG scale to we set between 5 and 7 so let's set it at five for now now the width and height here that's basically just the size of your image for most models 512x 512 is the default size there are some models trained on 768 x 768 but try to use your first PA as close to this size as possible because that will generate the most consistent results now a quick example if we make this 1024 by 512 we will get a wide image as you can see with our dog here if you followed my previous guide and installing it you will also have the aspect ratio calculator down here so you can quickly set different aspect ratios and that will follow here if you change the height here press 3x2 will change the width as well we're resetting this to 512 by 512 the batch count and the batch size will be how many images and how many batches you are creating I usually use the batch count for more images because that doesn't affect your vram now the batch size will have more images in a batch so let's say I create four images in a batch count here that will mean I create four batches with one image each and if I create one batch with four Images your GPU will have time to ramp up and get up to speed so it will be faster but at the cost of higher vram as stable Fusion is most of the time very GPU heavy that's why I used the batch count higher but it's a matter of preference and you're dependent on your Hardware if you're not sure just change the batch count if you want more images now the restore faces here that has been a setting that was previously used a lot in stable diffusion I don't recommend using this anymore it will smooth out people's faces I much prefer that you will in paint the faces and have a very long and quite extensive guide on imp painting that you can see up in the top right corner now if you want to delve deep into that here's a quick word from this video sponsor run the fusion but hold on don't skip yet this might actually be useful to you and for letting me show you this I'm going to provide you with a dad joke at the end run diffusion promises stable diff Fusion in 90 seconds and what it actually is it's automatic 1111 in the cloud and starting from 50 cents an hour now the good part about cloud-based Solutions is you don't need a GPU of your own you can use it on any old laptop or computer that you got hanging around get started for as little as $5 and then pay 50 cents an hour in an hour on the smallest server you can actually do up to a th000 images so it's very cheap unless you're a power user of stable fusion and really need your own Hardware it's also very easy to get started with and set up and it's a basically a clone of the same same install that we did and are following in this guide here now if you want to use your custom models embeddings and luras or do dream Booth training you can join the something called creators Club it will also give you a lot of storage to use and they have an integrated file browser we can see all the files and save the models that you are using Create animations in the Forum as it is preloaded on all the servers they manage the hardware and install everything for you you just sit back and start using stabil Fusion both automatic 1111 and invoke AI are available as of today you also have a great community in Discord to help you get started and help you if you have any issues I promise you a dad joke so when does it rain money when there is change in the weather now the highis fix there there are I would say two recommended workflows into getting good quality images highis fix is one of them because if you're doing 512 by 512 images you will get okay images but they're low resolution and not very detailed one way to fix that is to press this highr fix button that means it will first generate one pass of an image in your set resolution which is here 512 by 512 and then it will generate Again by a factor of this upscale so now we're upscaling by two so it says here resize from 512 by 512 to 1024x 1024 so let's quickly try that so now it generates one image a smaller one and from that image generates a bigger one adding more detail you will not see the first and the second you will see the end result here but this is much more detail than the low resolution one the second workflow of this is that as this takes longer to generate than just a 512 x 512 image what I usually do is uh let's say I do four Images here and when I've found a composition that I like because because everything is random right if I use hus fix I'm getting a lot of good images but they're going to take a lot of my time so first I'm doing a low resolution pass with a lot of images and let's say okay I like this image and then instead of using the highrisk fix I take this fast generate image and I send this to image to image and here I can set 1024 by 1024 instead and this will do the exact same thing basically as using highrisk fix but it will give me more control and and be faster in the long run if I want to find a composition that I like might be a little tricky here in in the beginning but you you'll get a hang of it we'll dive deeper into image image in a bit now heading back into our text image here with our puppy dog we are going to keep looking in the settings here and here's something that's called a seed and this minus one means it will be random and what this does is it gives us a random noise to start the image with and then it Well turns into this so let's say I want to recreate this then I can push the little green button here which will save that seed now if I press the generate button here and generate again with exactly the same settings and exactly the same seed I will get exactly the same image so this is a way that you can adapt an image so that's you can play with the values and see how it change es your image because if you play with the values and have a different seed each time you might not know what the differen are because your seed is random anyway but if you want a new image each time you will have to have this at minus one or press the little dice here which will randomize your seed now further down here you have control net which we installed in the previous video in-depth guides on control net which uh you can find in well a control net playlist in in my on Myan Channel but basically what this does is is you drop an image here and then you can enable this and then you can recreate something from this image so let's say I set this to depth here depth here and now if I generate puppy dog here let's say I'm going to generate four Images we have a random seed so we should get four different images right well with control net you're actually reading from this image and we will get four similar images of this post now we might get different colors different dogs but we will get likenesses of this image depending on what pre-processor and model you use now I'm not going to delve into this in detail as I have more comprehensive guides on that so find them on my channel but as you can see here we have four dogs that are similar in composition so this was a run through of text to image and if you followed every step here you're going to be well on your way to create a good image or at least an image that you can improve on now let's move into the image to image tab if we drop our image here or if you go into text image and you have an image selected and press send to image you will get that let's take this one for example here sending that to image to image that will send that in with the prompt that you used which was puppy dog now bear in mind that you if you didn't apply the Styles they will not be sent so you're going to have to go in here again press default negative and dig your oil painting you can find these in the video description we're going to change this back into DPM Plus+ 2m caras and we're having again 20 steps now image to image means that you will take from this image and create a new image and most of the time you will use this to create from a low resolution image to a high resolution image you can also use it just to keep the colors or composition of an image it will not keep the composition as well as control net but it will keep the colors of an image let me quickly show you here let's use the same resolution for now let's use batch count 4 and just lower this we're going to check this in a bit I'm just going to show you what's going on here so now it's generating four new images off of this old one and they will not differ much as you can see here they're fairly similar but it takes from the color of this one here and applies it to the new image now what we want to do is we want to increase this so let's put the double size in 1024 by 1024 and we just use one image for now and then in image to image you have something called The Den noing strength and that's a slider from 0o to one which is basically you could think of it as 0% to 100% it's not exactly that but it's good thinking like that so let's say you set this at zero this will not change your image at all and as you can see in the example that's exactly what's happening you're having basically the same image in the left and the right so this is not something that we will be using let's set this with d noising one so if we generate this at One D noising our left image will be completely changed and will not retain basically anything from the left image making our input practically useless now we just have as you can see it's not fully rendered yet but we have a weird looking dog and another dog here with some sort of uh glasses so our result here is completely different and this again isn't something that we're looking for in image to image then we can just view text to image now what we want to do is keep some of this and I would recommend having setting between 0.4 and well up to maybe 75 if we just starting out I'm using usually 6 if I want to keep this but add detail and expect some changes let me show you I now rendering two new images in 6D noising at 1024x 1024 and as you can see we are retaining a lot from the left side however we are introducing some changes to the image but as these are higher resolution images we are getting more detail so this is double size and this is basically what happens in high res fixed the thing we looked at here but we're just doing it manually to have more control on the input composition now if you feel that these changes are too much compared to your input on the left here you don't want to lower the D noising to about4 this setting will still introduce enough noise that the new image will have more detail than the left but it will not introduce as much of a difference so let's run this again at 04 at 1024 * 1024 so now we have dog on the right here that is eily similar to the one on the left however it will be more detailed so this is a 1024x 1024 image so at the Double the resolution well depending on how you count you will have a higher resolution image with less changes so whenever you work with image to image remember here the den noising strength that's the most important part the higher this value the more the image will change and again if you just starting out try between 4 and 6 and if you're looking for more changes go higher now let's say you have an image that you're fairly happy with but you have something that doesn't feel right you you might want to change this thing on the color here so what you can do is you can take this and just press the little button here send to in paints again I have a very deta tutorial on in painting so we're just going to go through it very quickly here but here you can change parts of the image by drawing so let's say you want to generate this little piece here we're going to change it into heart let's make glowing heart instead I'm going to keep this in paint mask want to mask content original because we're keep what it says here keep whatever was the originally so was behind there if you want to introduce something new you want to change that to latent noise and we change it in the in paint area to only masked which will give us a higher resolution then we'll just take this part here it will zoom in we use the whole picture it will render in the same resolution give this part you know less detail or well actually the same detail but if you use only mask we'll get more details in this image we uping the D noising so we can get some changes into this and we are generating two images and now we will see this will zoom in here here and giving us more detail actually on this part than anywhere else in the image so this is a good way to one fix images and two improve on images and give them more detail where needed and as you can see here if you remove first our paint on the left here you can see the comparison that the right one here is sharper and more detailed than the left we can also see see that if we check in detail here now if you feel that you're done with your image you can send this to something called extras down here and this is where you upscale an image so here you have a scale by or a scale two so you can either scale to a specific size or easier just scale by so let's say we want this twice the size from 1024 which will be 248 by 248 then you can select an upscaler now on the upscaler one setting here you have a multitude of options now I have a couple that you don't have which is is the four times Ultra sharp and the four times n mkd CX2 200k now I used NM KD CX2 200k a lot so I'm going to try and Link that in a video description so I recommend that you use that if you can if you don't want that and just want something out of the box you can try our ESR gen or our ESR gen for anime so basically we're going to use the regular one here now and we'll resizing that up two times now again this will not give you more detail in the image you're going to use highis fix or image to image for that there is a way to upscale to high resolution super high resolution images with upscaling and that that is with tile upscales I have a separate video on that so you can check that in the top right corner now that will get you to rate like 8K images on a fairly simple GPU now here's our 248x 248 image and it's fairly okay but for a first run without changing the settings at all it's it's fairly okay I would say you could try that for example with anime one because this is um little bit of a painterly image so we can see how that changes and here we have a more smooth out result so it's all depending on what you're looking for now the fourth tab here PNG info here you can take a previously generated image and drag that in and if you drop that you will get all the settings that you used for this image so here is depositor prompt you have puppy dog and then our style prompt you have the negative prompt and all the settings so you can just press this button here text to image send to text to image or send to image image so say we send this to text to image that will take all the settings that you used for that image and send that into text to image it'll even save the seed for you so if we just press generate now you will have that exact image again so that's a very powerful tool after this guy you should be well on your way to create your very first generative AI image and get some good results in the process if you want to learn more check some of my other videos I recommend some of the controller videos or this one here keep learning and I'll see you in the next video have a good one see you
Info
Channel: Sebastian Kamph
Views: 202,519
Rating: undefined out of 5
Keywords:
Id: nJlHJZo66UA
Channel Id: undefined
Length: 27min 9sec (1629 seconds)
Published: Thu Jun 01 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.