This repository contains code and resources for fine-tuning the Stable Diffusion XL model on fashion-related data using Low-Rank Adaptation (LoRA). The main objective is to determine the optimal LoRA configuration to balance performance and efficiency for fine-tuning, enabling the generation of high-quality images while minimizing the number of trainable parameters and computational requirements.
This project demonstrates the application of LoRA for fine-tuning Stable Diffusion XL to create realistic, high-resolution fashion images.
├── configs
│ ├── experiment1
│ │ ├── eval_config_sdxl_w_refiner.json
│ │ ├── eval_config_sdxl_wo_refiner.json
│ │ ├── train_config_sdxl1.json
│ │ ├── train_config_sdxl2.json
│ │ └── train_config_sdxl3.json
│ ├── experiment2
│ ├── ...
│
├── data
│ ├── <dataset_name>
│ │ ├── images/
│ │ │ └── <all images>
│ │ └── captions/
│ │ └── captions.json
│
├── model_logs
├── notebooks
│ ├── 01-look-at-data.ipynb
│ ├── 02-look-at-prepared-data.ipynb
│ ├── 03-look-at-model-outputs.ipynb
│ ├── 04-look-at-model-param-count.ipynb
│ └── ...
├── scripts
│ ├── train_ldm_lora.sh
│ ├── eval_ldm_lora.sh
├── src
│ ├── data_prep/
│ ├── models/
│ ├── train_ldm_lora.py
│ ├── evaluate_ldm_lora.py
│ ├── utils.py
│ └── ...
├── requirements.txt
└── README.md
Clone the Repository
git clone https://github.com/<your-repo-name>/Stable-Diffusion-Lora-Finetuning.git
cd Stable-Diffusion-Lora-Finetuning
Install Dependencies
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
Dataset Structure
data/<dataset_name>/
├── images/
│ └── <all images>
└── captions/
└── captions.json
images/ folder.captions.json file in the captions/ folder with the following format:
{
"image1.jpg": "A woman wearing a red dress.",
"image2.jpg": "A man in a blue jacket."
}
Run the training script:
bash scripts/train_ldm_lora.sh
train_config_sdxl1.json) and data directory are specified in the script.Evaluate the fine-tuned model:
bash scripts/eval_ldm_lora.sh
eval_config_sdxl_w_refiner.json), data directory, and specify the trained model checkpoint.Jupyter Notebook
99.8%
This repository contains code and resources for fine-tuning the Stable Diffusion XL model on fashion-related data using Low-Rank Adaptation (LoRA). The main objective is to determine the optimal LoRA configuration to balance performance and efficiency for fine-tuning, enabling the generation of high-quality images while minimizing the number of trainable parameters and computational requirements.
This project demonstrates the application of LoRA for fine-tuning Stable Diffusion XL to create realistic, high-resolution fashion images.
├── configs
│ ├── experiment1
│ │ ├── eval_config_sdxl_w_refiner.json
│ │ ├── eval_config_sdxl_wo_refiner.json
│ │ ├── train_config_sdxl1.json
│ │ ├── train_config_sdxl2.json
│ │ └── train_config_sdxl3.json
│ ├── experiment2
│ ├── ...
│
├── data
│ ├── <dataset_name>
│ │ ├── images/
│ │ │ └── <all images>
│ │ └── captions/
│ │ └── captions.json
│
├── model_logs
├── notebooks
│ ├── 01-look-at-data.ipynb
│ ├── 02-look-at-prepared-data.ipynb
│ ├── 03-look-at-model-outputs.ipynb
│ ├── 04-look-at-model-param-count.ipynb
│ └── ...
├── scripts
│ ├── train_ldm_lora.sh
│ ├── eval_ldm_lora.sh
├── src
│ ├── data_prep/
│ ├── models/
│ ├── train_ldm_lora.py
│ ├── evaluate_ldm_lora.py
│ ├── utils.py
│ └── ...
├── requirements.txt
└── README.md
Clone the Repository
git clone https://github.com/<your-repo-name>/Stable-Diffusion-Lora-Finetuning.git
cd Stable-Diffusion-Lora-Finetuning
Install Dependencies
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
Dataset Structure
data/<dataset_name>/
├── images/
│ └── <all images>
└── captions/
└── captions.json
images/ folder.captions.json file in the captions/ folder with the following format:
{
"image1.jpg": "A woman wearing a red dress.",
"image2.jpg": "A man in a blue jacket."
}
Run the training script:
bash scripts/train_ldm_lora.sh
train_config_sdxl1.json) and data directory are specified in the script.Evaluate the fine-tuned model:
bash scripts/eval_ldm_lora.sh
eval_config_sdxl_w_refiner.json), data directory, and specify the trained model checkpoint.Jupyter Notebook
99.8%