Anhforth patrickvonplaten commited on
Commit
27bb783
1 Parent(s): 2da752b

Add Diffusers example (#2)

Browse files

- Add Diffusers example (dc56c60dccdf89bb89416a68706765266bf5a9a9)


Co-authored-by: Patrick von Platen <patrickvonplaten@users.noreply.huggingface.co>

Files changed (1) hide show
  1. README.md +27 -0
README.md CHANGED
@@ -65,6 +65,33 @@ The following weights are automatically downloaded from [here](https://model.baa
65
 
66
  # 示例 Example
67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  以下示例将为文本输入`Anime portrait of natalie portman as an anime girl by stanley artgerm lau, wlop, rossdraws, james jean, andrei riabovitchev, marc simonetti, and sakimichan, trending on artstation` 在目录`./AltDiffusionOutputs`下生成图片结果。
69
 
70
  The following example will generate image results for text input `Anime portrait of natalie portman as an anime girl by stanley artgerm lau, wlop, rossdraws, james jean, andrei riabovitchev, marc simonetti, and sakimichan, trending on artstation` under the default output directory `./AltDiffusionOutputs`
 
65
 
66
  # 示例 Example
67
 
68
+ ## 🧨Diffusers Example
69
+
70
+ **AltDiffusion** has been added to 🧨Diffusers!
71
+ You can see the documentation page [here](https://huggingface.co/docs/diffusers/main/en/api/pipelines/alt_diffusion).
72
+
73
+ The following example will use the fast DPM scheduler to generate an image in ca. 2 seconds on a V100.
74
+
75
+ ```python
76
+ !pip install git+https://github.com/huggingface/diffusers.git torch transformers
77
+ from diffusers import AltDiffusionPipeline, DPMSolverMultistepScheduler
78
+ import torch
79
+
80
+ pipe = AltDiffusionPipeline.from_pretrained("../AltDiffusion", torch_dtype=torch.float16)
81
+ pipe = pipe.to("cuda")
82
+
83
+ pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
84
+
85
+ prompt = "黑暗精灵公主,非常详细,幻想,非常详细,数字绘画,概念艺术,敏锐的焦点,插图"
86
+ # or in English:
87
+ # prompt = "dark elf princess, highly detailed, d & d, fantasy, highly detailed, digital painting, trending on artstation, concept art, sharp focus, illustration, art by artgerm and greg rutkowski and fuji choko and viktoria gavrilenko and hoang lap"
88
+
89
+ image = pipe(prompt, num_inference_steps=25).images[0]
90
+ image.save("./alt.png")
91
+ ```
92
+
93
+ ![alt](https://huggingface.co/datasets/patrickvonplaten/images/resolve/main/hub/alt.png)
94
+
95
  以下示例将为文本输入`Anime portrait of natalie portman as an anime girl by stanley artgerm lau, wlop, rossdraws, james jean, andrei riabovitchev, marc simonetti, and sakimichan, trending on artstation` 在目录`./AltDiffusionOutputs`下生成图片结果。
96
 
97
  The following example will generate image results for text input `Anime portrait of natalie portman as an anime girl by stanley artgerm lau, wlop, rossdraws, james jean, andrei riabovitchev, marc simonetti, and sakimichan, trending on artstation` under the default output directory `./AltDiffusionOutputs`