Update README.md
Browse files
README.md
CHANGED
@@ -23,37 +23,29 @@ Kolors is a large-scale text-to-image generation model based on latent diffusion
|
|
23 |
|
24 |
|
25 |
## 🚀 Quick Start
|
26 |
-
###
|
|
|
|
|
|
|
|
|
27 |
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
2. Weights download([link](https://huggingface.co/Kwai-Kolors/Kolors)):
|
46 |
-
```bash
|
47 |
-
huggingface-cli download --resume-download Kwai-Kolors/Kolors --local-dir weights/Kolors
|
48 |
-
```
|
49 |
-
or
|
50 |
-
```bash
|
51 |
-
git lfs clone https://huggingface.co/Kwai-Kolors/Kolors weights/Kolors
|
52 |
-
```
|
53 |
-
3. Inference:
|
54 |
-
```bash
|
55 |
-
python3 scripts/sample.py "一张瓢虫的照片,微距,变焦,高质量,电影,拿着一个牌子,写着“可图”"
|
56 |
-
# The image will be saved to "scripts/outputs/sample_test.jpg"
|
57 |
```
|
58 |
|
59 |
|
|
|
23 |
|
24 |
|
25 |
## 🚀 Quick Start
|
26 |
+
### Using with Diffusers
|
27 |
+
Make sure you upgrade to the latest version of diffusers: pip install -U diffusers. And then you can run:
|
28 |
+
```python
|
29 |
+
import torch
|
30 |
+
from diffusers import KolorsPipeline
|
31 |
|
32 |
+
pipe = KolorsPipeline.from_pretrained(
|
33 |
+
"Kwai-Kolors/Kolors-diffusers",
|
34 |
+
torch_dtype=torch.float16,
|
35 |
+
variant='fp16',
|
36 |
+
trust_remote_code=True,
|
37 |
+
force_zeros_for_empty_prompt=False,)
|
38 |
+
pipe = pipe.to("cuda")
|
39 |
|
40 |
+
image = pipe(
|
41 |
+
"一张瓢虫的照片,微距,变焦,高质量,电影,拿着一个牌子,写着“可图”",
|
42 |
+
height=1024,
|
43 |
+
width=1024,
|
44 |
+
num_inference_steps=50,
|
45 |
+
guidance_scale=5.0,
|
46 |
+
generator= torch.Generator(pipe.device).manual_seed(66),
|
47 |
+
).images[0]
|
48 |
+
image.show()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
```
|
50 |
|
51 |
|