SDXL LORA Training Without A PC: Google Colab and Dreambooth

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
my last video I showed you how to create a low rank adaptation or Laura file for stable diffusion these allow you to create unlimited AI images of yourself or pretty much any other person place or thing you can think of think of it is a way to fine-tune a stable defusion model and teach it how to create a specific style or a specific character the problem a lot of people have is you need a fairly high-end gaming PC or a high-end MacBook Pro what if you don't have one of those well to today I'm going to show you how to do it for free using Google collab so let's Jump Right In and get started now to start we're going to jump over to GitHub and we're going to go to autotrain Advanced you can see the author right here big shout out thank you so much for taking the time and effort to create this for everyone now when we scroll down here you can see autot train Advance there's this sort of read me file and you can say Deploy on hugging space faces or open in collab so we're going to click the open and collab button and this is going to open a new tab tab it has the Google collab fired up and it has all the code ready to go there are a couple things you need right off the front here so you need to enter your hugging face right token so go ahead and click on this it's going to open another new tab leaving collab and going over to huggingface if you don't have a hugging face account don't worry it's free to sign up just enter your Gmail address and you can get started if you do have one it's going to take you straight to this access tokens section and it's going to show you your existing token if you don't have one you can just click new create one and be sure to click on right in the drop down and we're going to go ahead and just say this is for a demo if I can type here generate token and there you go now you can click this little icon over here that's just the copy button we'll jump back over and paste that in to the box down here don't worry if you can see this I'm going to obviously delete this after the fact but for the sake of this demo this will work the next thing you need is an enro O token so again click the link it's going to leave collab take you over to the enro site same process here if you don't already have an account you can create one just click on sign up for free and you can sign up with Gmail or with GitHub any other method you want INR is going to ask you a couple of questions at the signup you say you're an application developer it doesn't matter all this is just for demographics and then you're going to be dropped directly in now we can go back and we can get that off token again so I'm going to click that same link and call lab now it's going to take us straight to the dashboard where we can get the token all you're going to do is click the copy button it should automatically have one set up for you you click copy then we're just going to paste that where it asks for it here and we've got both of our tokens set up the next thing we need to do is go to the connect dropdown up here in the upper right we're going to click on connect it's going to take just a minute what this does is it's actually connecting to a GPU instance over at Google collab the cool thing is it has 15 GB of vram so that's enough for us to actually train a stable diffusion XL model once that's connected you're going to get this little drop down here it says connected Python 3 to Google engine RAM and dis space everything else you need now we can click the play button over here on the Auto Train it's going to give you a warning telling you this wasn't authored by Google that's fine let's go ahead and run it anyway and this part's going to take just a minute what it's doing is it's starting to fire up the collab notebook what I like to do while this is running is click on this show code button that's just going to show you what's actually happening behind the scenes and you can see that right now it's just installing all of the different prerequisites needed for this entire system to run this is going to need python and a whole bunch of other stuff and so that's going to take just a couple minutes to get going all right so now we've got our Auto Train public URL down here you can see right here it says Auto Train public URL enro tunnel and it gives you this address here enro has actually set up a tunnel in order to get to the local host of this collab instance which normally is where the code actually runs you can see down here 1271 that's the local host address of the collab machine but we can't access that because we're not on the same network so click on this enro link and it's going to ask you if you want to visit the site for security reasons you can click visit site and this gives us a nice GUI to start with so you can see a couple things here here's your hugging face user all your Tech here's your project name Hardware local that's correct it's running on the local hardware on their machine task you're going to want to change this so by default it's training a large language model so you're going to go into this drop down and you're going to select dream Booth Laura and you can see that the base model has changed to stable diffusion 1.5 so if you wanted to do a stable diffusion 1.5 model or a 2.1 model you could but specifically for us we're going to go stable diffusion XL base 1.0 that's an sdxl model you can see over here on the right hand side these are all the training parameters that it's going to use so by default resol resolutions a24 it's not going to crop it's doing 500 steps on each image and 500 checkpointing step so this should be a pretty decent quality result that comes out of this just like you'd get if you were running it locally on your own machine the next thing we need to do is upload training files and to get training files you have a few options you can simply go over to Google image search and if you wanted a stable diffusion model trained on Taylor Swift images you could just do a Google search for Taylor Swift go over to tools and pick large you want high resolution images you want something that doesn't have a crazy background and you don't want a lot of other people in the images in fact you just want it to be a highquality image of Taylor Swift or whatever the subject is that you're trying to get how many images do you need I would say anywhere between five and 10 is typically enough I've trained with as few as six and I've trained with as many as 40 before and the results are pretty identical in most cases before we click train we've got a couple of last things to do here so in the parameters list off on the right you'll notice the prompt at the top now I've gone ahead and replac the placeholder with Tom Cruz man it's because I'm training a model of myself and let me explain this a little bit further so if you've watched other stable diffusion tips and tricks for luras in the past you've probably heard that you should use a random set of characters or something that's unusual as the trigger word or the name that you're going to use in stable diffusion to actually generate the images that's actually not true you want something that there are a lot of images already in the base model for so that it knows what that object should look like so in this case by saying Tom Cruz man there are tons of one men in the data set and there are tons of images of Tom Cruz in various poses and doing various things so it's going to be a really flexible model if it's trained on something it knows about already what we need to do is figure out who we look like my case I go over to Google and I do a Google search for celebrity lookalike and the first site that comes up is Star by face you can simply upload one of your pictures there and it's going to tell you which one of the celebrities you look like in this case it came back with Tom Cruz I think it's probably because of our jaw and facial structure probably not so much the fact that I shave my head and he doesn't so it's close enough obviously if you were doing something else if you were training Taylor Swift you'd say Taylor Swift Swift woman you do whatever it is and then the type of object that it is so if it's a person place or thing and then last but certainly not least you'll go ahead and go down to upload images then just go to the directory where you've saved all your training images in this case I've got a bunch of selfies of myself so I'm just going to grab six or seven of those once those images are uploaded you'll see them right down here below where it says upload training files and you'll see each of the file names from here we are actually ready we we can just click on start training it's going to come up with this warning message don't get freaked out it says Auto trains a paid offering and you'll be charged for this action you won't so don't worry about it you can ignore this message if you're running Auto Train on a local hardware technically speaking this is local hardware because it's running on Google collab so you're not going to get charged for this click on yes I'm sure that's going to start the training you'll get a message here that says success in my case I got an error just because I'm already running the training in the background from there just hop back over to your collab tab you're going to see the progress down below it's going to take a long time for this to run expect an hour to two hours depending on the number of images that you uploaded go have a coffee take a nap relax go for a run and we'll come back when it's done in this case it took about an hour 45 minutes for it to finish but it's all done so we're going to click on this file icon over here on the leftand rail you're going to drop down these folders and one of them is going to contain Ain a pytorch Laura weights. safe tensor file this is the actual Laura file that you need in order to run this locally on one of your machines so you can actually use the Laura so find that safe tensor file and then you're going to click on the three dots and just click download that's going to download it to your downloads folder on your local computer and from there we're going to be able to load this up into stable to Fusion software on our local machine and generate some images once you've downloaded your SA tensor file this is what you're going to copy into whatever program you're going to use to run stable diffusion locally now you could use automatic 1111 you can install that on your system if you've already got it that's great if you don't got on my patreon page I've got a one-click installer you can use that otherwise you can use something like Focus or invoke AI for this case I'm going to go ahead and use Focus so I'm going to go to my focus directory I'm going to go to models and then I'm going to go to luras and if you're using automatic 1111 it's the same thing you go to the root directory models luras same for invoke as well once you've already dropped this down into the Laura's folder you can start the program so we'll go back to the root directory run the run.bat the reason I like Focus so much is because it's really easy to use it kind of abstracts away a lot of the difficult pieces of running stable diffusion locally but you can still do some Advanced things with it this is the UI for focus and it's really basic you can see here you just have this prompt where you enter in your keyword text you've got this Advanced Tab and generate we're going to click on Advanced for now we're going to change just a couple of settings we're going to go 1,24 by 1024 this is where you can set your resolution for the images we're going to keep the number of images set to two that's how many it'll generate from a single prompt and we're going to select quality just so it makes a little bit higher quality pictures so this is going to have a larger number of steps for each picture steps are essentially the iterations the number of times that iterates over for a single image and so the higher the steps to a point the better the quality of the image and then we're going to jump over here at the top we're going to go to model and we're going to make sure that the base model is sdxl base 1.0 then we're going to select our Laura your Laura is probably named pytorch Lura weights safe tensors you can rename that to something else in fact I would rename it to your trigger word or your keyword that you had set up when you initially trained this and then you're going to set the weight to about one doesn't have to be exactly one but somewhere real close to one 097 is fine then in the prompt box we're going to type our keyword phrase so I'm going to say Tom Cruz man and you're going to type just whatever you had set up we'll just go ahead and generate a couple of test images and here we have our first two stable diffusion images came out great they actually look really high quality one of the really cool things I like about focus is again it makes things really easy so we can go over to the style Tab and then you can just select some of these other drop downs these are sort of different styles that you can reply to your prompt so in the background it's going to add additional keywords and phrases to your prompt but you don't have to think about it you just kind of click on these buttons and you're good to go so we'll add this heroic fantasy one and we'll go ahead and click generate again you'll notice these two images didn't come out much different from the first ones they still have a really realistic look to them so we'll go over to the model and I'm actually going to drop the weight down to let's say 84 on my Laura this is basically how much the prompt is going to adhere to the Laura and sort of guide the final image to it and sometimes having it too high or too close to one is going to override any of the kind of filters that you end up setting for this so we're going to keep the style on heroic fantasy drop that down and then we'll generate again and see if that gives us a little bit different image here we go I love the way these came out especially this first one these are actually some of the settings I use for my YouTube thumbnail so this is actually a really good photo I'm actually going to save this one might use that later you can come in and try some of these other styles like let's try something a little wack here we'll try a fortnite art style C generate once that's selected all those are a little wacky I wouldn't call that fortnite style so what we'll do is we'll go over to the advanced tab we'll jump the guidance scale up from the four that it was to six this is going to make it a little bit more Vivid and artistic and then in the model we're going to drop the weight for the Laura down to8 we'll generate again that second one's a little bit more fortnites but you'll notice if you look at the face it's looking a little bit more like Tom Cruz and a little bit less like me so let's go back to that models tab we'll bump that back up to say 93 go to the style and I'm going to turn off some of these other styles the focus V2 enhance and sharp and we're just going to leave on the fortnite style all right I got to say we nailed it that time the backgrounds the colors the aesthetic everything looks pretty spot-on for fortnite really cool and if you'll notice we didn't change our prompt at all so you can get these drastically varied in different art styles but you don't have to really mess around with your prompt try a couple more just for for the fun of it go ahead and do futuristic cybernetic robot these are turning out awesome and this is kind of way too much fun so let's do a couple more bosot one of my favorite artists let's do a bosot version of me all right interesting it's like Jean Michelle basad and me are sort of distant cousins maybe at best interesting to say the least let's try this cyber Punk this one's awesome I look like I'm straight out of n city cyberpunk 2077 now the other thing you can do here is you don't just have to select one you could say for example heroic fantasy and cyber Punk maybe you want to throw in I don't know neon Punk we'll get a little bit of neon additions to this well you can mix and match doesn't really matter you can do Zelda you can do anime a lot of really cool stuff here you can already see how it's sort of blending these different styles together you're getting that cyberpunk look but now it's got a bunch of Neon Lights which pretty cyber Punk esque then it's getting that kind of heroic fan look that we had earlier which sort of Smooths over some of the fine details I really like it I apply that to a lot of my images I love the way these came out it's really cool that you can play around with these different art styles and Aesthetics and come up with completely new stuff without kind of having to be a prompt master so again check this out and if you happen to be one of my patreon subscribers I post a lot of prompts like this all the time that have different art styles some of these are trained specifically on my Laura so you can see here you can do a bunch of different selfie poses I've got a whole bunch of different art styles this one in particular is one of my favorites it shows you how to create that alien ripping off its mask which happens to be your face so I show you how to do a lot of those different prompts in here there'll be a link down in the description if you decide you want to join and take a look at those I'm always posting new and interesting content and I think that just about wraps things up for today let me know some of the cool things that you end up creating down in the comments below I'd love to hear from you let me know if you have any questions or comments otherwise I'm Brian love it this is all your Tech AI we'll see you next time thank you all so much in the T town breaking down AI wearing the crown from Basics to complex never let you down all your Tex a i earning the renown
Info
Channel: All Your Tech AI
Views: 24,264
Rating: undefined out of 5
Keywords: stable diffusion xl, google colab, stable diffusion tutorial, stable diffusion xl 1.0, sdxl 1.0 lora training, sdxl training, kohya lora sdxl 1.0 training, lora sdxl 1.0 training, google colab tutorial
Id: 0ab2uOi2-3A
Channel Id: undefined
Length: 16min 18sec (978 seconds)
Published: Wed Jan 24 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.