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