Update README.md
Browse files
README.md
CHANGED
|
@@ -63,6 +63,37 @@ According to our evaluation, Stable Cascade performs best in both prompt alignme
|
|
| 63 |
comparisons. The above picture shows the results from a human evaluation using a mix of parti-prompts (link) and
|
| 64 |
aesthetic prompts. Specifically, the comparison was held against Playground v2, SDXL Turbo, SDXL and Würstchen v2.
|
| 65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
## Uses
|
| 68 |
|
|
|
|
| 63 |
comparisons. The above picture shows the results from a human evaluation using a mix of parti-prompts (link) and
|
| 64 |
aesthetic prompts. Specifically, the comparison was held against Playground v2, SDXL Turbo, SDXL and Würstchen v2.
|
| 65 |
|
| 66 |
+
## Code Example
|
| 67 |
+
```python
|
| 68 |
+
import torch
|
| 69 |
+
from diffusers import StableCascadeDecoderPipeline, StableCascadePriorPipeline
|
| 70 |
+
|
| 71 |
+
device = "cuda"
|
| 72 |
+
dtype = torch.bfloat16
|
| 73 |
+
num_images_per_prompt = 2
|
| 74 |
+
|
| 75 |
+
prior = StableCascadePriorPipeline.from_pretrained("stabilityai/stable-cascade", torch_dtype=dtype).to(device)
|
| 76 |
+
decoder = StableCascadeDecoderPipeline.from_pretrained("stabilityai/stable-cascade", torch_dtype=dtype).to(device)
|
| 77 |
+
|
| 78 |
+
prompt = "Anthropomorphic cat dressed as a pilot"
|
| 79 |
+
negative_prompt = ""
|
| 80 |
+
|
| 81 |
+
prior_output = prior_pipeline(
|
| 82 |
+
prompt=caption,
|
| 83 |
+
height=1024,
|
| 84 |
+
width=1024,
|
| 85 |
+
negative_prompt=negative_prompt,
|
| 86 |
+
guidance_scale=4.0,
|
| 87 |
+
num_images_per_prompt=num_images_per_prompt,
|
| 88 |
+
)
|
| 89 |
+
decoder_output = decoder_pipeline(
|
| 90 |
+
image_embeddings=prior_output.image_embeddings,
|
| 91 |
+
prompt=caption,
|
| 92 |
+
negative_prompt=negative_prompt,
|
| 93 |
+
guidance_scale=0.0,
|
| 94 |
+
output_type="pil",
|
| 95 |
+
).images
|
| 96 |
+
```
|
| 97 |
|
| 98 |
## Uses
|
| 99 |
|