Unleash the Power of SDXL Local LORA Training: Step-By-Step Guide for Creating Endless AI Images of Yourself

Written by All Your Tech AI - January 08, 2024


Welcome to the fascinating world of SDXL Local LORA training! Have you ever wondered how generative AI models can create stunning images just by being trained? Well, today I'm going to introduce you to the incredible power of SDXL Local LORA training and show you how to create endless AI images of yourself or anyone else. Prepare to be amazed!

The Power of SDXL Local LORA Training

Stability AI recently released Stable Diffusion XL (SDXL), a powerful generative AI model that can generate stunning images of just about anything. It's an amazing tool that allows you to train your own LORA (Low Rank Adaptation) file, which instructs Stable Diffusion on how an object, person, or anything else should look.

You might be wondering, where can I find pre-trained LORAs? Well, you're in luck! Civid AI offers hundreds of pre-trained LORAs for everything from animals to people and even not safe for work content. But what if you want to train your own LORA to create images of yourself or anyone else? Don't worry, it's easier than you might think.

Getting Started with KyatSS

To get started, you're going to need a gaming PC and a piece of software called KyatSS. KyatSS provides a user interface that allows you to train and set up parameters for your own models. If you have a Windows machine, make sure you have Python and Visual Studio installed. If not, check out one of my other tutorial videos that will guide you through the installation process.

Once you've installed KyatSS, open your command prompt and navigate to the directory where you want to install it. Copy the "git clone" command from the KyatSS installation directory, and run it in your command prompt. This will clone the repository to a directory called "kyatss". Change to the KyatSS directory and run the "setup.bat" file. Select option one for a new installation, and sit back while the installation process completes.

After the installation, you'll be asked about your computer environment. Select "this machine" if you have a multi-CPU or multi-GPU system. Next, choose your GPU settings, such as using torch Dynamo for script optimization and specifying which GPUs to use for training. If you have an RTX 30 or 40 series GPU, select bf16 for better performance. Otherwise, choose fp16. Once you've completed these steps, you're ready to launch KyatSS.

Collecting and Preparing Training Images

Before you start training your own model, you'll need to collect a variety of high-quality images. It's important to have different variations in lighting, facial expression, and backgrounds, as this will make your model more flexible in the end. You can search for high-resolution images on Google or take your own photos. Aim for 10-20 images to start with, although you can train a decent model with as few as 10 images.

Once you have your training images, there's no need to crop them to a fixed size like with other generative AI models. With Stable Diffusion XL training, cropping is unnecessary and can even result in lower-quality images. So, keep your images in their original size and resolution for better results.

Training Your LORA Model

Now it's time to train your LORA model using KyatSS. Open the "LORA" tab in KyatSS and follow the step-by-step instructions:

Step 1: Folder Preparation

Under the "Tools" section, click on "Dream Booth LORA folder preparation". Here, you'll need to fill out some important information:

  • Instance Prompt: This is where most people make a common mistake. Instead of using a random string of characters, it's best to use the name of a well-known celebrity or another object that has a lot of images in Stable Diffusion XL. This provides guidance parameters for your model. For example, if you want to train a model of yourself, use another celebrity's name as the instance prompt.
  • Class Prompt: Set the class prompt for the images you're training. For example, if you're training images of men, set the class prompt to "man".
  • Training Image Directory: Set the directory where you saved all your training images.
  • Regularization Images: These are additional high-resolution images that represent the class of images you're training. Include hundreds of varied images related to your training class.
  • Repeats: Set the number of times each image should be trained in the model. A value of 20 is recommended.
  • Final Destination Training Directory: Choose the directory where your output data and LORA files will be saved.

Once you've filled out the necessary information, click the button to copy it to the folders tab.

Step 2: Training and Folders

Go to the "Training and Folders" section in KyatSS. Here, most of the fields should already be pre-filled from the previous step. Make sure to update the model output name to match your preferences. The model output name will help you identify the subject of your trained LORA files.

Step 3: Utilities and Captioning

Now, head over to the "Utilities" tab and click on "blip captioning". This feature uses artificial intelligence to scan your training images and create a text file with associated keywords and captions. It helps Stable Diffusion XL understand the context and keywords of each image.

  • Source Images Directory: Select the directory where your training images are stored.
  • File Extension: Choose ".txt" for the caption file.
  • Prefix to Add: Use the celebrity name or other identifier you chose earlier as the prefix for the caption file.

Click on "Caption Images" and let the AI process your images and generate captions. Take a few minutes to review and add any additional context to the captions if necessary. This will enhance the training process and give your model more detail and information.

Step 4: Training Parameters

Under the "MEY" tab, you'll find the "Laura Training Parameters" section. Here, you can tweak various settings to optimize your training process. If you're using my config file, most of the parameters will already be set up for you.

  • Train Batch Size: You can leave this at 1 for training a single image at a time.
  • Epoch: Set this to 10 for training a total of 10x the number of source images. This allows for better model refinement, but you can adjust it based on your preferences and available resources.
  • Save Every n Epoch: It's useful to save every epoch to have multiple LORA files for comparison.
  • Learning Rate: Set this to 0.00003 for good results, but feel free to experiment with different values.
  • Max Resolution: The default resolution is 124x124, but if you have limited VRAM, you can reduce it for efficient training.
  • Network Rank: Adjust this parameter to balance between detail retention and LORA file size. Higher values retain more detail but result in larger files.

Make sure to check the additional settings, such as gradient checkpointing and cross-attention. Once you've adjusted the parameters to your liking, click on "Start Training" and let KyatSS do its magic. Sit back and relax while your model is being trained. Note that the training time will depend on the number of training images and your system's specifications.

Generating Images with Stable Diffusion XL

After the training process is complete, it's time to generate some AI images using Stable Diffusion XL. Load up your favorite image generator software, such as Automatic 1111, and follow these steps:

  • Select Stable Diffusion XL Base 1.0: Choose the appropriate option in your image generator software.
  • Set the Prompt: Find an image that you like on Civid AI and paste it into the prompt. Then, add your LORA files to the prompt by selecting them and copying them. Make sure to keep the keyword trigger in your prompt.
  • Adjust Sampling Steps: Increase the sampling steps to around 30 for better image generation results.
  • Set the Resolution: Make sure the resolution is set to 124x124 for optimal image quality.
  • Click on Generate: Watch as the AI generates breathtaking AI images based on your prompt and LORA files.

Now, here comes the fun part. To compare the results of all 10 of your LORA files, select the "XYZ Plot" script and paste your LORA files into the X values. Copy the seed value from a generated image and set it in the seed box. Click on "Generate" to see all the images side by side. This allows you to compare the different LORA files and find the one that best suits your needs.

Congratulations! You've unlocked the power of SDXL Local LORA training and created endless AI images of yourself or anyone else. The possibilities are truly limitless!

Conclusion

SDXL Local LORA training is a game-changer in the world of generative AI. With the right tools and training, you can unleash your creativity and create stunning AI images that are tailored to your preferences. Whether you're a technical expert or just a curious individual, KyatSS and Stable Diffusion XL offer you the opportunity to dive into the world of AI image generation and explore its endless possibilities.

FAQs

  • Q: How many training images do I need?

    A: You can start with as few as 10 images, but more images provide better training results. Aim for 10-20 high-quality images to create a decent model.

  • Q: Can I use someone else's images for training?

    A: It's best to use your own images or images that you have the rights to. This ensures that your model represents your desired subject accurately.

  • Q: How do I choose the best LORA file?

    A: The best LORA file depends on your preferences. You can find a balance between flexibility and precision by choosing a file that produces high-quality images with some artistic freedom.

  • Q: Can I train models for objects other than people?

    A: Absolutely! You can train models for animals, objects, or anything you can imagine. Just collect the appropriate images and follow the same training process.

  • Q: What can I do with the AI images I generate?

    A: The possibilities are endless! You can use the AI images for creative projects, social media, artwork, or simply to explore the capabilities of generative AI. Let your imagination run wild!

  1. In today's data-driven world, the ability to extract and utilize information from the web is a crucial skill. Whether you're a data scientist, a business analyst, or just someone looking to gather ins

  2. If you're looking for a unique and underrated side hustle that can potentially earn you over $1,370 per day, then you're in for a treat. This method leverages the power of Canva's AI tools to create s

  3. Building a full-stack application without any coding knowledge and for free might sound too good to be true, but with the right tools, it's entirely possible. In this article, we'll guide you through

  4. In the ever-evolving landscape of artificial intelligence, new models and tools frequently emerge, each promising to revolutionize how we interact with technology. The latest entrant generating buzz i

  5. Is Journalist AI the ultimate AI writing tool you've been searching for? In this article, we delve into an in-depth review of Journalist AI, exploring its features, advantages, and potential drawbacks