frank-chieng
commited on
Commit
•
8b7a5f7
1
Parent(s):
ea090d3
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: openrail
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
tags:
|
6 |
+
- stable-diffusion
|
7 |
+
- stable-diffusion-diffusers
|
8 |
+
- stable-diffusion-xl
|
9 |
+
- lora
|
10 |
+
- diffusers
|
11 |
+
base_model: stabilityai/stable-diffusion-xl-base-1.0
|
12 |
+
datasets:
|
13 |
+
- frank-chieng/chinese_architecture_siheyuan
|
14 |
+
library_name: diffusers
|
15 |
+
inference:
|
16 |
+
parameter:
|
17 |
+
negative_prompt:
|
18 |
+
widget:
|
19 |
+
- text: >-
|
20 |
+
siheyuan, chinese traditional architecture, perfectly shaded, morning lighting, medium closeup, mystical setting, during the day
|
21 |
+
example_title: example1 siheyuan
|
22 |
+
- text: >-
|
23 |
+
siheyuan, chinese modern architecture, perfectly shaded, night lighting, medium closeup, mystical setting, during the day
|
24 |
+
example_title: example2 siheyuan
|
25 |
+
pipeline_tag: text-to-image
|
26 |
+
---
|
27 |
+
## Overview
|
28 |
+
|
29 |
+
**Architecture Lora Chinese Style** is a lora training model with sdxl1.0 base model, latent text-to-image diffusion model. The model has been fine-tuned using a learning rate of `1e-5` over 3000 total steps with a batch size of 4 on a curated dataset of superior-quality chinese building style images. This model is derived from Stable Diffusion XL 1.0.
|
30 |
+
|
31 |
+
- Use it with 🧨 [`diffusers`](https://huggingface.co/docs/diffusers/index)
|
32 |
+
- Use it with the [`ComfyUI`](https://github.com/comfyanonymous/ComfyUI) **(recommended)**
|
33 |
+
-
|
34 |
+
### Model Description
|
35 |
+
|
36 |
+
<!-- Provide a longer summary of what this model is. -->
|
37 |
+
|
38 |
+
- **Developed by:** [FrankChieng](https://github.com/frankchieng)
|
39 |
+
- **Model type:** Diffusion-based text-to-image generative model
|
40 |
+
- **License:** [CreativeML Open RAIL++-M License](https://huggingface.co/stabilityai/stable-diffusion-2/blob/main/LICENSE-MODEL)
|
41 |
+
- **Finetuned from model [optional]:** [Stable Diffusion XL 1.0 base](https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0)
|
42 |
+
|
43 |
+
<hr>
|
44 |
+
|
45 |
+
## How to Use:
|
46 |
+
- Download `Lora model` [here](https://huggingface.co/frank-chieng/maggieQ/resolve/main/sdxl_lora_maggie_Q.safetensors), the model is in `.safetensors` format.
|
47 |
+
- You need to use include siheyuan prompt in natural language, then you will get realistic result image
|
48 |
+
- You can use any generic negative prompt or use the following suggested negative prompt to guide the model towards high aesthetic generationse:
|
49 |
+
```
|
50 |
+
low quality, low resolution,watermark, mark, nsfw, lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username
|
51 |
+
```
|
52 |
+
- And, the following should also be prepended to prompts to get high aesthetic results:
|
53 |
+
```
|
54 |
+
masterpiece, best quality
|
55 |
+
```
|
56 |
+
<hr>
|
57 |
+
|
58 |
+
## Google Colab
|
59 |
+
|
60 |
+
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1-9rHS6JybOsznkKRo6BlADMArUr8ctve?usp=sharing)
|
61 |
+
|
62 |
+
|
63 |
+
## 🧨 Diffusers
|
64 |
+
|
65 |
+
Make sure to upgrade diffusers to >= 0.18.2:
|
66 |
+
```
|
67 |
+
pip install diffusers --upgrade
|
68 |
+
```
|
69 |
+
|
70 |
+
In addition make sure to install `transformers`, `safetensors`, `accelerate` as well as the invisible watermark:
|
71 |
+
```
|
72 |
+
pip install invisible_watermark transformers accelerate safetensors
|
73 |
+
```
|
74 |
+
|
75 |
+
Running the pipeline (if you don't swap the scheduler it will run with the default **EulerDiscreteScheduler** in this example we are swapping it to **EulerAncestralDiscreteScheduler**:
|
76 |
+
```py
|
77 |
+
pip install -q --upgrade diffusers invisible_watermark transformers accelerate safetensors
|
78 |
+
pip install huggingface_hub
|
79 |
+
from huggingface_hub import notebook_login
|
80 |
+
notebook_login()
|
81 |
+
import torch
|
82 |
+
from torch import autocast
|
83 |
+
from diffusers import StableDiffusionXLPipeline, EulerAncestralDiscreteScheduler
|
84 |
+
|
85 |
+
base_model_id = "stabilityai/stable-diffusion-xl-base-1.0"
|
86 |
+
lora_model = "frank-chieng/sdxl_lora_architecture_siheyuan"
|
87 |
+
|
88 |
+
pipe = StableDiffusionXLPipeline.from_pretrained(
|
89 |
+
base_model_id,
|
90 |
+
torch_dtype=torch.float16,
|
91 |
+
use_safetensors=True,
|
92 |
+
)
|
93 |
+
pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
|
94 |
+
pipe.load_lora_weights(lora_model, weight_name="sdxl_lora_architecture_siheyuan.safetensors")
|
95 |
+
pipe.to('cuda')
|
96 |
+
prompt = "siheyuan, chinese modern architecture, perfectly shaded, night lighting, medium closeup, mystical setting, during the day"
|
97 |
+
negative_prompt = "watermark"
|
98 |
+
image = pipe(
|
99 |
+
prompt,
|
100 |
+
negative_prompt=negative_prompt,
|
101 |
+
width=1024,
|
102 |
+
height=1024,
|
103 |
+
guidance_scale=7,
|
104 |
+
target_size=(1024,1024),
|
105 |
+
original_size=(4096,4096),
|
106 |
+
num_inference_steps=28
|
107 |
+
).images[0]
|
108 |
+
image.save("chinese_siheyuan.png")
|
109 |
+
```
|
110 |
+
<hr>
|
111 |
+
|
112 |
+
## Limitation
|
113 |
+
This model inherit Stable Diffusion XL 1.0 [limitation](https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0#limitations)
|