Text-to-Image
stable-diffusion

Add diffusers release code

#2
Files changed (1) hide show
  1. README.md +30 -0
README.md CHANGED
@@ -66,6 +66,36 @@ Using the model to generate content that is cruel to individuals is a misuse of
66
  - Sharing of copyrighted or licensed material in violation of its terms of use.
67
  - Sharing content that is an alteration of copyrighted or licensed material in violation of its terms of use.
68
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  ## Limitations and Bias
70
 
71
  ### Limitations
 
66
  - Sharing of copyrighted or licensed material in violation of its terms of use.
67
  - Sharing content that is an alteration of copyrighted or licensed material in violation of its terms of use.
68
 
69
+ ## Diffusers
70
+
71
+ As soon as you have been added to this organization you can use stable diffusion out of the box!
72
+
73
+ Example:
74
+
75
+ ```python
76
+ # make sure you're logged in with `huggingface-cli login`
77
+ from torch import autocast
78
+ from diffusers import StableDiffusionPipeline, LMSDiscreteScheduler
79
+
80
+ lms = LMSDiscreteScheduler(
81
+ beta_start=0.00085,
82
+ beta_end=0.012,
83
+ beta_schedule="scaled_linear"
84
+ )
85
+
86
+ pipe = StableDiffusionPipeline.from_pretrained(
87
+ "CompVis/stable-diffusion-v1-3-diffusers",
88
+ scheduler=lms,
89
+ use_auth_token=True
90
+ )
91
+
92
+ prompt = "a photo of an astronaut riding a horse on mars"
93
+ with autocast("cuda"):
94
+ image = pipe(prompt, width=768, guidance_scale=7)["sample"][0]
95
+
96
+ image.save("astronaut_rides_horse.png")
97
+ ```
98
+
99
  ## Limitations and Bias
100
 
101
  ### Limitations