[0:00] hey everyone and welcome back to the [0:01] channel in this video I want to show you [0:03] how you can start generating your own AI [0:05] images using stable diffusion which runs [0:08] locally on your own machine so you can [0:10] run it at will however often you want [0:12] without any limitations and if you don't [0:14] know what stable diffusion is you may [0:15] have been living under a rock stable [0:18] diffusion is one of the currently most [0:19] popular text to image AI based models [0:22] that you can use to generate AI images [0:25] whether you call it AI art or not is a [0:27] whole another discussion maybe a topic [0:29] of another video that I'll be making but [0:31] you can generate some really really [0:32] amazing photo realistic or artistic or [0:36] you know just Creative Images for all [0:38] sorts of things using stable diffusion [0:40] I've been using it for a lot of my own [0:41] wallpapers that I've generated just you [0:43] know just because I wanted something [0:44] nice on my desktop that I couldn't just [0:46] get online as here's one for Japan you [0:49] can also generate you know images of [0:51] cats of cityscapes of people of you know [0:53] monsters cuz I like grimy and horror so [0:55] I've done a whole bunch of that sort of [0:57] stuff with stable diffusion the other [0:59] thing I I've used stable diffusion for a [1:01] lot as well as to generate some concept [1:02] images for a video game I've been trying [1:05] to create so there's a whole bunch of [1:06] images generated by stable defusion it [1:08] has a lot of really powerful features [1:10] you can you know use input images to [1:11] generate images that are like the images [1:13] that you feed into it it now supports [1:15] text to video as well as video to video [1:17] and a whole bunch of other Advanced [1:18] features but in this video I just want [1:19] to go over the absolute basics of how do [1:21] you get started setup install stable [1:23] diffusion and how do you start running [1:25] and generating your own images on your [1:26] own computer so I want to run through [1:27] all of that in this particular video [1:30] timestamps and everything so you can [1:31] jump to what you might find relevant or [1:33] interesting will be down in the video [1:34] description YouTube also adds the [1:36] chapter so you can just jump to wherever [1:37] you want to and any questions you might [1:39] have comments feedback leave that down [1:40] in the comment section I'm pretty [1:42] proactive reading everything and try to [1:44] answer as much as I can so just utilize [1:46] that as much as you want to now in order [1:48] to run stable diffusion you do need a [1:50] couple of things the first thing you [1:52] need to do is you need to download [1:54] python python is a programming language [1:56] and stable diffusion runs on python so [1:59] any machine that you can install python [2:01] on be that Windows Mac Linux you can run [2:03] stable diff Fusion on so if you jump [2:05] over to python.org downloads and I'll [2:08] drop all of the links down in the video [2:09] description as well as well as a little [2:11] you know step-by-step instruction of [2:12] what you need to do to get up and [2:14] running as well just jump to python.org [2:16] downloads and then just simply cck [2:18] download python 3.1 2.1 or whatever the [2:20] latest version of that might be and then [2:23] just save that out your local computer [2:24] and then all you have to do is run that [2:26] installer to make sure that you add [2:28] python to the path because you still [2:29] need to execute it from the command line [2:31] but again VI scripts and I'll show you [2:33] how to do that later it's not difficult [2:35] it just it sounds scary first just [2:37] install python onto your machine then [2:39] that is done the next thing you need to [2:41] do is you need to download a stable [2:43] diffusion model which is essentially the [2:46] AI built model that contains all of the [2:48] knowledge of how to generate the images [2:51] now there's a bit of misconception that [2:53] these models contain copies of images [2:55] that they found online which isn't [2:56] really the case it's more like imagine a [2:59] a robot looking at every single image [3:01] within a very big image database and [3:04] remembering what's the shape of a cat [3:05] what's the general shape of a human or [3:07] house or tree and so that when you ask [3:09] the AI to generate me a tree it just has [3:12] the knowledge of how generally to shape [3:14] up a tree based on all the images it [3:16] seen it's kind of like drawing from [3:18] memory now that is not to say that there [3:20] isn't you know legal issues and [3:22] copyright questions and a whole bunch of [3:23] things that people are still trying to [3:25] figure out a lot of controversy around [3:26] that and again might be the topic for [3:28] another video if you guys are interested [3:30] but you can get these stable diffusion [3:32] models for free online and the easiest [3:34] place to get them is just come to [3:35] stability AI which is the company that [3:37] makes and releases stable diffusion and [3:40] by the way stable diffusion is open [3:41] source so the source code for stable [3:43] diffusion is freely available online you [3:44] can look at it you can download it you [3:46] can modify it it's all free in that way [3:48] and so are the models that stability AI [3:50] releases so come to stability. a and [3:53] then you can come down and you can look [3:54] at the different models and all of these [3:56] AI models excel at something specific [3:59] the latest one is sdxl Turbo which is a [4:01] really fast version of the stable [4:04] diffusion model but it you know Works [4:05] slightly different to what you'll find [4:07] mostly online so the one I want to go [4:09] with for this video at least is stable [4:11] diffusion XL and you can see some of the [4:13] example images that have been generated [4:15] using this model and it's it's just [4:17] mind-blowing what you can do with this [4:18] so let's close this out and down here [4:21] now you can generate images online [4:22] without running anything on your [4:24] computer but you will have to pay for [4:25] that privilege on a Pro Plan for [4:27] stability AI we actually just wanted to [4:29] downloaded the model and run everything [4:30] locally on our machine so let's click on [4:32] download code and this will open up a [4:34] GitHub repository which is essentially a [4:36] a place where developers can place code [4:39] and you know technical stuff don't worry [4:41] too much about it let's just scrub all [4:43] the way down skip over all of the news [4:45] and all of the other bits and pieces [4:47] what you looking for are these links to [4:48] sdxl base 1.0 there's also a refiner [4:52] which is kind of like a second pass over [4:53] your image to improve some of the [4:55] details and hands and feet and enhance [4:57] the image we're not going to worry about [4:58] that at least not for this particular [5:00] video so simply click into this sdxl [5:02] base 1.0 and again don't worry I'll I'll [5:05] put all of the download links down below [5:06] the video and then you're going to come [5:08] to huggingface doco which is a site that [5:11] houses a lot of the stable diffusion and [5:13] AI text to image or text to video models [5:17] and information um and in here this is [5:19] the one for stability Ai and stabil [5:21] diffusion XL the base model 1.0 again [5:25] just ignore all of the technical stuff [5:26] but it is actually really interesting if [5:28] you want to know how these models work [5:29] again I can make a separate video on [5:30] that read through some of the text specs [5:32] it's actually really exciting I think on [5:34] how these models actually work or if [5:37] none of that is of interest you you just [5:38] want to generate some images just come [5:40] into files and versions up here at the [5:42] top come down a little bit and the one [5:44] you want to download is sdxl base 1.0 [5:47] vae which stands for variable Auto [5:49] encoder again just a part that improves [5:52] the image as it comes out but it's all [5:53] baked into this one model here and let [5:56] just click on this download file Link at [5:58] the base then let's download this file [6:01] now it's pretty massive some of these [6:02] models are you know many gigabytes this [6:04] one is 6 GB I'm going to let that [6:06] download in the background while we get [6:08] set up with the rest of the stuff now [6:10] we've installed python which is the [6:11] runtime that's going to run stable [6:13] diffusion and we are downloading the [6:14] model that stable diffusion will use to [6:17] generate our images we do need stable [6:19] diffusion itself however and the way to [6:21] get that simply come into Google and [6:23] search for stable diffusion UI and again [6:25] another GitHub code repository called [6:27] stable diffusion web UI and again links [6:29] down in the video description and this [6:31] is the actual code the actual executable [6:33] code that runs stable diffusion with a [6:35] nice little webbased interface that you [6:37] can then enter your text in and run your [6:39] prompts and you know look at your images [6:40] and everything like that so up here if [6:42] you have git installed if you know what [6:44] that means you can just download the [6:46] GitHub repo you can just clone it to [6:47] your local machine if you don't know [6:49] what git is you don't really care up [6:51] here where it says code just click on [6:52] this little drop down here and we're [6:54] just going to say download zip so we can [6:56] bypass all of the deie things and just [6:58] download the whole thing thing it's [6:59] going to download stable diffusion webui [7:01] Master zip to our local machine so let's [7:03] do that back in the folder where you [7:06] downloaded everything so there's our [7:07] stable diffusion webui Master zip file [7:10] let's unpack all of that here why not [7:13] into stable diffusion web UI master so [7:16] let's jump into this particular folder [7:19] okay a sub folder doesn't really matter [7:20] too much and in here is stable diffusion [7:24] everything that you need to run it as [7:26] well as add the models that you want to [7:27] use to generate your images or tools for [7:30] modifying images or trending your own [7:32] models everything sits in here and again [7:34] if you're a Dev or an engineer there's [7:36] some fascinating stuff in here worth [7:37] looking through and understanding how it [7:39] all hangs together if you're not the [7:41] easiest thing you need to do is you need [7:42] to execute web user UI batch file if [7:44] you're on Windows or web user UI shell [7:47] file if you're on Mac or Linux so I'm on [7:50] Windows I'm just going to double click [7:51] this web UI user batch file and that is [7:55] going to now kick off and execute Python [7:58] and install all of the dependency all of [8:00] the packages and all the other bits and [8:01] pieces that I need to run stable [8:03] diffusion locally now this might take a [8:06] while because it's going to download [8:07] quite a lot of data run through a lot of [8:09] different tools and get everything set [8:11] up and then it's going to launch the web [8:13] UI that we're getting which will then [8:15] allow us to enter our prompts and run [8:16] images as well as use our different [8:18] models to generate the images so I'm [8:20] going to let this run you may see me [8:22] just hop out a little bit while this [8:23] runs because again this this can take a [8:25] little bit so I'm just going to Tinker [8:27] while this [8:28] runs okay here we are and don't worry [8:30] this only happens the very first time [8:32] you launch stable diffusion from here on [8:34] it usually starts up within 10 to 20 [8:36] seconds so it's just the first time that [8:37] this is really slow so now stable [8:39] diffusion has installed all the [8:40] dependency and it has launched the webui [8:42] which is where you can do everything [8:44] with stable diffusion that you may want [8:46] to do now the first thing you need to do [8:47] if you want to generate any images with [8:49] stable diffusion is you need to select a [8:50] stable diffusion checkpoint by default [8:53] if you click on this drop down here [8:54] there's V 1.5 pruned EMA only safe [8:57] tensil it's like a dummy model but it's [8:59] enough to test whether this whole thing [9:01] is even working so let's simply in this [9:04] prompt field here right uh cute sleeping [9:08] cat [9:10] Outdoors quaint porch evening [9:15] light and then let's hit generate over [9:18] on the right hand side and see what [9:21] happens and show enough it looks like a [9:24] cat sleeping outside on the porch so [9:26] this seems to be working however the [9:29] default model isn't terribly great so [9:31] let's come back to our download folder [9:33] and yes the sdxl base 1.0 safe tenses [9:37] file has downloaded and it's 6.7 GB so [9:40] that took a little bit so let's cut this [9:42] out and we need to move this into the [9:43] stable diffusion webui Master folder and [9:47] it goes under models and in here you'll [9:49] find stable diffusion so double click [9:51] into that and paste or move your model [9:54] into that let's come back to the webui [9:57] hit Refresh on those checkpoints [9:59] and now in this drop down you should [10:00] have sdxl Base 1.0.9 VA let's click on [10:04] this and load it up it's it's going to [10:06] take a little while while this model is [10:07] being loaded and if you pull up the [10:09] console where you've launched the web [10:11] you can see what's happening down here [10:13] it's now loaded this model let's come [10:16] back to stable diffusion repap and hit [10:17] generate again to regenerate that image [10:19] using a different [10:22] model and yeah that is still a cat on [10:26] the porch outside at evening light now [10:29] with stable diffusion XL you should [10:32] really be changing your resolution so [10:33] right now the resolution of our output [10:35] is set to 512 x 512 which used to be the [10:38] resolution at which some of the earlier [10:39] models for stable diffusion were trained [10:41] so they trained on images at this [10:43] resolution which meant the outputs were [10:44] best using that resolution stable [10:46] diffusion XL however and some of the new [10:48] models use higher resolution so I highly [10:50] recommend change your width to 768 by [10:54] 768 obviously that's going to take [10:56] longer to generate depending on your [10:57] graphics card and stable diffusion does [10:59] require a fairly decent graphics card I [11:00] would recommend at least 4 GB of vram [11:03] the Nvidia RTX cards work really really [11:06] well for this so let's hit generate and [11:08] regenerate that [11:11] image and yeah it's still a cat on a [11:13] port outside don't like that it's kind [11:15] of cartoony looking so let's refine our [11:17] prompt just a little bit let's add photo [11:19] and realistic into our prompt and let's [11:22] regenerate our [11:24] image and that looks pretty cool you can [11:26] click on this image to zoom in and you [11:28] can see the iess and the fact that it's [11:30] generated and the fact that this cat [11:32] seems to be missing a leg this is just [11:34] some of those things that you'll have to [11:36] encounter and you'll have to fix them [11:37] manually either with in painting or with [11:39] some other trickery to kind of get them [11:41] to look just right but let's just come [11:43] back let's just maybe just generate one [11:44] more so you can see that every single [11:45] time I get a new image generated that [11:48] matches my prompt and there is a lot to [11:51] how you do the prompting both the [11:52] positive as the negative prompt some of [11:54] these parameters they all influence that [11:56] final image but that's beyond the scope [11:58] of this video [11:59] from this point just play around and [12:01] just have some fun and see what you can [12:03] get there's some amazing stuff you can [12:04] do and I'll cover all of these [12:06] parameters and how to prompt properly as [12:07] well as some more advanced prompts and [12:09] other stuff with stable diffusion in [12:10] later videos and again if you have [12:11] questions you want to see something [12:13] specific or you're just getting stuck [12:14] somewhere just drop me those comments [12:16] down below and I'll get back to you I'm [12:18] just I'm really excited I really like [12:19] stab diffusion and some of these other [12:21] cool tools that are coming out [12:22] everywhere with AI everything um even [12:25] though there are you know questions [12:27] around copyright impact of eye on the [12:29] workforce and how everything is Shifting [12:32] know there's a lot to unpack don't want [12:34] to get too much into it but it is a [12:35] really cool tool to play with and I've [12:37] used it for tons of my own personal [12:39] stuff and just have fun with and play [12:41] around but with that I'm going to wrap [12:42] up this video If you enjoyed it please [12:44] hit that like button subscribe to this [12:45] channel if you want to support me it [12:47] really helps me out and I greatly [12:48] appreciate it and with that thank you [12:50] very much for watching and until next [12:51] time I will see you [12:55] later