AlexKoff88
commited on
Commit
•
4f50710
1
Parent(s):
3e42e6f
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
datasets:
|
4 |
+
- lambdalabs/pokemon-blip-captions
|
5 |
+
language:
|
6 |
+
- en
|
7 |
+
---
|
8 |
+
|
9 |
+
This is the highly optimized version of the [Stable Diffusion model for pokemon generation](https://huggingface.co/svjack/Stable-Diffusion-Pokemon-en).
|
10 |
+
The model was optimized with a combination of two methods:
|
11 |
+
* Quantization-aware training from [NNCF](https://github.com/openvinotoolkit/nncf).
|
12 |
+
* A modification of the Token Merging method from [here](https://github.com/AlexKoff88/tomesd/tree/openvino).
|
13 |
+
|
14 |
+
To run the model use the following code:
|
15 |
+
|
16 |
+
```python
|
17 |
+
%pip install optimum[openvino,diffusers]
|
18 |
+
|
19 |
+
from optimum.intel.openvino import OVStableDiffusionPipeline
|
20 |
+
from diffusers import LMSDiscreteScheduler, DDPMScheduler
|
21 |
+
|
22 |
+
import torch
|
23 |
+
import random
|
24 |
+
import numpy as np
|
25 |
+
|
26 |
+
pipe = OVStableDiffusionPipeline.from_pretrained("OpenVINO/stable-diffusion-pokemons-tome-quantized-aggressive", compile=False)
|
27 |
+
pipe.reshape(batch_size=1, height=512, width=512, num_images_per_prompt=1)
|
28 |
+
pipe.compile()
|
29 |
+
|
30 |
+
# Use original model to compare
|
31 |
+
# pipe = OVStableDiffusionPipeline.from_pretrained("svjack/Stable-Diffusion-Pokemon-en", export=True, compile=False)
|
32 |
+
|
33 |
+
prompt = "cartoon bird"
|
34 |
+
output = pipe(prompt, num_inference_steps=50, output_type="pil")
|
35 |
+
output.images[0].save("output.png")
|
36 |
+
```
|
37 |
+
|