helenai commited on
Commit
0eb158a
·
verified ·
1 Parent(s): 1bd9b3f

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +11 -4
README.md CHANGED
@@ -12,11 +12,18 @@ Requirements: `pip install optimum[openvino,diffusers]`
12
 
13
  ```
14
  from optimum.intel import OVLatentConsistencyModelPipeline
 
15
 
16
- device = "CPU" # set to "GPU" for inference on Intel iGPU or dGPU
17
  model_id = "helenai/SimianLuo-LCM_Dreamshaper_v7-ov"
18
- pipeline = OVLatentConsistencyModelPipeline.from_pretrained(model_id, device=device)
19
- prompt = "sailing ship in storm by Leonardo da Vinci"
 
 
 
 
20
  image = pipeline(prompt, num_inference_steps=4, guidance_scale=8.0).images[0]
21
- image.save("sailing_ship.png")
 
 
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
  ```