Closed andykaufseo closed 1 year ago
Any update?
I've been trying to get this to work on Runpod for awhile, after a lot of failed attempts I realized it wasn't that hard. Here's what I did to run the diffusers fine-tuner notebook, I haven't tried the dreambooth notebook on runpod yet.
Create a pod using one of the automatic1111's SD webui templates, and start the web terminal and run the following commands:
cd /workspace
git clone https://github.com/Linaqruf/kohya-trainer
apt-get update && apt-get install unzip -y libgl1 libglib2.0-0
pip install gdown
Stop the web terminal then connect to jupyter lab, expand the kohya-trainer
directory and open the kohya-trainer.ipynb
notebook. Replace /content
with /workspace
(Use CTRL+F to search and replace all).
You will have to skip the "Install Diffuser Fine Tuning" code block especially if you are only interested in the latest version of this repo.
Modify the following code blocks:
!pip install -U -I --no-deps https://github.com/camenduru/stable-diffusion-webui-colab/releases/download/0.0.15/xformers-0.0.15.dev0+189828c.d20221
login
to notebook_login
, ex:
from huggingface_hub import notebook_login
notebook_login()
#@title Install Pre-trained Model
%cd /workspace/kohya-trainer
import os
if not os.path.exists('checkpoint'):
os.makedirs('checkpoint')
model_url = "https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.ckpt" model_name = "sd15"
!gdown --fuzzy {model_url} -O /workspace/kohya-trainer/checkpoint/{model_name}.ckpt
Change the `model_url` and `model_name` to whatever model it is you want to use as a base for your training. Do not forget to change the path to the model in code blocks following this one, it should point to where your model is located.
After training, you will find your output in the /workspace/kohya-trainer/fine_tuned/
directory, the last.ckpt
is usually what you want unless it is over-trained, move the model of your choice to /workspace/stable-diffusion-webui/models/Stable-diffusion
. You can also do this inside the notebook by adding a new code cell:
!mv /workspace/kohya-trainer/fine-tuned/last.ckpt /workspace/stable-diffusion-webui/models/Stable-diffusion/last.ckpt
Go back to your pods dashboard and connect to the web server and wait for the web ui to load, refresh the model list on the top-left corner of the web ui and load your fine-tuned model. Do not forget to change the CLIP skip to 2
in the settings!
Is there any way we can run this on a runpod or vast.ai instance? I tried but got suck along the way...