Update README.md
Browse files
README.md
CHANGED
|
@@ -17,8 +17,51 @@ pip install optimum[openvino]
|
|
| 17 |
To load your model you can do as follows:
|
| 18 |
|
| 19 |
```python
|
|
|
|
| 20 |
from optimum.intel import OVStableDiffusionPipeline
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
model_id = "hsuwill000/LCM-kotosmix_diffusers-openvino"
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
```
|
|
|
|
|
|
|
|
|
| 17 |
To load your model you can do as follows:
|
| 18 |
|
| 19 |
```python
|
| 20 |
+
import huggingface_hub as hf_hub
|
| 21 |
from optimum.intel import OVStableDiffusionPipeline
|
| 22 |
+
from diffusers import LCMScheduler
|
| 23 |
+
import torch
|
| 24 |
+
|
| 25 |
|
| 26 |
model_id = "hsuwill000/LCM-kotosmix_diffusers-openvino"
|
| 27 |
+
|
| 28 |
+
HIGH = 1024
|
| 29 |
+
WIDTH = 1024
|
| 30 |
+
|
| 31 |
+
batch_size = -1 # Or set it to a specific positive integer if needed
|
| 32 |
+
|
| 33 |
+
prompt="agirl, anime,"
|
| 34 |
+
|
| 35 |
+
negative_prompt="(deformed, distorted, disfigured:1.3), poorly drawn, bad anatomy, wrong anatomy,\
|
| 36 |
+
extra limb, missing limb, floating limbs, (mutated hands and fingers:1.4), disconnected limbs, \
|
| 37 |
+
mutation, mutated, ugly, disgusting, blurry, amputation"
|
| 38 |
+
|
| 39 |
+
pipe = OVStableDiffusionPipeline.from_pretrained(
|
| 40 |
+
model_id,
|
| 41 |
+
compile=False,
|
| 42 |
+
ov_config={"CACHE_DIR": ""},
|
| 43 |
+
torch_dtype=torch.bfloat16, # More standard dtype for speed
|
| 44 |
+
safety_checker=None,
|
| 45 |
+
use_safetensors=False,
|
| 46 |
+
)
|
| 47 |
+
pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config)
|
| 48 |
+
|
| 49 |
+
print(pipe.scheduler.compatibles)
|
| 50 |
+
pipe.reshape(batch_size=batch_size, height=HIGH, width=WIDTH, num_images_per_prompt=1)
|
| 51 |
+
pipe.compile()
|
| 52 |
+
|
| 53 |
+
image = pipe(
|
| 54 |
+
prompt=prompt,
|
| 55 |
+
negative_prompt=negative_prompt,
|
| 56 |
+
width=WIDTH,
|
| 57 |
+
height=HIGH,
|
| 58 |
+
guidance_scale=2,
|
| 59 |
+
num_inference_steps=4,
|
| 60 |
+
num_images_per_prompt=1,
|
| 61 |
+
).images[0]
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
image.save("test.png")
|
| 65 |
```
|
| 66 |
+
|
| 67 |
+
|