How to Install Stable Diffusion SDXL 1.0 with InvokeAI 3.0 on M1 Macbook Pro

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
today I'm going to be talking about the latest version of stable diffusion for creating images I am going to show you how to install and set up the latest version on an M1 MacBook Pro I have a 16 inch M1 MacBook Pro and I use invoke ai's version of a web UI for it invoke AI bundles stable diffusion within a web UI that you can basically use on your machine and it is awesome there are other ones automatic 1111 was one that comes to mind that's really comfortable there's another one called comfy UI so there's various user interfaces now or web-based user interfaces for working with stable diffusion and generating images with it invoke AI just released version three the whole thing has been sort of re-architected so that you can use it with all kinds of models and various other tools around the ecosystem of stable diffusion and once I have it set up I'll show you how to essentially get rolling with it this isn't meant to be a tutorial on stable diffusion but it's actually just to get you up and running and if you have an M1 or an M2 MacBook Pro with a GPU then it's going to be worth your while to install it and give it a shot in subsequent videos I might compare what it can produce with mid-journey mid journey is pretty awesome it's essentially run off of Discord so it's a completely different setup I do like to use it and this image behind me was generated with it and I'll show you guys how to do that in a subsequent video so we have a MacBook Pro with the Apple M1 Max chip that's a decent amount for doing work with stable diffusion or running stable diffusion the more the merrier in terms of RAM on the invoke AI Channel they just announced a couple of days ago that they released version 3.0.1 of invoke AI which is basically a fixed version and kind of cleaned it up a little bit they released 3.0 like a day or two before that there was a bug with setting this up on the Mac initially and you sort of needed to know how to go in and mess with the code to get it working but they have now since fixed that and you can run stable diffusion sdxl now on the Mac without any issues so let's get started their GitHub page for this release is right here I'm going to go there and we are going to go down a little bit and look for their automatic installer which is this file right here this file right here we're going to download that and then my terminal here and what I'm going to do is I'm going to make a directory in my home directory and let's just call this in Vogue AI 3.0.1 install so this is kind of like a staging directory I'm setting up to put it in this this downloaded installer and kind of do all the installation from here with invoke AI basically you can install over top of a previous version and migrate I've done that once before and I ran into some problems with some of my models so what I've been doing lately is just kind of installing isolated versions and that way I can go back and look at previous versions or run previous versions if I need to and sometimes I actually do prefer running the previous setup of my invoke for using it with stable diffusion version 1.5 but the intention of this video is to get you up and running with the newest version of stable diffusion which is sdxl which is trained on way more images lets you do higher resolution images straight out of the box and is apparently more capable than 1.5 although we'll see as the community builds new models and Laura's and sort of fine-tunes it I think things are going to get even better so I created this directory called invoke ai-3.0.1 Dash install I'm going to go in there and I'm going to move the file that I downloaded from the downloads directory of invoke AI installer 3.0.1 it's V 3.0.1.zip I have as you can see several different versions that I've installed in the past but this is the newest one so I'm just going to move that here using this command okay this just basically says copy this file to the directory that I'm in hit return and there it is I'm going to unzip it and there's now this directory inside of here this one here invoke AI installer and in there we have a bunch of files but the one that we want on the Mac is this install.sh that's the script that we're going to run to do the installation now before I actually start that let's go to the installation instructions here you'll see they have to learn more about it please see our documentations page I'm going to click that and over here you'll see in the sidebar here there is a installation guide we'll go there there's three different types of installations there's an automated installer version you can install manually and you can install within a Docker we are going to do the automated installer which is basically the easiest way to to do it and the way that I think most of you will probably want to do it so it's important to know what the requirements are before we get started and python is obviously needed for this maybe not so obvious but you do need python for this it says you need memory and disk you're going to need about 12 gigabytes of RAM minimum and 18 gigabytes of disk space I'd say you'd be better off if you had more of all of those things but that's the minimum let's go to the automated installer so it says to just kind of check what version of python you have I'm going to do that right now so if I type Python and I've got Python 3 minus minus version you'll see that I have python 3.10.9 it says right here we recommend version 3.10.9 of python which has been extensively tested with invoke AI so it makes sense to want to do that and to use the version that they recommend I'm not going to give you the directions for installing python you can Google that but essentially it's fairly straightforward they have three different versions of instructions here we're going to click on the Mac version and now we're going to go ahead and run the install script here it says install.bat this is on a Windows machine we're going to do it on a Mac so for us it is the install.sh that we want to run so I'm just going to go ahead and run install.sh it's initializing the installer okay so here it says the directory already exists are you sure you want to reinstall in this location if you've not installed evoke AI before then you're not going to have this I've installed it and I've got multiple versions as I've mentioned so I'm going to say no here and then it's going to ask and it says please select the destination directory for the installation so I'm actually going to give it the invoke AI 3.0.1 Dash install that we just created and this will keep it isolated from my other installations of invoke AI I'm going to hit return on that it says this directory already exists are you sure you want to reinstall or install in this location we haven't installed it in this location all we have here is actually the automatic installation script that we're running so it's fine to install it here so I'm going to say yes to this and off it goes so now it is setting up some stuff that it needs and you'll be presented with this installation screen that's about to pop up okay so here is the installation screen for the automatic installer it says that if you have a hugging face account you can optionally add a hugging face token where it will allow you to automatically download models and Laura's and various things that you can use with stable diffusion I do have a hugging face account hugging phase Dot Co and I'm going to go to my profile here we're going to go to settings and under settings I have access token now you don't necessarily need to do this I do recommend though going ahead and setting up a hugging face account because if you're going to be doing anything with machine learning or with tools like stable diffusion and stable diffusion sdxl it's nice to have an account and to be able to download stuff and you know use their API but initially you know it's useful for this installation to get yourself a token to create a token so I've got one here already created that I call invoke AI model downloads I'm going to go ahead and just click this button right here to copy that terminal where I'm doing the install I'm going to delete what they have here and I'm going to use the key combination command V on the Mac paste it in so this is basically representing the pasted in token that we just copied from hugging face again go ahead and create yourself an account and then go into your profile and settings and create a key in there and now what we're going to do is going to go through these options with respect to the install so GPU management free GPU memory after each generation enable Transformer support or Force the CPU to be used on GPU systems I'm just going to leave that as the default if you have not a lot of GPU memory you may want to go ahead and select free GPU memory after each generation and if you don't have a GPU it's saying you can force a CPU to be used in this case the Mac that I have does have a GPU so I'm going to go ahead and leave it as the default here for enable Transformer support and then for floating Point Precision you can leave it as is on auto or you can go ahead if you're on a Mac and select float32 now again this is an M1 Mac you could you could also do this on an M2 I'm not sure if it'll work on the older generations of the Mac now over here where it says size of RAM used for fast model switching so I have found when I've run invoke 3.0 that it can take a while to switch between models I originally set this up as to use eight gigs you can see here that it's by default set to six what I'm going to do is I'm going to bump mine up a little bit here I'm going pump mine up to 16 gigabytes I do have 32 gigabytes of RAM on the system so I'm going to go ahead and bump this up to 16 gigabytes I think that the sdxl model by itself is pretty big it's like more than 10 gigabytes and with scxl you actually do need to use a refiner model or you have the option of using a refiner model with it which is recommended for making your images just a little bit better as a kind of a second step to generating images which I'll show you a little bit later here so that's going to require memory and so you know I think it's worth increasing this a little bit now it says here output directory for images I will leave that as the default and then folder to recursively scan for new checkpoints control Nets loras and TI models you don't really yet need to know if you're a beginner what all of these things are you will however shortly need to if you really want to get deeply into using Sable diffusion but I'm going to go ahead and leave that because we're doing a fresh install and we're not importing anything from anywhere so locally so I'm going to leave that and then go ahead and accept this creative amount responsible AI license okay and go down to next hit return so and then we get taken to this screen which allows us to select models that we want to use or to initially install with this install that we're doing I'm going to go ahead and leave the defaults we've got the sdxl version one vae fix you need that we've got stable diffusion 2.1 and this in painting model which I'm not going to get into but you can go ahead and leave that as well and stable diffusion version 1.5 and I'm going to go ahead and actually select and you should as well by hitting x on it stable diffusion x l base 1.0 and stable diffusion XL refiner 1.0 you're going to need to select these if you want to use the latest version of stable diffusion and then I'm going to go down here to apply changes and exit and hit return and We're Off to the Races it is now going to go ahead and install stable diffusion and invoke Ai and all the models that you selected so I'm just going to let that run it takes a while it's a lot of files so give it enough time to run and you can go ahead and stay and kind of watch it to see what's going on in case you get any errors and we'll continue when it's finished installing I got these weird warnings um they look benign to me so I'm gonna go ahead and ignore them okay so let's see what's happening we're still in the install directory so I'm going to go back one level and we're not going to need the installer or the installer zip file anymore those were what we used to actually do the install I'm going to leave them there for now but this is your stable diffusion installation and now to start using stable diffusion locally on your machine using the invoke AI web-based user interface you type dot slash invoke dot sh and hit return it's going to ask you what you want to do here there's a bunch of different options but you just want to do number one generate images using the browser-based interface and it's starting it up on Port 1991 in my case because I've already got Port 9090 in use and I already have another version of invoke currently running on that port and it was nice to see that it noticed that when I tried to start this version of invoke AI 3.0 and it knew that I had 99 use so it started it up on localhost 1991. so in your case you would type localhost colon 9090 I'm going to go ahead and do 9091 and there we are there it is in all its Glory your invoke AI 3.0.1 interface I am super excited to try this out because this is actually the version with the fix and I hadn't tried this one out yet I did try 3.0 and I had to fix it myself I did a bunch of edits to python files and code to get it working and hard-coded a bunch of things and I don't know if I broke anything it was working for me but I don't know if it was working ideally so now that they've fixed that problem on the Mac I'm super excited to give this a try so for those of you who are not familiar with how to use stable diffusion this could be a little bit intimidating I did mention at the beginning of this video that I wasn't going into a huge tutorial but suffice to say that you can do a bunch of really kind of cool things so the first thing we're going to do is down here under General where it has the model we're going to go ahead and we're going to select stable diffusion XL base one o okay and when I did that I don't know if you noticed but over here we've got a few different windows that came up so previous versions of stable diffusion allowed you to put a positive prompt and a negative prompt so the positive prompt is text that describes what you want in your image and a negative prompt is text that you would put in there to describe what you do not want in your image so now they've added a positive style prompt and a negative style prompt which allows you to put styling information into what you want and what you don't want but I'm going to keep it fairly simple right now for now I'm just going to give it a positive prompt and we're going to say hyper realistic photo of a fluffy Havanese dog I'm particular to Havanese dogs because I have two of them and they're just fantastic so we'll just give it that I'm not gonna touch the style I'm not going to touch the negative prompts or anything like that now down here you have some settings that are important so we're just going to generate one image we're going to go ahead and let it do 50 steps and we're gonna leave this thing called CFG scale at the default of 7.5 so what this actually CFG scale thing is is a number that specifies a strength that stable diffusion will apply to staying true to your prompt so the higher this number is the more it's going to try and stay absolutely true to the prompt the lower it is it'll give itself more creative license so it might not fully Follow The Prompt this is a tricky thing to get right and you need to really kind of experiment with it generally speaking the more steps you put in here the higher the quality of the image will be but that's not necessarily always true 50 is a good starting point and you can always go up or down from there and see what you get now we did already set the model to this one here the stable diffusion XL base 1.0 I'm going to go ahead and change the scheduler I like to use this one here called klms or LMS Keras changing these schedulers will also affect how the photo will look for the vae we're going to go ahead and choose sdxl10vae fix okay and we're going to leave our floating Point Precision at fp32 you don't need to know what this is right away but and again this not being a full tutorial on stable diffusion I'm not going to get too deeply into it but you can go ahead and Google these things and learn more okay now stable diffusion can do images the original version would do like 512 by 512 images that's what it was trained on but the new version of stable diffusion sdxl can do 1024 by 1024 higher resolution images you can also go ahead and kind of mess with the aspect ratios and it changes it for you but I'm going to go ahead and leave it on 1024 by 1024 and then we are going to open up this refiner section here and this is where we have something relatively new with a new version of stable diffusion previous versions did not have this sort of like dedicated refiner we're going to go and tell to use the refiner and then we're going to select the stable diffusion XL refiner one zero okay and it's got it at 20 steps with a CFG scale of 7.5 I'm just going to go ahead and leave that okay and then here has a scheduler I'm going to make the scheduler match the one I chose earlier so we'll do LMS Keras again here and then aesthetic score I really don't yet know what these things mean because this is relatively new but refiner start is kind of telling the stable diffusion application to start doing the refinement at a certain point in the in the process of generating the image so the further down you go with this the more you're letting the base model I should say the further up you go with this so I'm going to leave it at 0.8 the more you're letting the base model this one up here Define the image or create the image and then you're saying once you're about eighty percent in refine it with the refiner so we're going to leave that I am going to leave Dynamic prompts alone I'm going to leave noise alone and I can okay I think we're ready to give it a shot and see what it creates so I'm going to go ahead and click on invoke now when I click this it's loading some things it's loading tokenizer encoder another tokenizer another encoder so just a bunch of stuff the refiner and it's going to use those things to start generating the image you'll see it's still just kind of thinking and in the terminal I just kind of want you to see once it actually starts generating it what it looks like so let me explain what's going on here down here you can see it's at two percent so it's generated two percent of the image five percent and it's going through and it's basically doing those steps where we selected 50 steps it's doing those steps to create the image now over here you see it says like 6 of 40. so why is saying 40 when we selected 50. well because we said that we're using the refiner and we set the refiner to start at 80 percent so 80 of 50 is 40 which means the last 10 steps of this are going to be the refiner doing the work as this is happening this kind of noisy image starting to kind of take shape of the Havanese and this will the Vogue button itself acts as the indicator for how far along that is I can already make out the nose here in the middle and the eyes it's kind of you can start to see a little dog coming in here a little Havanese dog this is exciting step 25 of 40 now what I have found is that on the Mac it's a little bit slower to run sdxl than it is to run version 1.5 of stable diffusion so I still use 1.5 it still generates awesome images and it's faster but I would essentially like to see if I can generate better images with sdxl and since it's so new you know the community hasn't gone crazy with sort of generating all kinds of refinements to it but I'm excited to see where it goes and if it'll be able to compete with mid-journey so there's the 41st steps kind of finished and now you can see what it's doing is loading the refiner over here and it's going to run that for the last 10 steps here you can see we've got this kind of rough image of a cute little Havanese dog it takes a little while to load the refiner I gave it 16 gigabytes of memory for switching between models I'm not sure if it's actually switching the model or just loading the model or what's going on behind the scenes but there is this kind of significant delay on the Mac between the main model doing its thing and then the refiner finishing it off which you didn't see in version 1.5 because there was no refiner okay so it's getting started each step appears to be taking quite a while or at least the first step appears to be taking a while it actually took 10 minutes and 30 seconds which is super long and I think the reason for that is because I did do the increased resolution 10 24 by 1024 and even though my MacBook Pro is pretty beefy it's probably sort of meeting it's a challenge with uh with this latest version of stable diffusion so I'd recommend going with 512 by 512 on a Mac for the resolution and then just upscaling that there's a bunch of upscalers that you can use I won't show how to do that in this video but suffice to say you can get really quality images that way as well so okay so it's finished running and lo and behold that is insanely good this is the image that was generated wow so we got a 1024 by 1024 perfect image of this cute little Havanese dog I'd say that's pretty amazing and I look forward to seeing what images you guys create please leave comments in the comments section let me know if you want me to elaborate on anything let me know if you're having any trouble with your installs a happy photo making with stable diffusion version SD XL 1.0 it is absolutely amazing what it can produce and I do think that having the option of running stable diffusion locally with sdxl is going to be a competitor to Mid journey and that's a good thing competition in the marketplace all right everybody until next time
Info
Channel: Sam Razi
Views: 6,501
Rating: undefined out of 5
Keywords: Stable Diffusion SDXL, SDXL, SDXL 1.0, Stable Diffusion, Midjourney, Install Stable Diffusion, Install Stable Diffusion on Mac, Install Stable Diffusion on M1 Mac, Install Stable Diffusion on M2 Mac, Install Stable Diffusion on Apple Silicon, AI Image Generator, Artificial Intelligence, Machine Learning, InvokeAI, Invoke AI 3.0, Invoke AI 3.0.1, Install Invoke AI 3.0, Install InvokeAI on Mac, Stable Diffusion How-to, How to install Stable Diffusion on Mac, Install SDXL on Mac
Id: 6LjDykRMtg8
Channel Id: undefined
Length: 26min 56sec (1616 seconds)
Published: Mon Jul 31 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.