multimodalart HF staff commited on
Commit
4a8355e
·
verified ·
1 Parent(s): 5f8dfae

Add diffusers code example

Browse files
Files changed (1) hide show
  1. README.md +24 -0
README.md CHANGED
@@ -24,6 +24,30 @@ The model has been mostly developed by Founder and CEO of Mann-E, [Muhammadreza
24
  - Scale: 768x768 and 832x832 are just fine. Higher isn't tested. For 16:9 just try 1080x608
25
  - Sampler : DPM++ SDE Karras
26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  ## Additional Notes
28
 
29
  - SDXL 1.0 LoRas are working just fine with the model.
 
24
  - Scale: 768x768 and 832x832 are just fine. Higher isn't tested. For 16:9 just try 1080x608
25
  - Sampler : DPM++ SDE Karras
26
 
27
+ ## Use it with diffusers
28
+
29
+ ```py
30
+ from diffusers import DiffusionPipeline, DPMSolverSinglestepScheduler
31
+ import torch
32
+
33
+ pipe = DiffusionPipeline.from_pretrained(
34
+ "mann-e/Mann-E_Dreams", torch_dtype=torch.float16
35
+ ).to("cuda")
36
+
37
+ #This is equivalent to DPM++ SDE Karras, as noted in https://huggingface.co/docs/diffusers/main/en/api/schedulers/overview
38
+ pipe.scheduler = DPMSolverSinglestepScheduler.from_config(pipe.scheduler.config, use_karras_sigmas=True)
39
+
40
+ image = pipe(
41
+ prompt="a cat in a bustling middle eastern city",
42
+ num_inference_steps=8,
43
+ guidance_scale=3,
44
+ width=768,
45
+ height=768,
46
+ clip_skip=1
47
+ ).images[0]
48
+ image
49
+ ```
50
+
51
  ## Additional Notes
52
 
53
  - SDXL 1.0 LoRas are working just fine with the model.