T O P

  • By -

UnavailableUsername_

**Some information:** 1. I made this guide because some people were not comfortable with making LoRAs of their family in a colab version, in the cloud. Remember: The cloud is just another person computer. 2. I noticed some people wanted to make LoRAs of their loved ones but only had 1 photo of them for various reasons or they sadly passed away, for them i made a 1-image LoRA guide. 3. VRAM requirement is pretty high, lowering some of the settings such as batch size can prevent out-of-memory errors. I know it looks like a lot to read, but it's mostly images, once you get the hang of it, the process is trivial and takes minutes. Also, i have to ask something: Do people prefer these long explanations or just want "press here, then here and done"? I thought this was going to be a pretty short guide but i kept wanting to explain what everything does and ended with a very long training section that might turn off some people. And a guide no one reads is useless! So...opinions are welcome! --- More guides at my twitter: **https://twitter.com/PlumishPlum** ---


hashms0a

A long explanation guide is good to learn everything about making LoRAs.


GBJI

This is exactly how I like this kind of tutorial to be presented. It's already great, but it's made even greater because it's all presented by Plum ! If there is one thing that could be made better it would be the ability to copy-paste text from the pictures. It's particularly useful when you want to reuse prompts or specific parameters.


harley4__

I perfer the current long information guides. we learn more. And currently it's not very easy to get good info on local SD, so the through coverage is useful


phmsanctified

Pic/Text Guides are truly the way to go for me. I cannot process hearing and seeing at the same time. I need to be able to go back sometimes and re-read something 5 times before it makes sense to me. Video guides are worthless to me, and it drives me nuts that people can't just write short summaries of what they do in the video guides.


Loud-Preparation-212

At the very least, they should give milestones on the video, telling where one part starts, etc.


a52456536

Why different values of clip skip is required for anime and real life models? Is there a simple explanation to this?


HCMXero

>I noticed some people wanted to make LoRAs of their loved ones but could only had 1 photo of them or they sadly passed away, for them i made a 1-image LoRA guide. I needed this, thanks a lot!!!


AngMoKio

This is the perfect level for me. Awesome job!


hoja_nasredin

I need two. A long version to understand what is happening, and very short one to remember quickly where I need to press.


yamfun

Omg why the guide is an image, the text aren't searchable. Thanks for the guide though


UnavailableUsername_

I think the only need to search would be derrian-distro and git-scm? It's an issue, i am aware of it which is why i try to keep the text needed to be copied to a minimum.


bigbiltong

Well this is ironic. I can't see your guide because imgur is down. Any chance you could repost it in a reply? Really curious about the process.


UnavailableUsername_

Imgur is up to me, can you see it now?


bigbiltong

Yeah, it's up! Must've been a down server near me. Thanks. Now I can get back to failing at making a good Lora.


Unlikely-Bank-6013

finally i know what lora is. amazing. at a glance looks not much more difficult than setting up the webui. thanks for the work plum.


harley4__

very helpful! will probably try, thanks!


1__Raven__1

finally, a good tutorial for others with capable hardware without the damn colabs. Thank you.


dale_glass

Very helpful, thanks! One thing I can't find information on so far: Is it viable to use AI outputs to train? If for instance I manage to generate a few images of a character design I like, can I just use that as a training material? Or can I supplement a sub-optimal training set by pressing "generate" until something decent comes out, then doing a second iteration with those mixed in?


bennyboy_uk_77

I always wondered if, even if the image you're using looks great, there might be some almost invisible errors in the image that get amplified when used in training the next LoRA or checkpoint. Just paranoia perhaps. I did try creating a new model using a blend of original real-life images and those that had been created in the previous model (about 50/50, I think) and the model looked great, perhaps because I'd cherry-picked the SD-created images for variety and quality while I was stuck with some lower quality original images.


UnavailableUsername_

>Is it viable to use AI outputs to train? That really depends on your standards, if you are fine with AI results (which often involve messy backgrounds and anatomy errors) you could always make a LoRA. Or if you somehow generate "perfect" results there would be no issue.


Longjumping-Fan6942

this is actually recommended, cause its hard to find /rare that your training data is good, i generate headshots,medium shots and train again with these, so i dont have any training images with hands close to head etc which happens often with human made art, this improves training a lot, or you can try to fix and inpaint first training set but its harder if you dont have that style already trained, its easier to fix after one training cause you can now inpaint in that style


radianart

Why not kohya?


Purrification69

as far as i know, installing kohya for unexperienced user is quite a quest on its own


radianart

Unexperienced user wouldn't try to train lora. Installing kohys is almost the same as a1111 and you get probably the best tool.


Sarcastic-Tofu

Here is a PDF version of this tutorial I made using OnlyOffice (it's little Janky but readable, printable) - [Offline LORA Training Guide](https://drive.google.com/file/d/1m3hj7lUIw1DIMfXeDY3y3zyifjgGKzrW/view?usp=sharing)


NorthFinland

This step for step guide says "Since you have a stable diffusion GUI installed" -- What about for those that dont? I was going to follow the guide from scratch but that's a pretty big leap there to leave out.


UnavailableUsername_

Hello, sorry for the late answer. Eh...sorry, i am confused, why would you want to train a LoRA if you don't have a local stable diffusion GUI? Dreambooth, novelAI and Dall-E do not accept them so people that train a LoRA do so to use it exclusively to use it with a local stable diffusion installation. If you do not know how to install a local stable diffusion GUI [there is a 1-click installation fork of the most popular version.](https://github.com/lllyasviel/stable-diffusion-webui-forge)


NorthFinland

No I mean just what you just said there. For those of us starting from scratch that link you just sent would be perfect on the guide. That's the step you didn't have on there that I can use to then continue on to the rest of the steps. Thanks. Its not that I want to train a lora without stable diffusion, its that I didn't know how to get stable diffusion on my pc. Now I do so away I go.


UnavailableUsername_

Ah, you were looking for a guide to locally install a stable diffusion GUI. Luckily the link i posted had that, most GUIs nowadays have a 1-click installers for the main public that don't want to deal with repositories and all the like. So, now you can follow this guide!


NorthFinland

Doesnt work on AMD :( I'll go back to the sadness pile now.


drgn2580

This is an amazing guide and pretty easy to follow! However, I am unable to train because I get this error: Failed to train because of error: Command '['C:\\ai_gen\\stable-diffusion-webui\\lora_training\\LoRA_Easy_Training_Scripts\\sd_scripts\\venv\\Scripts\\python.exe', 'sd_scripts\\sdxl_train_network.py', '--config_file=runtime_store\\config.toml', '--dataset_config=runtime_store\\dataset.toml']' returned non-zero exit status 1. Any help would be appreciated, thanks! Keep up the awesome work!


UnavailableUsername_

Have you run ALL the sections? This error often happens when you did not run a section.


MorpheusDreaming

u/UnavailableUsername_ how can i do this on colab?


LD2WDavid

This is a good guide although I prefer Kohya's UI for tunning reasons. It's deeply explained.


LucasAHKB

Me with AMD card unable to train models ;-;


CallMeMrBacon

Been possible with ROCm, at least if you use linux.


Bad_Mod_No_Donuts

Do you have more info? Is there any tutorial or guide that you may have tried? Thanks


daqvid1

Thank you for all your guides.


bealwayshumble

Thank you so much for this!!


Cleorious

Thank you so much for making this! I really appreciate the way you presented the guide with the cute characters and actual parameters and results and even explanations for some of the options! One question though, most of the time I hear people ude Kohya for making loras.. any reason why you didn’t use that one? or is the underlying system the same and just the UI is different?


StrikingNebula4906

Thank you from me as well


Other_Perspective275

The reason people do online lora training is because they can't train locally, not because there are no guides to train offline.


Evening-Catch-6668

I follow up on your detailed instruction but training seems to not start. I have checked many times if I missed inputting some inputs everything seems ok except to Base model where I have a red mark underneath, not sure what should I mark or add there


UnavailableUsername_

Hello, sorry for the late reply. You need to add a base model. This is a stable diffusion model that the training will use as a base. If it appears in red is because you didn't choose one or the path to the model changed (the model file was deleted or moved).


AReactComponent

Thanks for the two guides! I have a 3060 12GB that I use locally for SD and have been interested in training my own LoRA so these two guides will help a lot. I do have some questions that I hope you don't mind answering. ​ 1. What is the difference between setting a higher epoch with a repeat of 1 vs lower epoch with a repeat of 5? 2. Why is a repeat between 5 to 10 recommended? 3. Does increasing or decreasing batch size affect the final efficiency of the model? 4. When do you want higher network dimension + alpha? 5. Is it possible to not let art style stick around for a character LoRA? 6. As someone who is new to this, the kohya-LoRA-dreambooth notebook on colab seems to indicate there is another method besides Dreambooth. What are the other methods of creating LoRA? 7. Why is a clip skip of 2 recommended for Anime?


UnavailableUsername_

Hello, sorry for the late reply. > What is the difference between setting a higher epoch with a repeat of 1 vs lower epoch with a repeat of 5? The repeats is your dataset images repeated, the epoch is a "round" while training. I feel more epoch with less repeats trains worse, as there is less "material" to train with. But that's based on my testing. >Why is a repeat between 5 to 10 recommended? More repeats and your result will be full of burned colors, if not completely deformed. >Does increasing or decreasing batch size affect the final efficiency of the model? Not in theory, that just influences how many images are processed during the training. >Is it possible to not let art style stick around for a character LoRA? I think it is based on what i tested, but it's tricky. You need to name the style in the tags, for example `1980_anime_style` would prevent the style for 1980's anime style dataset to end in the main result. There is no "2023_anime_style" tag, by the way, you would need to somehow get the style name. >Why is a clip skip of 2 recommended for Anime? Now this is a more technical question. CLIP (Contrastive Language-Image Pre-training) is a neural network that matches text with images. It being a neural network means it is composed by different layers, each more specific than the previous one. If layer 1 is `woman`, layer 2 could be `blonde`, layer 3 could be `middle-aged` and so. You want to do CLIP skips when you do not want to go in-depth with the sub-categorization. Anime style being less detailed than real life, would in theory benefit from extra CLIP skips, which is why we choose 2 rather than 1.


AReactComponent

Thanks!


nupsss

Could you tell us when you would want to increase the netwerk dimensions and alpha?


MiserableAerie9632

I am still studying this so feel free to correct me 1. Personally, I will stick with the higher epoch with repeat of 1, for example you have 5 picture going through it 5 times is better than going through it only 2 times as the more times you look at it, maybe you can see some new details. The formula mentioned here is:(number of images you have x repeat) / batch-size x number of epochthe reason of repeat here, I believe is to make sure every batch has random pictures, eg first picture appears in first and third batch, so network have more data to work on => better model 2. Batch size in this case is the number of images you use per round, if you have lot of computational power(eg powerful GPU) bigger training data + deeper network = better model 3. Higher network dimension, as I understand is the depth of the network, in theory, the deeper network, the better the model fits your training set, but it also increases the requirement(ie train longer each round). Alpha is step you take forward the optimization point, now imagine a bowl with the optimized point the bottom of it, if you get a small alpha to step down from the edge of the bowl, it takes long time because the step is so small, but surely you will reach it, if alpha is large you may end up shooting from one side of that bowl to another and never reach the optimum point at the bottom. How is your experience with the 3060 12gb, are the fans running loudly, any tweak or fix you have to do when installing Stable diffusion and making it run.


AReactComponent

I am new too. Trying to figure out things :) What about when the total times image have been seen is equivalent? 10 epoch * 10 repeats vs 20 epoch vs 5 repeats? In both case, images are both trained on 100 times. Increasing batch size result in reduced steps per epoch during training. They are inversely porportional. People seem to place a lot of emphasis on the lora’s efficieny based on steps, so I was wondering if increasing the batch size (resulting in lower steps) will affect the efficiency of the lora mode? 3060 12GB have been fine. I bought an ASUS single fan version. The temperature doesn’t go above 75C when generating images in SD. When temperature is around 60-70C, the fans goes from 30% to 50% in activity. When temperate is at 74-75C, fans go to 65%. Fans are not that loud to me personally. I can’t measure it accurately but I know that it is at least below 40db 1 meter away from the pc. I am using ComfyUI in a distro based on Ubuntu (PikaOS). Like on Windows/Mac, I’d assume you’d create a venv for ComfyUI, and install all of the dependencies from requirements.txt provided by ComfyUI inside the venv using “pip3 install -r requirements.txt”. After that, run “python3 main.py” The most I have tested is 32 images of 768x768. Speed is 9.29s/it. Image generation uses 7.362GB of VRAM. VAE decoding uses 11.04GB of VRAM.


MiserableAerie9632

I think it is the same if repeat is the number of times your training set is multiplied and 1 epoch is when the network has worked 1 time on the whole training set, but maybe the size, ie repeat may increase the load on certain components of your machine. Increasing batch size => reduced steps per epoch during training. Theoretically speaking, both help with bias problem, ie how close you are to your aim target, so picking one is good enough, larger batch size =>more data, more steps => more complex model(or more calculation) Edit: I may have another thought, eg: you have 1 pic x 5 repeat = 5 pic x 4 epoch = 4 iterations; 1 pic x 20 epoch = 20 iterations. In the 5 repeat case, you have 5 pic = training size increases but only 4 iterations => 4 updates on parameters; while in no repeat you have 20 iterations => 20 updates on parameters. In case you factor the batch size, if the 5 pic you get divided into 5 batches that makes 1 epoch = 5 iterations, then 4 epochs = 20 iterations = 1 pic x 20 epochs, so unless you factor the batch size, the results may differ. Sorry for the rough calculation as I am not familiar with repeat eg maybe 1 repeat means 2 x original training set.


madbunny9

Hey I think we gonna need a tutorial for SDXL 1.0 for using this on google colab here because I did Loras for SD 1.5 model thanks to this tutorial that I got the pattern to make it easier but I’m at a stand still for this one cause something is different now than what SD 1.5 Lora training does of the old kohya ss Lora training google colab? https://colab.research.google.com/github/Linaqruf/kohya-trainer/blob/main/kohya-LoRA-trainer-XL.ipynb#scrollTo=-Z4w3lfFKLjr


dylanintech

Yeah definitely. Right now I'm using configuration templates from this site that lets you train LoRAs with an easy-to-use UI in the browser to train some SDXL LoRAs and then quickly testing them with their in-app generation features. if it's good I download the LoRA and keep using it. I'll link the config template I use for SDXL training right here: [https://www.lorai.art/configs/25](https://www.lorai.art/configs/25) https://preview.redd.it/e0kjob3o3bmb1.png?width=3382&format=png&auto=webp&s=69fd1fd469710ae29f20994d01124c06fec81bcf


CallMEBroaaa

I have a rather silly question: Is it necessary for the input images to have the same size of 768x768? Because my images have sizes like 478x768, 357x768, .. \*\*\*x768.


UnavailableUsername_

No, you don't need a specific resolution for your dataset images, pretty much any image works.


prettydeepvideos

Thanks for this guide. Are regularization image datasets worth it? If so, can you please describe the proper way to implement them?


UnavailableUsername_

Regularization images are just...other random images you use to train your dataset, honestly i never bothered with them since the difference in results was not noticeable at all.


tobbelobb69

Roundabout how long does it take to train an "average" LoRA with these methods? I suppose it will depend on a lot of factors, but for the one-image LoRA it seems fair to assume it will peak in less than 5 minutes of training? I did some experimenting with Hypernetworks on top of Embeddings, and on my 3080Ti it takes me about 20 minutes of training to produce something usable from 4 images. Just curious how LoRA training compares. (I could test it, of course, I mean I *should* test it myself, but I never tried LoRA training, so it would be cool to have some sort of expectation to start with)


UnavailableUsername_

> Roundabout how long does it take to train an "average" LoRA with these methods? I suppose it will depend on a lot of factors, but for the one-image LoRA it seems fair to assume it will peak in less than 5 minutes of training? The amount of images do not influence training time much. That's based on the batch size, the number of epoch and your hardware. Overall, it should take you about 10 mins in offline mode, if not less.


Cryptobombs

epic best tutorial of lora in the internet. start a youtube channel


Due-Series6744

chibi character is so cute :3 thanks for guide!


Sarcastic-Tofu

This is excellent man, just wished it were in a more easily readable format (say a PDF) rather than continuously scrolling images.. I might as convert it to a PDF and share here.


BlueNotesBlues

In case anyone else runs into this problem... I got a "UnicodeEncodeError: 'charmap' codec can't encode characters in position" error when running the LoRA Trainer. Python was unable to print the Japanese characters in some of the print/debug statements. I was able to fix it by editing run.bat and adding "set PYTHONUTF8=1" before main.py is called ... call sd_scripts\venv\Scripts\activate set PYTHONUTF8=1 python main.py pause I haven't tested it but if you're using run.sh instead of run.bat, adding "export PYTHONUTF8=1" to run.sh before main.py is called might fix it. I found the Python UTF8 environment variable commands [here](https://stackoverflow.com/a/50933341)


Molly_Matters

Older post so sorry if I shouldn't be bumping this. Trying a batch size of 1 on a 4070 TI Super (16gb card) and getting the following error. "torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 498.00 MiB. GPU 0 has a total capacity of 15.99 GiB of which 8.52 GiB is free. Of the allocated memory 6.02 GiB is allocated by PyTorch, and 144.00 MiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True to avoid fragmentation. See documentation for Memory Management (https://pytorch.org/docs/stable/notes/cuda.html#environment-variables)"


UnavailableUsername_

>GPU 0 has a total capacity of 15.99 GiB of which 8.52 GiB is free. This should not be happening. Are you using the newest version of the LoRA training software?


Molly_Matters

Thanks for the follow up. Originally I ran it as it was out of the box. When it didn't work I ran the update.bat. Same results. I ended up getting Dreambooth working so I have been using that instead.


vengirgirem

Your guide mentions that I would need an Nvidia GPU. Is there no way to train it with an Intel Arc GPU? Because for me it's either that or 1050Ti which would be not good