Update README.md
Browse files
README.md
CHANGED
@@ -12,11 +12,18 @@ Requirements: `pip install optimum[openvino,diffusers]`
|
|
12 |
|
13 |
```
|
14 |
from optimum.intel import OVLatentConsistencyModelPipeline
|
|
|
15 |
|
16 |
-
device = "
|
17 |
model_id = "helenai/SimianLuo-LCM_Dreamshaper_v7-ov"
|
18 |
-
pipeline = OVLatentConsistencyModelPipeline.from_pretrained(model_id, device=device)
|
19 |
-
|
|
|
|
|
|
|
|
|
20 |
image = pipeline(prompt, num_inference_steps=4, guidance_scale=8.0).images[0]
|
21 |
-
|
|
|
|
|
22 |
```
|
|
|
12 |
|
13 |
```
|
14 |
from optimum.intel import OVLatentConsistencyModelPipeline
|
15 |
+
import time
|
16 |
|
17 |
+
device = "GPU" # for best results, use "GPU" for devices with Intel iGPU or dGPU. "CPU" can also be used.
|
18 |
model_id = "helenai/SimianLuo-LCM_Dreamshaper_v7-ov"
|
19 |
+
pipeline = OVLatentConsistencyModelPipeline.from_pretrained(model_id, device=device, compile=False)
|
20 |
+
pipeline.reshape(1,512,512,1) # reshape to static shapes for better performance
|
21 |
+
pipeline.compile()
|
22 |
+
prompt = "a robot discovering nature"
|
23 |
+
|
24 |
+
start = time.perf_counter()
|
25 |
image = pipeline(prompt, num_inference_steps=4, guidance_scale=8.0).images[0]
|
26 |
+
end = time.perf_counter()
|
27 |
+
print(f"Duration: {end-start:.2f}")
|
28 |
+
image.save("robot.png")
|
29 |
```
|