Ketengan-Diffusion
commited on
Update README.md
Browse files
README.md
CHANGED
@@ -102,8 +102,46 @@ And the text encoder you download from our huggingface repo on text_encoder fold
|
|
102 |
|
103 |
# Deplying SomniumSC v1.1 with Diffusers 🧨
|
104 |
|
105 |
-
|
106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
|
108 |
# SomniumSC Pro tips:
|
109 |
|
|
|
102 |
|
103 |
# Deplying SomniumSC v1.1 with Diffusers 🧨
|
104 |
|
105 |
+
⚠️ Warning: You must install this diffusers branch to make the code working to using Stable Cascade architecture
|
106 |
+
|
107 |
+
```
|
108 |
+
git+https://github.com/kashif/diffusers.git@a3dc21385b7386beb3dab3a9845962ede6765887
|
109 |
+
```
|
110 |
+
|
111 |
+
Deploying the simple SomniumSC-V1.1 inference
|
112 |
+
|
113 |
+
import torch
|
114 |
+
from diffusers import StableCascadeDecoderPipeline, StableCascadePriorPipeline
|
115 |
+
|
116 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
117 |
+
num_images_per_prompt = 1
|
118 |
+
print(f"Running on: {device}")
|
119 |
+
|
120 |
+
prior = StableCascadePriorPipeline.from_pretrained("stabilityai/stable-cascade-prior", torch_dtype=torch.bfloat16).to(device)
|
121 |
+
decoder = StableCascadeDecoderPipeline.from_pretrained("stabilityai/stable-cascade", torch_dtype=torch.float16).to(device)
|
122 |
+
|
123 |
+
prompt = "An Astronout riding a horse"
|
124 |
+
negative_prompt = ""
|
125 |
+
|
126 |
+
prior_output = prior(
|
127 |
+
prompt=prompt,
|
128 |
+
height=1024,
|
129 |
+
width=1024,
|
130 |
+
negative_prompt=negative_prompt,
|
131 |
+
guidance_scale=12.0,
|
132 |
+
num_images_per_prompt=num_images_per_prompt,
|
133 |
+
num_inference_steps=50
|
134 |
+
)
|
135 |
+
decoder_output = decoder(
|
136 |
+
image_embeddings=prior_output.image_embeddings.half(),
|
137 |
+
prompt=prompt,
|
138 |
+
negative_prompt=negative_prompt,
|
139 |
+
guidance_scale=1.0,
|
140 |
+
output_type="pil",
|
141 |
+
num_inference_steps=10
|
142 |
+
).images
|
143 |
+
|
144 |
+
```
|
145 |
|
146 |
# SomniumSC Pro tips:
|
147 |
|