Transform Your Selfie into a Stunning AI Avatar with Stable Diffusion - Better than Lensa for Free #312
FurkanGozukara
announced in
Tutorials
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Transform Your Selfie into a Stunning AI Avatar with Stable Diffusion - Better than Lensa for Free
Full tutorial: https://www.youtube.com/watch?v=mnCY8uM7E50
Our Discord : https://discord.gg/HbqgGaZVmr. How to do free Stable Diffusion DreamBooth training on Google Colab for free. If I have been of assistance to you and you would like to show your support for my work, please consider becoming a patron on 🥰 https://www.patreon.com/SECourses
Playlist of Stable Diffusion Tutorials, Automatic1111 and Google Colab Guides, DreamBooth, Textual Inversion / Embedding, LoRA, AI Upscaling, Pix2Pix, Img2Img:
https://www.youtube.com/playlist?list=PL_pbwdIyffsmclLl0O144nQRnezKlNdx3
In this video, I will show you how to create your own Lensa app-like magic avatars without using any third-party apps. Our method ensures 100% privacy, unlike uploading your personal photos to external apps and platforms. I am sure you have seen many people sharing their magic avatars on social media. While these paid apps use free open-source AI models, they still require payment. Additionally, AI image generation apps may keep your private photos and use them as they please. Instead of paying and trusting the goodwill of these paid apps, we will use these open-source public AI models ourselves.
I will provide step-by-step instructions, so even those with no technical expertise can follow along. We will be using Google's Colab, a free #AI platform that offers access to a powerful GPU at no cost. Therefore, this tutorial can even be completed on a mobile phone without a PC. All you need is a Gmail account. Once we train the open-source image generation model #StableDiffusion with #DreamBooth by using our own portrait images, the possibilities are endless. Unlike other applications, the method I will demonstrate does not impose any limitations on image generation. You will be able to freely compose any kind of image as many times as you desire. You can not only generate your own avatars, but also any other images you want, such as highly detailed car images or landscapes.
5 May 2025 Tested Verified Working Perfect
Google colab notebook link (ignore error messages, skip hugging face token):
https://colab.research.google.com/github/FurkanGozukara/Stable-Diffusion/blob/main/DreamBooth/ShivamShriraoDreamBooth.ipynb
Huggingface https://huggingface.co/join
Bulk image editing: https://www.birme.net
For prompts check out the comments
00:00:00 Introduction and the content
00:02:04 How to check you have enough Google drive space
00:02:18 Starting to prepare Google Colab notebook for Stablediffusion Dreambooth model training
00:05:01 Register, login and generate Hugging Face token for training of the AI model
00:06:56 Continue training setup of the Stable Diffusion Dreambooth
00:07:41 Setting the settings of Stable Diffusion Dreambooth model
00:09:08 Providing our own photos to train the model to teach our own face image
00:11:58 How to install Paint NET for image cropping
00:12:12 How to crop and prepare your training images by using Paint NET
00:13:36 How bulk image crop online with birme net website
00:14:50 How to quickly check all images dimensions in a folder by using sort options (width, height) in detailed folder view
00:15:26 How to upload training images to Google Colab
00:17:53 Starting training with last settings / options
00:18:11 Optimal parameters for training of Stable Diffusion Dreambooth model AI
00:22:42 Training of the AI model done
00:25:55 Exiting application/notebook completely and starting again to show how to use trained model
00:28:00 Starting to generate AI / Lensa app magic avatars
00:30:20 First avatar is generated and displayed
00:31:14 Explanation of the positive / inference prompt input to generate avatar images
00:32:44 Explanation of the negative prompt input to avoid such images, guidance_scale & num_inference_steps parameter of Stable Diffusion
00:36:47 New avatars with different guidance_scale parameter
00:37:34 How to generate colored portrait avatars / profile images
00:38:57 Showcasing different styles of generated avatars
00:40:00 Debated usage of artist styles
00:40:26 Continue to generate more artworks
00:42:18 Prompt for asian style artworks like korean, or japan or anime
00:44:45 Long hair, different eye color version of me
00:46:43 Adding armor keyword
00:47:22 Further tuning of input prompt
00:51:21 Cherry picking the results
00:54:27 How to generate hundreds or thousands of magic avatars as a batch
00:55:59 Clip of ~200 Stable Diffusion AI generated avatars
00:57:40 Ending talk and discussion
Video Transcription
00:00:00 Greetings everyone.
00:00:01 In this video, I will demonstrate how to generate your own Lensa app-like magic avatars without
00:00:07 using any third-party apps.
00:00:09 Our method ensures 100% privacy unlike uploading your personal photos to external apps and
00:00:15 platforms.
00:00:16 I am confident you have seen many individuals sharing their magic avatars on social media.
00:00:21 Although these paid apps utilize free open-source AI models, they still require payment.
00:00:26 Furthermore, the AI image generation apps could keep your private photos and use them
00:00:32 as they please.
00:00:33 Instead of paying and trusting the goodwill of these paid apps, we will use these open-source
00:00:38 public AI models ourselves.
00:00:40 I will provide step-by-step instructions so even those with no technical expertise can
00:00:46 follow along.
00:00:47 We will be using Google's Colab, a free AI platform that offers access to a powerful
00:00:52 GPU at no cost.
00:00:54 Therefore, this tutorial can even be completed on a mobile phone without a PC.
00:00:59 All you need is a Gmail account.
00:01:02 Once we train the open-source image generation model, Stable Diffusion with Dreambooth by
00:01:08 using our own portrait images, the possibilities are endless.
00:01:13 Unlike other applications, the method I will demonstrate, does not impose any limitations
00:01:17 on image generation.
00:01:19 You will be able to freely compose any kind of image as many as times you desire.
00:01:26 You can not only generate your own avatars, but also any other images you want, such as
00:01:30 highly detailed car images or landscapes.
00:01:34 Let's begin by logging into a fresh dummy email I have set up for this tutorial.
00:01:40 For this tutorial, all we need is a Gmail account, a free Gmail account, and if you
00:01:44 don't have a free Gmail account, you can just create your account.
00:01:49 Just type Google Gmail and you will get into this page.
00:01:52 So I am going to click sign in.
00:01:55 Okay, I have logged in my Gmail account.
00:01:57 Now we are ready to go.
00:02:00 Make sure that your drive folder has enough space for this tutorial.
00:02:05 By typing drive.google.com into your browser, you can log in into your drive.
00:02:12 You see currently my drive is empty and I have 15 gigabytes of empty space.
00:02:18 For this tutorial, we are going to use this: Google Colab image.
00:02:22 Don't worry, I will copy and paste this link into the description of the video so you won't
00:02:28 be have to type it.
00:02:29 First, let's first let's check out that we are logged in into our Gmail account.
00:02:34 As you can see, I am logged in and let's start with copying this file into our Google Drive
00:02:41 so we can use it later with the changes we have made.
00:02:45 Okay, it is generating a copy.
00:02:48 All right, now we are ready to start.
00:02:51 First, we are going to click connect to start our virtual machine.
00:02:55 Okay, it is asking us that whether we are a robot or not.
00:03:02 Okay, I have verified that I am not a robot.
00:03:07 Now it is connecting.
00:03:09 We are going to wait until we are connected.
00:03:11 It is initializing and okay, we are connected.
00:03:15 You see it shows us what kind of resources we are available.
00:03:18 First, we are going to check the GPU and VRAM available because this image generation requires
00:03:26 a lot of power and you see Google is providing us a very strong GPU for free.
00:03:35 Tesla T4 GPU.
00:03:37 Okay, as a next step, you are going to click this install requirements.
00:03:43 You see when I hover my mouse, there are play buttons like here and we are going to click
00:03:49 them by one one.
00:03:50 First we click it this and we check it that we have a GPU ready.
00:03:54 Next, we are going to click install requirements.
00:03:57 You don't need to change anything in this part of the code.
00:04:01 You just need to wait.
00:04:02 This is until completed.
00:04:05 Okay, the installation has been completed.
00:04:08 So what did we install, we have installed the necessary scripts into our virtual machine
00:04:13 currently we are using from the Google Colab.
00:04:17 Okay, it shouldn't take more than a few minutes and they are done.
00:04:21 So you see that there isn't any more loading icon here.
00:04:26 As the next we need to log in.
00:04:28 HuggingFace.
00:04:29 HuggingFace is a platform where people share their models, the AI models and the AI model
00:04:35 that we are going to use.
00:04:37 The stable diffusion model is hosted on HuggingFace.
00:04:42 This is a complex thing and I am not going to explain what are diffusion stable diffusion
00:04:47 weights or model card or other things.
00:04:49 We are just going to register a free account on HuggingFace.
00:04:53 So just open Google and type HuggingFace.
00:04:57 Okay.
00:04:59 And the URL of HuggingFace is like this.
00:05:02 I will also put this into description.
00:05:04 So you can click from there.
00:05:06 We are going to click Sign up.
00:05:08 And in here, we are going to type our email and a password.
00:05:14 Okay, I have typed my email and a password that I have generated.
00:05:19 Next click.
00:05:20 And in here, you can set the things you want as you wish.
00:05:25 Okay, I have filled the information.
00:05:28 And let's click Create account.
00:05:31 Okay, it is asking us a question to verify that we are not a bot or something.
00:05:40 Okay.
00:05:42 Okay.
00:05:44 And yes.
00:05:45 Okay, now we are logged in.
00:05:49 Now let's move back to our Gmail and let's click to verify it.
00:05:53 Okay, it's verified.
00:05:55 Okay, now we are back to our Google Colab.
00:05:58 So it is requiring.
00:05:59 It is requiring us to generate a token.
00:06:02 Tokens are used to do things and verify that you are an authorized user.
00:06:11 So we go back to our HuggingFace account, we click the icon here, it opens our profile
00:06:18 and other settings.
00:06:19 In here we click settings.
00:06:21 And in here we are going to get access tokens, we are going to click new token.
00:06:27 Let's say for AI image generation, this is not really important, you can just type it,
00:06:34 type anything here we are selecting role as write.
00:06:39 And it has generated a token for us.
00:06:41 Okay, I click show and I am copying this and pasting this into my by the way.
00:06:48 It has asked me to whether I am not a bot or not.
00:06:53 Okay, let me quickly do this.
00:06:57 Okay.
00:06:58 And we are pasting the text in here, then we click the play button so it will verify.
00:07:04 Yes, we are verified.
00:07:07 Okay, now we can move to next stage.
00:07:10 Now we are going to install another necessary script.
00:07:14 So I'm going to click play, it starts downloading and installing.
00:07:19 All of these things are being installed in the virtual machine that Google Colab is providing
00:07:25 us.
00:07:26 Don't worry if they are not getting installed on your computer or on your browser.
00:07:30 This is all happening in a remote server.
00:07:34 It is 100% safe and private.
00:07:38 Okay.
00:07:39 Okay, the installation has been completed.
00:07:43 And now we are going to set our settings.
00:07:46 So I will save the model that I am going to train into my Google Drive.
00:07:51 With this approach, I won't be need to train the AI model again and again.
00:07:58 So one time after you train it, you will be able to use it to generate new images.
00:08:05 As many as times you want in future, I will show all of them.
00:08:09 Don't worry about that.
00:08:10 So I click Save to G to Gdrive, we can give you don't change this name.
00:08:16 And OUTPUT_DIR.
00:08:17 So this output dir directory, the output directory will be generated in here as you can see.
00:08:27 So I am going to name it as secourses.
00:08:31 Okay.
00:08:32 And let's click play.
00:08:34 So it will be saved.
00:08:36 Okay, it says that it is asking us to access our Google Drive files.
00:08:40 And we say yes, this is a necessary part to save it.
00:08:44 Don't worry, this is 100% safe.
00:08:47 Because Google Colab is an organization of Google as I said.
00:08:52 Okay, it has been set.
00:08:55 It's you see, it says mounted at the content/drive weights will be saved.
00:08:59 So weights are the weights of the model that we have trained.
00:09:02 It is a complex subject.
00:09:04 As I said, you don't need to know that.
00:09:06 Okay, now we come to the tricky part, we are going to train our own image so that the AI
00:09:15 can generate avatars of our own image.
00:09:18 Okay, so there are some settings that we need to use.
00:09:22 This model learns our portrait or whatever we want to teach with keywords.
00:09:29 Okay, you can think this as a keyword.
00:09:31 So I am going to enter here a unique keyword for the sake of this tutorial, I am going
00:09:39 to set as a secourses.
00:09:41 I am pretty sure that this keyword is not exist in the database.
00:09:45 And there is a class prompt.
00:09:46 So the class prompt is used to to provide generic images related to the task that you
00:09:58 want to do for improving its quality.
00:10:02 Okay.
00:10:03 So let's set the class prompt as portrait photo of a man.
00:10:12 Okay.
00:10:13 So since I'm going to provide portrait photo of me, I am typing like this.
00:10:18 And if you are providing full body images or another thing that you want to train, you
00:10:25 can type this.
00:10:26 So the algorithm will try to improve your model based on that.
00:10:33 So these are the folders that will be generated in our Google Drive.
00:10:37 So I'm setting this as the instance as my images and the class_data_dir.
00:10:45 So this class data directory will be generated for, as I said, for these images, I think
00:10:53 so.
00:10:54 Let's say photos of man, okay.
00:10:58 So let's click, run and save it.
00:11:01 Okay, it is done.
00:11:02 Okay, now we need to upload our images.
00:11:07 However, our images has to be in a certain format.
00:11:11 They have to be exactly as 512 by 512 pixels.
00:11:18 So what is pixel?
00:11:19 If you wonder, you know, when you purchase a mobile phone, it on the camera, it says
00:11:26 five megapixel, 10 megapixel, 12 megapixel.
00:11:29 So 512 by 512 means it is 2.5 megapixels.
00:11:35 Now I will show you the folder that I have prepared.
00:11:39 These are images of me and they are currently cropped by 512 and 512.
00:11:50 So for cropping these images, what did I use?
00:11:53 I have used paint net, which is an open source source image editing software.
00:12:01 It is like paint.
00:12:03 You can just go to their website, click, download from here and install it.
00:12:09 After installation, once you open it, it has this kind of interface.
00:12:15 And you can just drag and drop your image into that application and it will get opened
00:12:23 like this.
00:12:24 And from here, we are going to select this rectangle select thing.
00:12:30 And from here, we are going to click normal and change it to fixed ratio so that we can
00:12:36 crop our image as square like this.
00:12:39 And I'm going to select the part that I want to use like this.
00:12:44 Okay.
00:12:45 Then from edit, we click copy.
00:12:49 Okay.
00:12:50 Then from here, edit or from image, we click resize.
00:12:58 Okay.
00:12:59 I'm going to set it like this.
00:13:02 You see it is now very small.
00:13:04 Then from edit, I am going to click paste.
00:13:06 Okay.
00:13:07 Now you see my image like this, then from edit or image from, I'm going to click resize
00:13:13 and I'm going to enter as 512 like this and I click.
00:13:18 Okay.
00:13:19 And now it is ready.
00:13:20 I just need to save it.
00:13:23 Okay.
00:13:24 Let's save it with a hundred percent quality.
00:13:26 Okay.
00:13:27 And it is done.
00:13:28 So this image is now also ready.
00:13:30 There is also one, another easier option.
00:13:32 If you prefer, you can just go to this website.
00:13:38 Okay.
00:13:39 You can just go to this website.
00:13:41 It is allowing you to manipulate and crop images easily as a bulk.
00:13:47 So you click browse from your computer and you can select the image that you want to
00:13:53 crop like this.
00:13:54 Okay.
00:13:55 It allows you to define width and height.
00:13:57 I'm going to define them as 512 like this, and then you can set select the part like
00:14:07 this.
00:14:08 You see, you are seeing my mouse.
00:14:10 Okay.
00:14:11 I am setting it like this.
00:14:12 Then you can click resize crop.
00:14:16 Okay.
00:14:17 I think it's already ready.
00:14:18 Then you click save as zip.
00:14:21 Okay.
00:14:22 It will, if you are, if you have uploaded multiple images, then you using save as better.
00:14:28 And you see now it is ready.
00:14:30 When I click open, it is opened like this.
00:14:33 So now I will extract it into my folder, or you can just select it from here and, you
00:14:42 can drag and drop it here.
00:14:43 Okay.
00:14:44 Now it is also ready.
00:14:45 Now all of my images are 512 by 512.
00:14:49 How can I verify that you can right click an empty area, go to view and details.
00:14:57 And in details, you can right click and there is sort by, and from more, you can select
00:15:04 width, and okay.
00:15:07 Height, properties.
00:15:08 And now it will display width and height of each image.
00:15:15 As you can see, they are 512 pixel and 512 pixel.
00:15:21 Let's return back into medium icons or let's say large icons.
00:15:27 Okay.
00:15:28 Now let's return back to our Google Colab.
00:15:30 Okay.
00:15:31 Now we are clicking upload your images.
00:15:33 By the way, how many images that I have.
00:15:36 I have currently 32 images.
00:15:39 However, they say that even 10 or five image could be enough.
00:15:43 It is, depending on quality of your images, the position, as you, as you have more variety
00:15:51 of images, then the model could, learn better your profile, your, portrait.
00:15:59 Okay from here, I am clicking this button and now there is upload button as here.
00:16:07 I'm going to click it and I'm going to select all images with, control-a, or you can just,
00:16:18 use your mouse like this.
00:16:20 I'm not going to select this folder.
00:16:22 So I click, I press hold control and click it.
00:16:24 So it is deselected.
00:16:26 And then I'm going to click open.
00:16:29 So you see now my files are getting uploaded, but they are where they are getting uploaded.
00:16:34 They are getting uploaded into my Google Drive.
00:16:38 Okay.
00:16:39 My private folder.
00:16:40 So they are still hundred percent safe.
00:16:43 we are not uploading our files into some unknown application repository, unknown application
00:16:50 storage.
00:16:51 so later I can delete everything in here and there will be nothing left.
00:16:57 Okay.
00:16:58 so this is our advantage over using those paid or even worse, the free apps, that we
00:17:07 need to trust them.
00:17:08 They will delete them later, but we can't really trust them actually.
00:17:14 because usually these paid apps are saving, storing our private files and later they are
00:17:21 using them.
00:17:23 So, our method is much better.
00:17:27 Okay.
00:17:28 Okay.
00:17:29 Now our files have been saved.
00:17:32 So it may take a while for them to appear in here.
00:17:37 Okay.
00:17:38 Okay.
00:17:40 But it is not important.
00:17:42 So now next thing.
00:17:44 Now we are ready to start training model with our portrait images.
00:17:49 There are still some, things that we need to do.
00:17:53 So we did set you see secourses for our instance prompt.
00:17:58 And we are going to change, save sample prompt the same here.
00:18:04 And so there are some parameters as you can see, after doing some research, I have found
00:18:11 some optional parameters.
00:18:13 So number of instances.
00:18:15 So the number of instances in our case is 32.
00:18:19 So number of class images.
00:18:20 As I said, the class images are used, to improve the accuracy, learning of your model.
00:18:28 It generates, random images based on the class label, the input you provided.
00:18:34 We have provided portrait photo of a man.
00:18:37 So this is a generic class.
00:18:39 Okay.
00:18:40 And, so these algorithm says that you should have number of instances multiplied by 12.
00:18:49 So 32 times 12, which is 384.
00:18:55 I am going to enter it in here like this.
00:18:59 Okay.
00:19:00 The sample batch size is related to training and you shouldn't change it.
00:19:04 It is an optimal value as selected by the author of this, Google colab.
00:19:10 Okay.
00:19:11 So number of steps.
00:19:12 Now the number of steps is telling the model that train this many times.
00:19:21 It is, related to AI models.
00:19:24 So it is number of instances multiplied by 80.
00:19:29 In our case, it is 2560 like this.
00:19:35 Okay.
00:19:36 We are not going to change save interval.
00:19:38 Okay.
00:19:39 There is warm up steps.
00:19:41 It is also related to model.
00:19:43 So the warm up steps should be number of max number of steps.
00:19:50 And it is divided by 10.
00:19:51 So also, it has to be an integer number.
00:19:55 So in our case, it is 256.
00:19:59 Okay.
00:20:01 Now we are completely ready.
00:20:04 we are not going to change resolution.
00:20:05 This is the maximum resolution that our model supports.
00:20:08 Okay.
00:20:09 We are using the fee, stable diffusion version 1.5, as can be seen here.
00:20:17 And it supports maximum 512 pixel by 512 pixel.
00:20:22 The trend base size is related to how many number of GPU you have.
00:20:26 Since we are on the free account, we have only one GPU, but if you get the paid account
00:20:33 of if we, or if you use another, cloud computing service, you could increase this.
00:20:40 I am hoping that, we won't get memory error because as you, as you increase these numbers,
00:20:47 it increases the memory usage of the graphic card.
00:20:51 And okay, now we did set everything and I am going to click, this button and the training
00:20:58 will start.
00:21:01 So it will, save our, model also into our folder that we have defined it, in, let me
00:21:15 see.
00:21:17 Okay.
00:21:18 Define it in here.
00:21:20 It will be in our Google drive folder, stable diffusion weights.
00:21:24 Okay.
00:21:25 Okay.
00:21:26 In here, once it is done.
00:21:29 So I won't be in need to retrain because training takes time.
00:21:35 Currently it is loading the necessary files and then it will start training.
00:21:40 okay.
00:21:41 This may take a while, depending up, depending on how many images you have, how many images
00:21:47 you have, how many max train steps you have, and all other parameters.
00:21:51 Okay.
00:21:53 Okay.
00:21:54 The training has been going on over one hour and two minutes, as you can see in the bottom
00:21:59 here, executing cell duration.
00:22:02 First, it has generated, the class images, as you can see, 100%, 384, 384.
00:22:11 So after that, it starts learning our portrait images.
00:22:16 Okay.
00:22:17 learning our model, you see, we have defined it, 25, 60 steps, 2,560.
00:22:24 And.
00:22:25 So in each step, it is modifying the weights, the values to learn our model.
00:22:36 You don't need to really understand this, but once this is completed, we will have our
00:22:41 model, ready.
00:22:44 Okay.
00:22:46 So the training has been completed as you can see steps 100%.
00:22:51 Now there are a few other things that we need to do first.
00:22:54 Let's give our, training and new name.
00:22:58 Okay.
00:23:00 Let's say SECourses.
00:23:04 Okay.
00:23:05 And then, we need to save our training data into our Gmail, folder, Google, Google drive
00:23:14 so that we can use it again without doing any, any other training.
00:23:20 So the total time of training took, I think, yeah, one hour and 38 minutes.
00:23:29 Okay.
00:23:30 so I'm going to give, the folder name.
00:23:34 I am copying from here, right, click and copy after selecting it.
00:23:38 And you see, I am pasting it here, and then I am going to click to save.
00:23:44 So it is saved.
00:23:46 Okay.
00:23:47 And it should appear in my drive in any moment.
00:23:53 Okay.
00:23:55 in here.
00:23:56 Yeah.
00:23:57 this is our okay.
00:24:01 Training data.
00:24:04 Okay.
00:24:05 Let's continue.
00:24:06 So there is also, this button, it will generate a grid of preview images from last saved weights.
00:24:14 Okay.
00:24:15 these images will be generated by the model and okay.
00:24:18 This is not very related, but yeah, it is somewhat okay.
00:24:26 You see, it is not very good, but with the prompts that we provide, I think it will be
00:24:32 better.
00:24:33 This totally depends on your data set.
00:24:36 The input images that you provide.
00:24:38 Okay.
00:24:40 Then we are going to click convert weights, to use in web UIs.
00:24:45 This is not necessary.
00:24:47 We don't need this.
00:24:48 Actually.
00:24:49 You can just skip this part.
00:24:51 Okay.
00:24:52 Now we are ready.
00:24:53 We have trained our model and we are ready to use it again later without training again.
00:25:01 So, now I will exit application and I will open it again so that you will know how to
00:25:08 open it again and just use it without retraining it unless you want to retrain.
00:25:15 If you can't obtain good results, then you can modify your, input data set.
00:25:23 And then, you can, this is the data set that I have used it.
00:25:30 You can re-train, retrain your data set and try to obtain better results.
00:25:34 Okay.
00:25:35 Now I'm going to exit and I will reopen application and we will start generating our, amazing
00:25:42 avatars.
00:25:43 Okay.
00:25:44 For exiting the application, I am going to click here and it will shut down.
00:25:51 It will restart actually.
00:25:54 Okay.
00:25:55 So we are back to zero.
00:25:56 I will close this tab.
00:25:59 Okay.
00:26:00 You see that I have closed all of the tops.
00:26:02 Now, we are going to start our fun-time.
00:26:06 So, you see, I have moved to my Google drive, which is where my, where our file is saved.
00:26:14 so I have double-clicked it, the name that I have given.
00:26:18 Okay.
00:26:19 First I need to connect, the virtual machine.
00:26:22 Okay.
00:26:23 We are connecting.
00:26:25 Okay.
00:26:26 We have connected.
00:26:27 We have started from, zero, but we, we have our trained model.
00:26:32 So we need to, install some of the scripts and other things again.
00:26:37 So let's first check whether we have a GPU.
00:26:39 Yes, we have let's install the requirements.
00:26:42 Okay.
00:26:43 Requirements have been installed in only 55 seconds.
00:26:46 As you can see here, let's log into hugging face with our token.
00:26:51 We don't need to generate it again.
00:26:53 Let's install Xformers.
00:26:55 It takes like 10 seconds to install.
00:26:58 So after we do the initial training, it is just so quick.
00:27:02 Okay.
00:27:03 And I think it's almost done.
00:27:05 Okay.
00:27:06 It took only 10 seconds.
00:27:08 Now let's settings and run.
00:27:11 So it will ask us to get permission for Google drive.
00:27:16 Okay.
00:27:18 So that our model can be read from our Google drive because we have saved our model there.
00:27:24 We can actually see it in here.
00:27:26 You see, there are files that are saved.
00:27:30 Okay.
00:27:31 It is done.
00:27:32 We don't do training again because we have done it already.
00:27:35 We can click this to set our parameters, but this is probably not necessary because it
00:27:40 is for training.
00:27:41 Okay.
00:27:42 I'm just skipping the parts where we do training.
00:27:45 Okay.
00:27:46 We need to specify the weights directory.
00:27:48 Okay.
00:27:49 Let's click to regenerate grid of preview images from the last saved weight.
00:27:53 So we can ensure that, our model is working properly.
00:27:59 Yes, it is generated.
00:28:01 Okay.
00:28:02 Now we are going to generate our new images.
00:28:04 This part is very important and you need to pay a really pay attention.
00:28:11 Okay.
00:28:12 Let's click start.
00:28:14 So it is going to load our model, with the parameters that are set.
00:28:20 You don't need to change any of these parameters.
00:28:23 They are pretty much optimal.
00:28:25 Okay.
00:28:26 We have an error somewhere.
00:28:27 Let me: check it.
00:28:29 Okay.
00:28:30 we need to give full path of directory.
00:28:33 So I am going to copy this.
00:28:36 You see it is in the settings and run folder, copy selection.
00:28:43 And, let's paste it into our here weights directory.
00:28:48 Maybe if I delete this, it should work first.
00:28:51 Let's try that way.
00:28:53 Okay.
00:28:54 Yes.
00:28:55 So it took that from the last saved one, but you can also specify different directories
00:28:59 if you save them like this.
00:29:02 Okay.
00:29:03 You see, okay.
00:29:04 I won't do it.
00:29:05 So let's run inference again.
00:29:09 Okay.
00:29:10 It is starting right now.
00:29:12 Okay.
00:29:13 Executing.
00:29:14 Okay.
00:29:15 It is, it has asked me to verify.
00:29:18 I'm not robot.
00:29:19 Yes, I did that.
00:29:21 Okay.
00:29:22 It took total two minutes to load our model.
00:29:24 So we have spent only three minutes to load our model after the initial training.
00:29:30 Now you see, there's a random seed.
00:29:33 This is for reproduce reproducibility.
00:29:35 If you want to generate same or similar, similar images, every time you use, you can save this
00:29:42 seed or you can change it.
00:29:44 Okay.
00:29:45 Now here, the tricky part, this system works with, text inputs.
00:29:51 So it is really crucial to give proper text inputs to generate images because the system
00:29:57 learned based on the inputs.
00:30:00 Okay.
00:30:01 So now I will show you what kind of inputs do you need?
00:30:05 And as a result of them, what kind of outputs you are going to get?
00:30:09 Okay.
00:30:10 I will explain in details and please pay attention to this part.
00:30:14 This part is the where we generate our images as we want.
00:30:19 Okay.
00:30:20 Okay.
00:30:21 So our first result is ready.
00:30:23 This is, a portrait of mine in a different style.
00:30:29 Now I will explain my input, so that you will understand what kind of input I have provided.
00:30:37 Yes.
00:30:38 That, this is in which style this is in rockstar game style.
00:30:43 It is similar to that, but of course not same exactly same, but what kind of input I have
00:30:49 given.
00:30:50 I have generated 10 images and this is the best one, best looking one.
00:30:55 Not always you are getting the very good ones.
00:30:58 So these are the, some other ones, as you can see, I can say they are best.
00:31:02 They are, this is also a good one.
00:31:05 If you ask me and yeah, these are the other ones.
00:31:09 Okay.
00:31:10 As you can see, not all of them are good.
00:31:12 So what kind of input I have provided?
00:31:14 I have provided keywords, face portrait of, and this is my keyword that I, set in the
00:31:23 beginning.
00:31:24 If you remember in here, here, let me show secourses and we also provided it in here.
00:31:33 Save sample prompt.
00:31:35 Okay.
00:31:37 And then, so I am asking AI to, provide me face portrait.
00:31:45 Then I am adding the other keywords that I want, the AI to use.
00:31:53 Okay.
00:31:54 The, the order of keywords are really important.
00:31:58 So it will first look for this, then it will look for this keyword, symmetric, symmetrical,
00:32:04 then detailed face, then insanely detailed.
00:32:08 This is all up to you.
00:32:09 How you give your input will affect your results significantly.
00:32:15 Then concept art trending on artstation, daily deviations, highly realistic, sharp, elegant.
00:32:23 Then I am adding by rockstar games to generate a similar style to rockstar games, then digital,
00:32:31 digital painting, and then looking into camera.
00:32:35 You can of course add more keywords here and make the AI try to generate, such images.
00:32:43 Then we have negative prompt.
00:32:46 So we are telling the AI model to avoid these kind of images: bad anatomy, BW, okay.
00:32:54 BW.
00:32:55 So this is black and white, black and white, but still, it is generating black and white
00:33:01 images, ugly tiling, poorly drawn hands, poorly drawn feet, poorly drawn face, out of frame,
00:33:09 extra limbs, disfigured, deformed body, out of frame, blurred, bad anatomy.
00:33:15 And, it goes on.
00:33:17 So in here you are writing your, keywords that the, that you want AI to avoid of, of
00:33:25 course.
00:33:26 okay.
00:33:27 So this is also important part.
00:33:28 You need to provide negative prompt to avoid such images.
00:33:33 Okay.
00:33:34 So number of samples tells AI to how many time, how many images it generate in one run.
00:33:40 So by the way, the run took about one minute and 33 seconds.
00:33:45 Also, if you see some message like this automatic saving, fail it, just click, show diff and
00:33:50 save your changes.
00:33:52 And okay.
00:33:53 We see all all changes are saved.
00:33:56 So go guidance scale.
00:33:57 What is this?
00:33:59 This means that how much AI should, depend on our input and how much it should use its,
00:34:09 itself inner mechanism.
00:34:11 So 7.5 is a sweet spot that it will use your input and it will use its own, heuristics.
00:34:19 Okay.
00:34:20 it is a highly complex thing.
00:34:24 So if you want AI to use your input more and you are giving it a more detailed keywords,
00:34:31 then you can increase this.
00:34:34 Okay.
00:34:35 So if you increase this to, for example, 12, it will generate a different image, more likely
00:34:41 to your, more depending on your input.
00:34:45 But the 7.5 is a sweet spot found by the, testers and number of inference steps.
00:34:53 This tells AI to how many steps, it should use to generate your image.
00:34:59 This is also a sweet number 50 found by the, testers and developers.
00:35:05 You can play with these numbers.
00:35:07 Okay.
00:35:08 I have double click it and it opened the source code.
00:35:10 When I double click here, it will return their bank.
00:35:14 So you can reduce this to, or you can increase this and see the results.
00:35:18 It's all about experimentation and height and width.
00:35:22 This defines the dimensions of each image it will generate.
00:35:26 This is the maximum supported, dimension natively by our model, which is a stable diffusion
00:35:35 1.5.
00:35:36 There is also stable diffusion 2.1, which supports, 768 pixels, but it requires more,
00:35:46 hard drive, more, GPU RAM.
00:35:50 Therefore it is not possible to run it on our Google collab for free.
00:35:55 You see, we are already currently using maximum available GPU RAM.
00:36:00 So if you want to use the next level, model, the newest model, then you need to upgrade
00:36:11 your service, with subscribing from here.
00:36:16 It is paid of course, or using another, stronger service İf you can find, or if you have a
00:36:24 stronger GPU, you can also run all of this in your computer.
00:36:29 So we are using the maximum possible height and width.
00:36:33 So when I click open image in new tab, it will open the image in native resolution in
00:36:38 new tab.
00:36:39 I can just right click and save image as, and save it on my computer.
00:36:43 Okay.
00:36:44 Okay.
00:36:46 Here now I have done another generation with guidance scale 10.
00:36:51 So now it is depending on my input more, as you can see, this is how the new images looks
00:36:58 like.
00:36:59 Okay.
00:37:01 In rockstar rockstar style.
00:37:03 All right.
00:37:06 But it is still generating black and white.
00:37:08 So we probably need to modify our input in a way that it won't generate, black and white.
00:37:18 Okay.
00:37:20 now we have another result.
00:37:22 I have made few changes.
00:37:24 Let me show them to you.
00:37:25 First, if you want to see, the bigger output, just click here to close resources.
00:37:33 And then, let's just move to the prompt.
00:37:37 So what did I change?
00:37:39 First of all, I have added colored keyword here.
00:37:42 Since portraits are tending to be black and black and white.
00:37:46 We are telling AI model to generate colored images for us.
00:37:53 Then I have changed our, let's say influenced model, influenced style with a Quantic Dream.
00:38:02 This is another, I think a studio or something.
00:38:07 So, and also, I have added some other keywords such as masterpiece, ultra detailed, ultra
00:38:14 realistic.
00:38:15 So this is totally up to you and you can search for keywords for, stable diffusion on the
00:38:23 internet.
00:38:24 There are a lot of resources, websites and other things that you can get ideas.
00:38:28 Okay.
00:38:29 Let's check.
00:38:30 Let's see the, generated outputs.
00:38:32 I think this is a really cool one.
00:38:34 This is another one, but the eyes are not perfect.
00:38:36 This is not related to me actually.
00:38:39 This is also looking cool.
00:38:41 This is, this is, I think the related to their style.
00:38:46 This is also something cool.
00:38:48 Oh, this is also cool one.
00:38:51 I think we can also set the eye color if you want.
00:38:55 And also this is a cool one as well.
00:38:58 Now I will show you different styles from now on, with not much changing the input and
00:39:05 let's see what kind of outputs we are going to get.
00:39:09 Okay.
00:39:10 Now I have here another good on.
00:39:13 for this one, I have added by production I.G and digital 2d character design.
00:39:21 Okay.
00:39:22 So with adding and removing keywords, you can get, different outputs and you can pick
00:39:30 the ones that are best to you.
00:39:33 As we add digital three, 2d and character design, it becomes more like a CGI product.
00:39:41 So, whatever the output you want, you need to add those keywords or, remove those keywords.
00:39:50 Okay.
00:39:51 Here's several other ones.
00:39:52 This time I have changed the style to another one.
00:39:55 By the way, this style, influencing is a debated topic in the community right now.
00:40:04 Some says that you shouldn't, influence model with the certain, styles.
00:40:10 And some says you can do because it is like teaching a human a style because styles can't
00:40:16 be copyrighted.
00:40:18 So this is a controversial and debated topic, just letting you know.
00:40:23 So here there are several good ones that I have generated.
00:40:27 For example, this one, and this one.
00:40:32 Okay.
00:40:33 This is also a different style.
00:40:36 Okay.
00:40:37 This is also looking cool.
00:40:38 If you ask me and yeah, some other ones still black and white.
00:40:44 Okay.
00:40:45 Okay.
00:40:46 Here's several other ones like this or this or this.
00:40:53 Okay.
00:40:54 Or this one.
00:40:55 Okay.
00:40:56 This looks also cool.
00:40:58 So, for this, what, prompt I did use, I have used again the first prompt is our,training,
00:41:06 then colored, symmetrical, detailed face and by another artist style, masterpiece, ultra
00:41:18 detailed.
00:41:19 This time I have removed digital 3d because it was making a more like digital 3d output
00:41:26 and the rest is like this.
00:41:27 Okay.
00:41:28 Okay.
00:41:29 Here we have now another output like this.
00:41:33 Let me show you each one of them.
00:41:36 Okay.
00:41:37 This is a weird one.
00:41:41 Okay.
00:41:42 So this time, I have given a prompt like first face of portrait of secourses.
00:41:48 As usual.
00:41:49 This is the keyword we have trained our model on colored, symmetrical, detailed face.
00:41:55 And this time I have influenced the AI model with Magali Villeneuve and masterpiece.
00:42:04 Ultra detailed.
00:42:06 I have removed the digital 3d keyword because it was having a lot of effect on the output
00:42:13 and the rest is like this.
00:42:14 Okay.
00:42:15 Some more interesting results.
00:42:16 Now I am more like an Asian because I have now provided Koyoharu Gotouge as a style,
00:42:26 as an influencing style.
00:42:28 You see, I am like an Asian or like here or like here.
00:42:36 Okay.
00:42:37 Now we are seeing DreamWorks style, similar style, as you can see, I'm not sure if this
00:42:45 is really related to DreamWorks, but here you see some different outputs.
00:42:50 This is more like an CGI image that you can see in games or movies.
00:42:58 And yes.
00:42:59 Okay.
00:43:00 Here, another style by Edwin Catmull, as you can see.
00:43:06 So you see, we train different styles.
00:43:09 You will get different outputs and whichever one is most useful for you.
00:43:15 You can just use it.
00:43:17 Okay.
00:43:18 Now we are going to see some interesting results.
00:43:21 This time.
00:43:22 I have combined three art styles, which are greg rutkowski, wlop and artgem.
00:43:31 These are one of the most popular artists artists they are being used in the stable
00:43:39 diffusion community.
00:43:40 And let's see the results from close look up.
00:43:46 Okay.
00:43:49 Okay.
00:43:52 You can see.
00:43:56 So with combining different styles, you can obtain, very different results.
00:44:04 It's possible.
00:44:05 Okay.
00:44:06 In this example, I have removed the artist influence, the style influence.
00:44:11 Now it is totally up to generic keywords that we use.
00:44:16 Okay.
00:44:17 As you can see like this or like this, or like this very variety, variety of, very different,
00:44:28 styles, as you can see, it has generated.
00:44:31 So you can give 100 output if your VRAM is enough and you can get 100 output in a single
00:44:41 command.
00:44:42 Now, we can also, change our original output with like, with long hair.
00:44:52 Okay.
00:44:53 Okay.
00:44:54 Now we have some interesting results.
00:44:56 This is not very like me.
00:44:58 Yeah, this is very like me actually the, my face and it added a blue hair.
00:45:05 I think we can also define the hair color or the eye color.
00:45:09 I will do that.
00:45:10 This is somewhat like me.
00:45:12 Okay.
00:45:13 This is also an interesting one.
00:45:15 Wow.
00:45:16 This is really, really different one.
00:45:18 This is also kind of similar.
00:45:23 And yes, this one.
00:45:24 So let's also provide hair color and, black long hair, and brown eyes.
00:45:36 Okay.
00:45:38 So it will be more like myself.
00:45:40 Okay.
00:45:41 Okay.
00:45:42 Now we have black hair as you can see, but the colors are not very good.
00:45:50 Okay.
00:45:51 This is more like black hair and brown eyes.
00:45:54 Correct.
00:45:55 This is also like that.
00:45:58 The eye color is still wrong.
00:46:01 Yeah.
00:46:02 Here as well.
00:46:03 Oh, this also looks cool.
00:46:06 If you ask me, yeah, pretty good one.
00:46:08 I think I want to save this one, into downloads folder.
00:46:15 Yes.
00:46:17 Okay.
00:46:18 Yes.
00:46:19 So let's also add some other things.
00:46:21 For example, okay.
00:46:23 I'm going to, add in an armor.
00:46:29 Okay.
00:46:30 Let's see what kind of output we are going to get.
00:46:34 Okay.
00:46:35 With armor addition in our keywords.
00:46:36 Now this is not very like me.
00:46:39 This is kind of okay.
00:46:42 okay.
00:46:43 And in here you see, this is also not like me.
00:46:47 This is kind of like me.
00:46:50 Yeah.
00:46:51 My face is not anymore.
00:46:53 Very like, okay.
00:46:55 So perhaps we can reduce number of keywords such as I'm going to just delete all of these
00:47:03 and let's add with wearing an armor.
00:47:13 Okay.
00:47:14 Okay.
00:47:16 The only, the first image generated is similar to me.
00:47:20 Okay.
00:47:21 I have heavily modified the prompt.
00:47:23 Image of secourses wearing a full body armor.
00:47:28 So let's see the results.
00:47:29 It's like this or like this.
00:47:32 This is maybe the most closest one, but the eyes are still not very good.
00:47:39 This is like this.
00:47:40 Oh, this is also cool one.
00:47:42 Actually only the eyes are not matching the eye color.
00:47:45 I will save this as well.
00:47:48 Okay.
00:47:49 This is not related at the eye is also a problem here.
00:47:54 Otherwise it is overally good.
00:47:57 This is also decent.
00:48:01 Okay.
00:48:02 And this was a decent one.
00:48:04 Okay.
00:48:05 Let's modify it as a wearing...
00:50:42 Okay now I will do some cherry picking.
00:51:23 So the cherry picking means that you are picking only the best outputs and so I will only show
00:51:32 the best ones that I have obtained.
00:51:34 With AI generation.
00:51:37 It is all about how many times you try.
00:51:40 Because each time you will get different results and some of them will be much better than
00:51:46 some of others.
00:51:47 So with sufficient amount of trying you can obtain the best magic avatar that you are
00:51:56 looking for to put up your profile to put up your in your social media or whatever you
00:52:03 want to use for.
00:52:04 All right, let's start.
00:52:07 Ah, this looks very cool and this looks cool too...
00:52:44 Okay, this is kind of different than others.
00:53:18 So you see I have removed many of the keywords and added unreal engine, highly detailed,
00:53:24 artgem, digital illustration, woo tooth, studio ghibli, deviantart, sharp focus, artstation,
00:53:30 by alexis vinogradov, bakery sweets and emerald eyes and such things so the results are like
00:53:39 this.
00:53:40 As you can see, it is totally up to you how what kind of prompt that you are going to
00:53:49 provide and based on that you will get the output.
00:53:56 Okay this time I have provided anime painting and this is what I got.
00:54:06 Okay, it is pretty cool actually.
00:54:09 Okay, another cool one.
00:54:12 It's only one out of ten generation.
00:54:14 One of them is decent.
00:54:17 So you need to generate a lot of images to get good ones.
00:54:25 Okay, I will show you now.
00:54:28 Another cool thing that you can do.
00:54:29 You can generate hundreds or thousands of images with just one click and then pick the
00:54:36 best ones you like among them.
00:54:38 Okay, so as you can see: I have generated hundreds of images.
00:54:41 I have picked about 200 of them to show you.
00:54:45 How did I do this?
00:54:47 For doing this I have modified the code a little bit.
00:54:49 I have defined its prompt list like this.
00:54:53 By the way, I will upload this code into our patreon page and I hope that you will subscribe
00:55:00 there and support us.
00:55:04 So I have modified the page a little bit to iterate over and over to generate hundreds
00:55:12 of images.
00:55:13 Then I have saved them in my Google Drive in a folder called as anime.
00:55:20 I have downloaded them as usual.
00:55:23 Also, in this page, you can delete these outputs by clicking the X button so they won't take
00:55:31 your space.
00:55:33 The output messages.
00:55:35 That's another thing that you can do.
00:55:38 And since I have used the Google Colab a lot now Google is not allowing me anymore to do
00:55:44 until for a certain time to use its GPU service.
00:55:50 But it is not important.
00:55:52 I have turned those images into a clip now I will show you those images as a clip.
00:56:03 These images by original 512 to 512.
00:56:09 Therefore, when we make them as a full screen, their quality a little bit decreases.
00:56:15 But when you use them in your profile page on your social media, they would still look
00:56:23 very good in those dimensions.
00:56:28 There are also upscaling techniques of stable diffusion which could help you to upscale
00:56:35 your images, but it is another topic I won't cover it today.
00:56:40 Some of the images are not very much resembling me and some of them are very like me.
00:56:46 So the key point as you see is generating more and more images and picking the ones
00:56:52 that you like and also using different number of different keywords to influence the AI
00:57:04 model to influence the style of the AI model.
00:57:10 With this iteration batch technique that I will I have shown you can type as many as
00:57:18 different inputs and you can train as many as times you want.
00:57:23 You can generate as many as times images you want.
00:57:26 However, Google may block you after a while so you can, let's say generate 1,000 images
00:57:35 each day, maybe more.
00:57:37 It needs testing.
00:57:39 Okay, so this is all about it.
00:57:44 It is clear that advancements in image generation and manipulation technology are coming at
00:57:50 a rapid pace.
00:57:51 In recent months we have seen a flurry of new models release it and it is likely that
00:57:56 even better ones will be introduced in the coming months.
00:57:59 And it will be very fast.
00:58:01 It is up to us to use these technologies responsibly and for good.
00:58:05 This is really important.
00:58:06 However, it is important for everyone to be aware that AI can be used to manipulate images
00:58:12 and videos to a realistic level.
00:58:14 Thank you for watching.
00:58:16 If you have enjoyed the video, please like and share it with others to raise awareness
00:58:21 about this technology so that more people know that the images and the videos can be
00:58:26 manipulated very easily, the more people will become immune to the damages that bad actors
00:58:34 bad people can cause.
00:58:36 Additionally, please consider subscribing and supporting us on patreon for the production
00:58:42 of future high quality content.
00:58:44 You can access our patreon page in our page from just clicking the right top support patreon
00:58:51 button.
00:58:52 It will open our page I am hoping that you will support us there.
00:58:57 Thank you very much!
00:58:59 hopefully see you in an another in the next video.
Beta Was this translation helpful? Give feedback.
All reactions