Add comprehensive model card
Browse files
README.md
CHANGED
|
@@ -1,26 +1,67 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
|
|
|
| 3 |
tags:
|
| 4 |
- lora
|
| 5 |
-
- virtual-try-on
|
| 6 |
-
- diffusion
|
| 7 |
- text-to-image
|
| 8 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
base_model: stabilityai/stable-diffusion-xl-base-1.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
---
|
| 11 |
|
| 12 |
-
# Virtual Try-On LoRA
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
-
|
|
|
|
|
|
|
| 15 |
|
| 16 |
-
##
|
| 17 |
|
| 18 |
-
|
| 19 |
-
- **Base Model**: Stable Diffusion XL
|
| 20 |
-
- **Training Checkpoints**: 1 checkpoint(s)
|
| 21 |
-
- **Model Type**: LoRA weights
|
| 22 |
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
```python
|
| 26 |
from diffusers import DiffusionPipeline
|
|
@@ -29,25 +70,209 @@ import torch
|
|
| 29 |
# Load base model
|
| 30 |
pipe = DiffusionPipeline.from_pretrained(
|
| 31 |
"stabilityai/stable-diffusion-xl-base-1.0",
|
| 32 |
-
torch_dtype=torch.float16
|
|
|
|
| 33 |
)
|
|
|
|
| 34 |
|
| 35 |
# Load LoRA weights
|
| 36 |
-
pipe.load_lora_weights(
|
| 37 |
-
|
|
|
|
|
|
|
| 38 |
|
| 39 |
# Generate image
|
| 40 |
-
prompt = "a garment with pattern2 fabric texture"
|
| 41 |
-
image = pipe(
|
|
|
|
|
|
|
|
|
|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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
-
|
| 48 |
-
for garment visualization.
|
| 49 |
|
| 50 |
-
|
| 51 |
|
| 52 |
-
|
| 53 |
-
- Additional training artifacts may be included depending on upload settings
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
+
library_name: diffusers
|
| 4 |
tags:
|
| 5 |
- lora
|
|
|
|
|
|
|
| 6 |
- text-to-image
|
| 7 |
+
- diffusers
|
| 8 |
+
- virtual-try-on
|
| 9 |
+
- fashion
|
| 10 |
+
- fabric-texture
|
| 11 |
+
- pattern2
|
| 12 |
base_model: stabilityai/stable-diffusion-xl-base-1.0
|
| 13 |
+
instance_prompt: a garment with pattern2 fabric texture
|
| 14 |
+
widget:
|
| 15 |
+
- text: "a garment with pattern2 fabric texture"
|
| 16 |
+
output:
|
| 17 |
+
url: "placeholder.png"
|
| 18 |
---
|
| 19 |
|
| 20 |
+
# Virtual Try-On LoRA: Pattern2
|
| 21 |
+
|
| 22 |
+
<div align="center">
|
| 23 |
+
<img src="https://img.shields.io/badge/Type-LoRA-blue" alt="Type">
|
| 24 |
+
<img src="https://img.shields.io/badge/Fabric-Pattern2-purple" alt="Fabric">
|
| 25 |
+
<img src="https://img.shields.io/badge/Base-SDXL-green" alt="Base Model">
|
| 26 |
+
<img src="https://img.shields.io/badge/License-Apache%202.0-yellow" alt="License">
|
| 27 |
+
</div>
|
| 28 |
+
|
| 29 |
+
## 📋 Model Description
|
| 30 |
+
|
| 31 |
+
This is a **LoRA (Low-Rank Adaptation)** model fine-tuned for generating realistic **Pattern2** fabric textures in virtual try-on applications. The model has been trained on high-quality pattern2 texture images to capture the unique characteristics of this fabric type.
|
| 32 |
+
|
| 33 |
+
### Key Features
|
| 34 |
+
|
| 35 |
+
- 🎨 **Specialized for Pattern2**: Captures authentic fabric texture and appearance
|
| 36 |
+
- 🚀 **Lightweight**: Only 3.1 MB - efficient for deployment
|
| 37 |
+
- 🎯 **SDXL-based**: Built on Stable Diffusion XL for high-quality generation
|
| 38 |
+
- 👔 **Virtual Try-On Ready**: Designed for fashion and garment visualization
|
| 39 |
+
- ⚡ **Fast Inference**: LoRA architecture enables quick generation
|
| 40 |
+
|
| 41 |
+
## 🎯 Intended Use
|
| 42 |
+
|
| 43 |
+
### Primary Use Cases
|
| 44 |
+
|
| 45 |
+
1. **Virtual Try-On Systems**: Apply pattern2 textures to garment designs
|
| 46 |
+
2. **Fashion Design**: Visualize how garments look with pattern2 fabric
|
| 47 |
+
3. **E-commerce**: Generate product images with different fabric textures
|
| 48 |
+
4. **Style Transfer**: Transfer pattern2 texture to existing garment images
|
| 49 |
+
|
| 50 |
+
### Out of Scope
|
| 51 |
|
| 52 |
+
- General-purpose image generation
|
| 53 |
+
- Non-fabric texture generation
|
| 54 |
+
- Photo-realistic face generation
|
| 55 |
|
| 56 |
+
## 🚀 Quick Start
|
| 57 |
|
| 58 |
+
### Installation
|
|
|
|
|
|
|
|
|
|
| 59 |
|
| 60 |
+
```bash
|
| 61 |
+
pip install diffusers transformers accelerate safetensors
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
### Basic Usage
|
| 65 |
|
| 66 |
```python
|
| 67 |
from diffusers import DiffusionPipeline
|
|
|
|
| 70 |
# Load base model
|
| 71 |
pipe = DiffusionPipeline.from_pretrained(
|
| 72 |
"stabilityai/stable-diffusion-xl-base-1.0",
|
| 73 |
+
torch_dtype=torch.float16,
|
| 74 |
+
variant="fp16"
|
| 75 |
)
|
| 76 |
+
pipe.to("cuda")
|
| 77 |
|
| 78 |
# Load LoRA weights
|
| 79 |
+
pipe.load_lora_weights(
|
| 80 |
+
"zyuzuguldu/vton-lora-pattern2",
|
| 81 |
+
weight_name="pytorch_lora_weights.safetensors"
|
| 82 |
+
)
|
| 83 |
|
| 84 |
# Generate image
|
| 85 |
+
prompt = "a garment with pattern2 fabric texture, high quality, detailed"
|
| 86 |
+
image = pipe(
|
| 87 |
+
prompt,
|
| 88 |
+
num_inference_steps=30,
|
| 89 |
+
guidance_scale=7.5
|
| 90 |
+
).images[0]
|
| 91 |
+
|
| 92 |
image.save("output.png")
|
| 93 |
```
|
| 94 |
|
| 95 |
+
### Advanced Usage with Multiple LoRAs
|
| 96 |
+
|
| 97 |
+
```python
|
| 98 |
+
from diffusers import DiffusionPipeline
|
| 99 |
+
import torch
|
| 100 |
+
|
| 101 |
+
pipe = DiffusionPipeline.from_pretrained(
|
| 102 |
+
"stabilityai/stable-diffusion-xl-base-1.0",
|
| 103 |
+
torch_dtype=torch.float16
|
| 104 |
+
).to("cuda")
|
| 105 |
+
|
| 106 |
+
# Load with custom weight
|
| 107 |
+
pipe.load_lora_weights(
|
| 108 |
+
"zyuzuguldu/vton-lora-pattern2",
|
| 109 |
+
weight_name="pytorch_lora_weights.safetensors",
|
| 110 |
+
adapter_name="pattern2"
|
| 111 |
+
)
|
| 112 |
+
|
| 113 |
+
# Set LoRA scale (0.0 to 1.0)
|
| 114 |
+
pipe.set_adapters(["pattern2"], adapter_weights=[0.8])
|
| 115 |
+
|
| 116 |
+
# Generate
|
| 117 |
+
prompt = "a stylish jacket with pattern2 texture, fashion photography"
|
| 118 |
+
negative_prompt = "blurry, low quality, distorted"
|
| 119 |
+
|
| 120 |
+
image = pipe(
|
| 121 |
+
prompt,
|
| 122 |
+
negative_prompt=negative_prompt,
|
| 123 |
+
num_inference_steps=40,
|
| 124 |
+
guidance_scale=8.0
|
| 125 |
+
).images[0]
|
| 126 |
+
|
| 127 |
+
image.save("styled_garment.png")
|
| 128 |
+
```
|
| 129 |
+
|
| 130 |
+
### Using with Virtual Try-On Pipeline
|
| 131 |
+
|
| 132 |
+
```python
|
| 133 |
+
from diffusers import StableDiffusionXLInpaintPipeline
|
| 134 |
+
import torch
|
| 135 |
+
|
| 136 |
+
# Load inpainting pipeline for try-on
|
| 137 |
+
pipe = StableDiffusionXLInpaintPipeline.from_pretrained(
|
| 138 |
+
"stabilityai/stable-diffusion-xl-base-1.0",
|
| 139 |
+
torch_dtype=torch.float16
|
| 140 |
+
).to("cuda")
|
| 141 |
+
|
| 142 |
+
# Load LoRA
|
| 143 |
+
pipe.load_lora_weights("zyuzuguldu/vton-lora-pattern2")
|
| 144 |
+
|
| 145 |
+
# Apply texture to masked garment area
|
| 146 |
+
result = pipe(
|
| 147 |
+
prompt="garment with pattern2 fabric",
|
| 148 |
+
image=original_image,
|
| 149 |
+
mask_image=garment_mask,
|
| 150 |
+
num_inference_steps=30
|
| 151 |
+
).images[0]
|
| 152 |
+
```
|
| 153 |
+
|
| 154 |
+
## 📊 Training Details
|
| 155 |
+
|
| 156 |
+
### Training Data
|
| 157 |
+
|
| 158 |
+
- **Dataset**: [lora-garment-textures](https://huggingface.co/datasets/zyuzuguldu/lora-garment-textures)
|
| 159 |
+
- **Category**: Pattern2
|
| 160 |
+
- **Images**: High-resolution pattern2 fabric texture samples
|
| 161 |
+
- **Resolution**: Variable (resized to 1024x1024 for training)
|
| 162 |
+
|
| 163 |
+
### Training Configuration
|
| 164 |
+
|
| 165 |
+
- **Base Model**: Stable Diffusion XL 1.0
|
| 166 |
+
- **LoRA Rank**: 15
|
| 167 |
+
- **Training Framework**: Diffusers + PEFT
|
| 168 |
+
- **Optimizer**: AdamW
|
| 169 |
+
- **Training Steps**: ~2000-8000 (varied by category)
|
| 170 |
+
- **Hardware**: GPU-accelerated training
|
| 171 |
+
|
| 172 |
+
### Hyperparameters
|
| 173 |
+
|
| 174 |
+
```yaml
|
| 175 |
+
learning_rate: 1e-4
|
| 176 |
+
lora_rank: 15
|
| 177 |
+
lora_alpha: 15
|
| 178 |
+
batch_size: 4
|
| 179 |
+
resolution: 1024x1024
|
| 180 |
+
mixed_precision: fp16
|
| 181 |
+
gradient_accumulation_steps: 4
|
| 182 |
+
```
|
| 183 |
+
|
| 184 |
+
## 📁 Model Files
|
| 185 |
+
|
| 186 |
+
- **pytorch_lora_weights.safetensors** (3.1 MB): Main LoRA weights in SafeTensors format
|
| 187 |
+
|
| 188 |
+
## 🎨 Prompt Engineering Tips
|
| 189 |
+
|
| 190 |
+
### Recommended Prompts
|
| 191 |
+
|
| 192 |
+
```
|
| 193 |
+
"a garment with pattern2 fabric texture, high quality, detailed"
|
| 194 |
+
"stylish clothing made of pattern2 material, professional photography"
|
| 195 |
+
"fashion design with pattern2 texture, studio lighting"
|
| 196 |
+
"pattern2 fabric garment, detailed texture, 4k quality"
|
| 197 |
+
```
|
| 198 |
+
|
| 199 |
+
### Negative Prompts
|
| 200 |
+
|
| 201 |
+
```
|
| 202 |
+
"blurry, low quality, distorted, unrealistic, artificial"
|
| 203 |
+
"pixelated, noisy, artifacts, bad texture"
|
| 204 |
+
```
|
| 205 |
+
|
| 206 |
+
### Tips
|
| 207 |
+
|
| 208 |
+
1. **Texture Keywords**: Include words like "fabric", "texture", "material" for best results
|
| 209 |
+
2. **Quality Modifiers**: Add "high quality", "detailed", "4k" for better outputs
|
| 210 |
+
3. **LoRA Weight**: Adjust between 0.6-1.0 for strength control
|
| 211 |
+
4. **Inference Steps**: Use 30-50 steps for balanced quality/speed
|
| 212 |
+
5. **Guidance Scale**: 7.0-8.5 works well for most prompts
|
| 213 |
+
|
| 214 |
+
## ⚖️ Limitations and Bias
|
| 215 |
+
|
| 216 |
+
### Limitations
|
| 217 |
+
|
| 218 |
+
- Optimized specifically for pattern2 textures
|
| 219 |
+
- May not generalize well to other fabric types
|
| 220 |
+
- Requires SDXL base model for best results
|
| 221 |
+
- Performance depends on prompt quality
|
| 222 |
+
|
| 223 |
+
### Potential Biases
|
| 224 |
+
|
| 225 |
+
- Training data may reflect specific regional or cultural fabric styles
|
| 226 |
+
- May perform better on certain garment types seen during training
|
| 227 |
+
|
| 228 |
+
## 📝 License
|
| 229 |
+
|
| 230 |
+
This model is released under the **Apache 2.0 License**.
|
| 231 |
+
|
| 232 |
+
- Free for commercial and non-commercial use
|
| 233 |
+
- Requires attribution to the original authors
|
| 234 |
+
- No warranty provided
|
| 235 |
+
|
| 236 |
+
## 🔗 Related Resources
|
| 237 |
+
|
| 238 |
+
### Models
|
| 239 |
+
- **Base Model**: [stabilityai/stable-diffusion-xl-base-1.0](https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0)
|
| 240 |
+
- **Other Textures**: [vton-lora-denim](https://huggingface.co/zyuzuguldu/vton-lora-denim), [vton-lora-linen](https://huggingface.co/zyuzuguldu/vton-lora-linen)
|
| 241 |
+
- **Segmentation Model**: [garment-segmentation-unet-resnet50](https://huggingface.co/zyuzuguldu/garment-segmentation-unet-resnet50)
|
| 242 |
+
|
| 243 |
+
### Datasets
|
| 244 |
+
- **Training Data**: [lora-garment-textures](https://huggingface.co/datasets/zyuzuguldu/lora-garment-textures)
|
| 245 |
+
- **Masks Dataset**: [deepfashion2-upper-body-masks](https://huggingface.co/datasets/zyuzuguldu/deepfashion2-upper-body-masks)
|
| 246 |
+
|
| 247 |
+
### Demos
|
| 248 |
+
- **Try It Out**: [garment-segmentation](https://huggingface.co/spaces/zyuzuguldu/garment-segmentation)
|
| 249 |
+
|
| 250 |
+
## 📚 Citation
|
| 251 |
+
|
| 252 |
+
If you use this model in your research or project, please cite:
|
| 253 |
+
|
| 254 |
+
```bibtex
|
| 255 |
+
@misc{vton_lora_pattern2,
|
| 256 |
+
author = {zyuzuguldu},
|
| 257 |
+
title = {Virtual Try-On LoRA: Pattern2},
|
| 258 |
+
year = {2026},
|
| 259 |
+
publisher = {Hugging Face},
|
| 260 |
+
howpublished = {\url{https://huggingface.co/zyuzuguldu/vton-lora-pattern2}}
|
| 261 |
+
}
|
| 262 |
+
```
|
| 263 |
+
|
| 264 |
+
## 🤝 Contributing
|
| 265 |
+
|
| 266 |
+
Found an issue or want to improve the model? Feel free to reach out or open a discussion!
|
| 267 |
+
|
| 268 |
+
## 👨💻 Maintainer
|
| 269 |
+
|
| 270 |
+
Created and maintained by [@zyuzuguldu](https://huggingface.co/zyuzuguldu)
|
| 271 |
+
|
| 272 |
+
---
|
| 273 |
|
| 274 |
+
**Part of the Virtual Try-On Project**
|
|
|
|
| 275 |
|
| 276 |
+
Repository: [Virtual-Try-On](https://github.com/zyuzuguldu/Virtual-Try-On)
|
| 277 |
|
| 278 |
+
**Made with ❤️ for the fashion-tech and AI community**
|
|
|