{"cells":[{"cell_type":"markdown","metadata":{"id":"YbgJyY8UIINn"},"source":["**Agradecimentos:**\n","\n","*Gostaria de expressar minha gratidão aos seguintes recursos:*\n","[StableDiffusion.vn](https://) pelo design e desenvolvimento.\n","\n","Gostaria de agradecer à referência original fornecida por [Kohya LoRA Dreambooth](https://github.com/Linaqruf/kohya-trainer/blob/main/kohya-LoRA-dreambooth.ipynb), um ótimo recurso para treinamento de LoRA usando o método Dreambooth. Embora o link original já não esteja mais funcional, segue abaixo a descrição como forma de agradecimento:\n","\n","| Notebook Name | Description | Link | V14 |\n","| --- | --- | --- | --- |\n","| #Referência [Kohya LoRA Dreambooth](https://github.com/Linaqruf/kohya-trainer/blob/main/kohya-LoRA-dreambooth.ipynb) | LoRA Training (Dreambooth method) | [![](https://img.shields.io/static/v1?message=Open%20in%20Colab&logo=googlecolab&labelColor=5c5c5c&color=0f80c1&label=%20&style=flat)](https://colab.research.google.com/github/Linaqruf/kohya-trainer/blob/main/kohya-LoRA-dreambooth.ipynb) | [![](https://img.shields.io/static/v1?message=Older%20Version&logo=googlecolab&labelColor=5c5c5c&color=e74c3c&label=%20&style=flat)](https://colab.research.google.com/github/Linaqruf/kohya-trainer/blob/ff701379c65380c967cd956e4e9e8f6349563878/kohya-LoRA-dreambooth.ipynb) |\n","\n","\n","
\n","

Suporte meu Projeto!

\n","

Agradeço seu apoio para continuar desenvolvendo e aprimorando projetos no Colab e compartilhando na comunidade!

\n"," \n","
\n"," \n"," \n"," \n"," \n"," \n"," \n","
\n","\n","

Visite meu perfil no CivitAI e contribua no Ko-Fi para me ajudar a continuar criando!

\n","
\n","\n","\n","# **GSGI LoRA TRAINER 1.5**\n","\n","A Colab Notebook For LoRA Training (Dreambooth Method)\n","\n","---\n","\n","# 💡 Guia de uso:\n","\n","- Passo 1: Faça o upload da pasta de imagens de treinamento no Google Drive na pasta /LoRA TRAINER/NomeDaPasta.\n","- Passo 2: Insira o nome da pasta de imagens de treinamento, **o nome da pasta será o prompt para chamar o LoRA**.\n","- Passo 3: Escolha o modelo ou insira o link de download ou o caminho do checkpoint no Drive para treinar.\n","- Passo 4: Selecione as opções ou escolha o ProMode para ajustar manualmente.\n","- Passo 4: Execute o programa, receba o LoRA na pasta /Lora/Output no Drive.\n","- Teste amostras LoRA com 2, 4, 6, 8, 10 - escolha a que melhor funcionar para usar.\n"]},{"cell_type":"markdown","metadata":{"id":"6CNz5c4RWl84"},"source":["# ☕️ Run Lora Train GSGI (One Click)"]},{"cell_type":"markdown","source":["# **Montar Driver (Google Driver)**"],"metadata":{"id":"30UuGwnn_Wf7"}},{"cell_type":"code","source":["# @title # Montar Google Drive\n","from google.colab import drive\n","drive.mount('/content/drive')"],"metadata":{"id":"V7lavDjB_ChC","cellView":"form"},"execution_count":null,"outputs":[]},{"cell_type":"code","execution_count":null,"metadata":{"cellView":"form","id":"Ccsl1_k31mtP"},"outputs":[],"source":["#@title #🚀 Lora Train\n","#@markdown 🔴 `Insira o nome da pasta de imagens para treinamento (Carregue a pasta no Drive no endereço SD-Data /TrainData), suporte a subPastas`\n","\n","#@markdown 🔴 `Deixe a pasta foldername em branco se a pasta já estiver colocada na subpasta de nível 1 de TrainData e tiver o mesmo nome que lora`\n","Loraname =\"\" #@param {type:\"string\"}\n","#@markdown 🔴 Caminho é LoRA TRAINER no google driver. (Insira o nome da pasta)\n","Foldername = \"\" # @param [] {\"allow-input\":true}\n","#@markdown 🔴 `Escolha o modelo de treinamento ou insira o link de download / caminho do drive`\n","Model = \"https://civitai.com/api/download/models/164715\" # @param [\"https://civitai.com/api/download/models/164715\",\"https://civitai.com/api/download/models/138518\",\"https://civitai.com/api/download/models/503605\"] {\"allow-input\":true}\n","Size = \"768\" #@param [\"512\",\"768\",\"1024\"]\n","TrainConcept = \"Character/Items\" #@param [\"Face\",\"Style\",\"Clothing\",\"Character/Items\"]\n","ImageNumber = \"1-50\" #@param [\"1-50\",\"50-100\",\"100-200\",\"200-300\"]\n","\n","NoAutoCaption = False #@param {type:\"boolean\"}\n","ProMode = False #@param {type:\"boolean\"}\n","\n","#@markdown 🔴 `Escolha ProMode para ativar o modo de ajuste manual dos parâmetros abaixo`\n","if Size == \"512\" :\n"," Batch_size = 6\n"," resolution = 512\n","if Size == \"768\" :\n"," Batch_size = 3\n"," resolution = 768\n","if Size == \"1024\" :\n"," Batch_size = 1\n"," resolution = 1024\n","\n","CustomCaption = \"\" #@param {type:\"string\"}\n","\n","Threshold = 1 #@param {type:\"number\"}\n","Repeats = 25 #@param {type:\"number\"}\n","Epochs = 20 #@param {type:\"number\"}\n","SaveEpoch = 4 #@param {type:\"number\"}\n","UnetLr = 6e-4 #@param {type:\"number\"}\n","TextLr = 3e-4 #@param {type:\"number\"}\n","\n","if not CustomCaption :\n"," CustomCaption = Loraname\n","if not Foldername :\n"," Foldername = Loraname\n","if ProMode == False :\n"," CustomCaption = Loraname\n"," UnetLr = 1e-4\n"," TextLr = 5e-5\n"," SaveEpoch = 2\n"," if TrainConcept == \"Face\" :\n"," Threshold = 0.85\n"," if ImageNumber == \"1-50\" :\n"," Repeats = 48\n"," Epochs = 8\n"," if ImageNumber == \"50-100\" :\n"," Repeats = 24\n"," Epochs = 8\n"," if ImageNumber == \"100-200\" :\n"," Repeats = 16\n"," Epochs = 8\n"," if ImageNumber == \"200-300\" :\n"," Repeats = 8\n"," Epochs = 8\n"," if TrainConcept == \"Style\" :\n"," Threshold = 0.35\n"," if ImageNumber == \"1-50\" :\n"," Repeats = 48\n"," Epochs = 10\n"," if ImageNumber == \"50-100\" :\n"," Repeats = 24\n"," Epochs = 10\n"," if ImageNumber == \"100-200\" :\n"," Repeats = 16\n"," Epochs = 8\n"," if ImageNumber == \"200-300\" :\n"," Repeats = 8\n"," Epochs = 8\n"," if TrainConcept == \"Clothing\" :\n"," Threshold = 1\n"," if ImageNumber == \"1-50\" :\n"," Repeats = 48\n"," Epochs = 6\n"," if ImageNumber == \"50-100\" :\n"," Repeats = 24\n"," Epochs = 6\n"," if ImageNumber == \"100-200\" :\n"," Repeats = 16\n"," Epochs = 4\n"," if ImageNumber == \"200-300\" :\n"," Repeats = 8\n"," Epochs = 4\n"," if TrainConcept == \"Character/Items\" :\n"," Threshold = 0.8\n"," if ImageNumber == \"1-50\" :\n"," Repeats = 36\n"," Epochs = 10\n"," if ImageNumber == \"50-100\" :\n"," Repeats = 24\n"," Epochs = 8\n"," if ImageNumber == \"100-200\" :\n"," Repeats = 16\n"," Epochs = 8\n"," if ImageNumber == \"200-300\" :\n"," Repeats = 8\n"," Epochs = 8\n","\n","train_repeats = Repeats\n","num_epochs = Epochs\n","unet_lr = UnetLr\n","text_encoder_lr = TextLr\n","save_n_epochs_type_value = SaveEpoch\n","\n","output_dir = \"/content/drive/MyDrive/SD-Data/Lora\"\n","train_data_dir = f\"/content/drive/MyDrive/LoRA TRAINER/{Foldername}\"\n","\n","from google.colab import drive\n","drive.mount('/content/drive')\n","\n","%cd /content\n","!wget -nc https://huggingface.co/datasets/Bluwynd/LoraTrain15/resolve/main/autotrain.ipynb -qq\n","%run autotrain.ipynb\n","\n","!{final_args}\n"]}],"metadata":{"accelerator":"GPU","colab":{"gpuType":"T4","private_outputs":true,"provenance":[{"file_id":"1cFxOe-Kq__oGzskS2UQOhTVmqPLFRbNR","timestamp":1728450993621},{"file_id":"11jjKTtuIcXOc41Dp5wRCYn-qAGGNqpgH","timestamp":1679290054601},{"file_id":"1WtsDJwLd7E-CuscvdD9j_nE74NgHM0tT","timestamp":1678802609727}]},"kernelspec":{"display_name":"Python 3","name":"python3"},"language_info":{"name":"python"}},"nbformat":4,"nbformat_minor":0}