Transcript for:
AI Image Generation with Flux Model

okay so this is super cool I figured out a way to use the new flux AI image generation model and actually train myself into the model so that I can get pictures like this of me and Deadpool walking away from an explosion you know ignore the fact that it makes me look like I'm 6'8 tall it's got the face pretty dialed in I also managed to make this where it got both my face and text all in the same image I mean it missed the word to and subscribed to Matt wolf but the vibe is there here's another one where I'm holding up a sign that says subscribe and it looks pretty solid or here's me as Superman of a city and and another me as Superman above a city and another option for me as Superman above a city here's another one that I made of me in outer space as an astronaut and here's me as whatever this was I don't remember what I was thinking I made it really late at night and then here's another of me in like some sort of workshop with a light bulb I was going with some really weird prompts I don't know what I was thinking anyway in my opinion flux is one of the best models at generating realism that exists right now it's pretty on par with what we get out of mid journey in fact I made an entire video here called easy guide to ultra realistic AI images with flux and if you want to learn how to make super realistic images with flux you should definitely check that out in that video I used a tool called foul. a they have a model called flux real ISM Laura where you can enter a prompt and it tries to give you as realistic of an image as possible again check out that other video I break down the whole process in this video I want to show you how to get yourself into the images now back about a year ago I made this video called inject yourself into the AI and make any image with your face 100% free method back when I made that video the model we were training into was stable diffusion 1.4 since then we've gotten stable diffusion 2 we've gotten stable diff Fusion XL we've gotten stable diffusion 3 and now we've gotten flux so quite a bit of time has passed but the models have gotten a lot better so now we should be able to train our faces into the newer better more performant models also back when I made that video the process to do that took a good two plus hours you had to train it on dream Booth inside of a Google collab you had to keep the browser open and kind of scroll the website every once in a while to make sure the website didn't time out if you watch away from your computer while it was happening and it completed the process it might still time out after completing the process and the weights that you created would disappear it was kind of a mess I mean it worked a lot of people managed to generate AI characters of thems based on that video but the process has gotten so much better so much easier and so much dang faster so we're going to talk about that in this video now when I made this image here and then eventually turned it into a video I actually didn't use the method that I'm going to teach if you want to see the method that I used here I actually broke down that workflow in this tweet here I use that same file. a site that I used to create the ultra realistic images they have this option to train a flux Laura here and it cost pretty much $5 exactly to train the model it's a half a cent per step but the recommended amount of steps to train is 1,000 steps so it comes out to pretty much $5 exactly to train on this website there's also a Google collab available where you can run all the steps in the Google collab to train your own model when I actually went through this specific process I ran it on an a100 GPU up here which does require a Pro Plan at $10 a month in order to do and it took about 2 hours to train the model using this Google collab both options work the Google collab works great using file. a also works great cost $5 I was able to generate images like this using that method but in this video I'm going to show you a way that you can do it for free now it's not normally free but I'm going to hook you up in this video so stick around to the end and I'll make sure that you understand how to actually do this process with no outof pocket cost to you so in order to train our flux Laura model with our own face into it we're going to use the site replicate tocom now now this isn't a free to ous site you're basically renting gpus from them to run the processing and if you're going to use an Nvidia a00 which is what we'll use to train this Laura it costs about a tenth of a penny per second or roughly $5 an hour however I'm going to hook you up with a coupon code that should mitigate any cost of actually training this Laura so when you're on replicate decom make sure you create your own account and once you have an account created head on over to the explore page and search out Luca taco luua t a you could pretty much click on any of the models that show up I'm just trying to get to their username I'm going to go ahead and click on their username here Luca taco and then scroll down until you find this Luca Taco AI toolkit you can see this is the AI toolkit for flux Laura training this is what we want to use to train our Laura this time around as of recording this video it's one 2 3 4 down the page here so I'll go ahead and click into this and we get a screen that looks like what you see right now I'm going to click on the tab up at the top that says train and this is where we're going to actually set everything up for the training and it's real quick real easy you don't really need to change a lot of the default settings now under destination go ahead and select create a new model and then enter the name of the model that you're going to create for this one I'm going to go ahead and just call it Mr eflow dlur and then it asks for an images file now this needs to be a zip file of the images that you want to to train it on and you can see here the instructions say file names must be their captions so for example a photo of to now where it says to this is going to be your trigger word that you're going to use to invoke your likeness into the image so here's a bunch of headshots that I have on my computer and you can see I renamed them all a photo of Mr eow with little underscores in between each word and then each one is just numbered after that since all of these are named as a photo of Mr E flow it's going to give the model that extra context that when we type Mr eow it brings in an image with my face on it now I have 20 different images here I think the minimum is about 12 yeah so minimum 12 images required I have 20 so I'm just going to go ahead and use all 20 once you have all 20 of your images go ahead and zip them up I already created a zip file here but this ZIP file you can see just contains the 20 images that are right here so I will take my zip file drop put into where it asked for our images file under T model name here we're just going to leave that blank we'll let it use the default now we need a huggingface token so head on over to huggingface doco create a free account if you haven't already go up to your profile click on settings over on the left click on access tokens up at the top go ahead and create a new token I'm going to set up one of these fine grain tokens and these are the permissions I'm going to give it I'm probably giving it more permissions than it actually needs but to be honest I'm not 100% sure what permissions it needs so let's just go ahead and give it that I can't imagine it needs billing or discussion permission so I'll go ahead and name this Mr eow Laura replicate and we'll go ahead and create the token copy our access token here jump back over to our replicate page and then paste in our hugging face token right here now under number of steps we want 1,000 steps for learning rate we'll ahead and leave that as the default batch size Default Resolution default defa Laura linear we're going to just leave all of this to the default now when we get down to the repo ID you can have it automatically upload the Laura to hugging face so you can access it from there so I'm going to go ahead and do that you can see the formatting should be your hugging face username followed by whatever you want to call it so I'm just going to call it Matt wolf slm eow Laura now once you've entered a repo ID here you're going to want to go ahead and create that repo over on hugging face so if I jump back to my hugging face account here and I come and hover over my profile pick I can select new model and then under model name we're going to use this same name here everything after the Matt wolf slash here this Mr eow Laura go ahead and paste that into the model name here I'm going to set this as a private model and then we'll go ahead and create the model and then we can go ahead and click create training and we can see it's going to start running the training now last time I did this training process it took about 24 4 minutes and if you remember it costs about a tenth of a penny per second so let's just say 25 minutes time 60 seconds time .14 it's going to cost about $210 to train this Laura all right so the model has completed training here you can see that it took 26 minutes to train we do the math on that real quick that would come out to about $28 18 cents to do this training run so now we've got our Laura created if we jump over to our hugging face model that we made earlier go ahead and refresh this now if we click on files and versions you can actually see that it dumped the files the Laura files that it created into this hugging face model for us here I'm going to go ahead and copy this repo ID here we're going to knad it in a second when it comes time to actually generate the images so now it's time to actually run the model and at some images with our likeness see how well it did so once again I'm going to go to Luca Taco's account here click back into his profile and at the time of this recording the very top left option here says flux Dev Laura and if we click into this one we can actually prompt with the Laura we just created so we'll come back to our text prompt up here in a second let's set an aspect ratio of 169 you can use whatever you want here you can set your outputs anywhere from 1 to 4 let's just generate one to start infer steps we'll leave it at the default 28 guidance scale we'll leave this at the default as well just to see how it does you can choose how you want your image to be outputed as a webp a JPEG or a PNG let's go ahead and do JPEG and then down here under HF Laura this is your hugging face repo that we just copied earlier so we'll just go ahead and delete that and we'll paste in the proper repo here in my case it's Matt wolf slmr eow Laura and then for the Lura scale number here I'm going to bring this up to one and now we can jump all the way to the top and pick a prompt here I'm just going to start with something really really simple let's do Mr eow that's my trigger word that I created earlier as a wizard in colorful robes looking straight into the camera let's just go ahead and start with a very simple prompt and let's see if it actually figured out what I look like we'll click run here and I actually got this error here I was going to edit this out but I figured I would leave this in just to show you what I did wrong just in case you run into this error as well when I created my model over here on hugging face I set the model as a private model so if I go over here to settings you can see the model visibility is private which is causing issues with replicate actually being able to see the model so if I go ahead and click make public now this model is public for anyone to use I can see it confirmed here the model is currently public now theoretically if I try to run this one more time I shouldn't get the same error this time we can see that it is actually properly running through and there it is there's what it generated that's apparently what I look like with Mr eow as a wizard in colorful robes looking straight into the camera now I'm going to test a few more prompts here in a second but I also want to fulfill on my promise to show you how you can do this for free right now so Louis see here AKA Luca Taco who actually put this stuff up on replicate for you to use I actually was talking to him behind the scenes in some Twitter messages and told him I was about to make a video showing how to train yourself into Laura's replicate did not sponsor this video there was no deals made or anything like that I just told him hey I'm going to make this video showing how to do this with replicate and he said if you do here's a $10 coupon code that people who watch your video can use to get $10 in credits to replicate so again if we're doing the math it cost about $210 $220 to actually train the Laura and then once you're actually using the model we can see down here at the bottom the model costs approximately 9 cents to run on replicate so every time you generate an image using your custom model on replicate it costs about 9 but lwis is hooking you up with a $10 off credit so let's say you got $10 let's say you spend $225 on actually training the model you now have $7.7 5 divided by 9 cents per generation you should be able to generate about 86 images of yourself in whatever scenario you can imagine with those free credits now in order to get those free credits I put a link to replicate in the description it's not an affiliate link I don't get a commission I didn't make a penny off of talking about this but there is a special link to use replicate in the description when you click that link you should see a page that looks like this welcome to replicate you've been given $10 in credit to run and fine-tune models accept the credit it'll put $10 in your account you're good to go you don't even need to put in credit card information you can start testing and playing with the model right away so thank you so much to replicate and to Lis Luca Taco here for hooking everybody up so now that you know how you can use it for free let's go generate some more stuff and see what kind of cool crazy Creations we can get out of this so one thing I really like to do and this is just sort of a bonus tip is I like to use Claude to help me sort of optimize the prompts and make cooler prompts they're going to get cooler outputs a really easy way to do this is to use Cloud's new projects feature if I come to Cloud go to projects on the left create a new project and let's just call it flux image prompt Optimizer you can name it whatever you want but that's just a very literal name for what I'm going to be using it for we can create the project and the only reason I'm creating this project is I want to set custom instructions for whenever I use this project and then every time I use this project in the future it's going to use the same exact custom instructions it's going to know what to do all right so I went ahead and I wrote up a set of custom instructions here I'll just read it real quick you are an AI image prompt Optimizer Your Role is to take the prompts that I give you and optimize them so that the image generated is higher contrast has more brilliant colors and has beautiful Aesthetics the subject of the prompt will always be Mr eow this is the trigger word to use my face within the image The Prompt should always mention what camera angle should be generated we want the subject Mr eow to always be the main focus of the image and his face to be seen in the image and then I went on to add whenever an image prompt is submitted respond with three optimized prompts to get a better version of the same idea don't give any extra context just reply with the optimized prompts a lot of times Cloud will reply with Okay here is the optimized prompts for you I hope these work and then it'll give the prompts and at the end it'll say let me know what you think or if you want them to be improved I don't want any of that extra stuff I just wanted to repl with the new prompts also I thought let's have it do three instead of one and we can either try all three or just pick the one that generated the best prompt just gives us some options so I'll go ahead and save these instructions and now let's take this exact same prompt that I used earlier I'll just copy this one here jump over to clad paste it in and let our custom project that we built here do its thing and just like that we got three optimized prompts close-up portrait of Mr eow as a powerful wizard piercing gaze directly at the camera wearing vibrant iridescent robes with intricate blah blah blah blah blah all right let's just copy this first one paste it in right here run it again bada bing bada boom look at that image that is absolutely awesome quite a bit better than anything I've managed to get out of stable diffusion using my Custom Dream Booth model let's try the second prompt it gave us here plop that in there and we'll run the second one here's what that second prompt gave us the Beard's a little bit longer than I've had it for a while but looks pretty good and here here's the third image from the third prompt got an extra finger on one hand but it's definitely a little bit more intricate and uh cooler than what I came up with with my original basic prompt now let's come back to clad here and I'll just do something really simple I'll just put Mr eow as a basketball player let's see what it generates so we got three prompts here let's go ahead and one at a time see what they look like here's the first image that it generated here's the second image that it generated and here's the third image that it generated at pretty cool here's an image I tried to generate of me walking next to Deadpool but it kind of put me facing the wrong direction and then here's another attempt where it actually got me and Deadpool in the image with an explosion in the background now one thing I've noticed and I don't know if this is how this actually is supposed to work I don't know if this is common knowledge but when I put Mr eow my trigger word as the first word it works a lot better than if it's somewhere else within the prompt so this prompt originally said low angle view of Mr eow and Deadpool when I generated the first time it literally just had an image of Deadpool I wasn't in the image when I reworded it so it said Mr eow and Deadpool Mr eow being the trigger word as the very first word it prompted more of what I was looking for again that could be totally coincidental but I have noticed with multiple other prompts that if my trigger word isn't the very first word it messes it up a little bit so for me best practice from what I've been doing has been to put it as the very first word to get the best result and then once you do have a really cool shot you can take it to the next level by jumping over to Runway gen 3 clicking on get started and tossing your latest Creation in here to animate it like I showed in my previous video I usually just take the same prompt here copy it throw that into Runway I'll set this as the first frame instead of the last frame and uh we get this epic video of me and Deadpool slow motion walking away from an explosion just like they do in the superhero movies and it looks pretty dang cool so yeah flux is fun trending your own likeness into the flux images is even more fun and then turning it all into a video uh it it's kind of awesome I'm having so much fun playing with this stuff right now anyway I hope that tutorial was helpful for you if you like stuff like that and you want to know about the latest AI news T to TOS cool stuff like that give this video a thumbs up and maybe consider subscribing to this channel because I like to make tutorials like this that are fun and hopefully entertaining and educational and I'd like to keep you in the loop with the AI news and if that's what you're into I think you'll like being a subscriber anyway that's all I got for you really appreciate you see you in the next video bye-bye