Skip to content

Commit ca8e4c0

Browse files
committed
clean up example code and add line back in to pipeline_stable_diffusion for imagic pipeline
1 parent 983e032 commit ca8e4c0

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

examples/community/README.md

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# Community Examples
2-
3-
> **For more information about community pipelines, please have a look at [this issue](https://github.com/huggingface/diffusers/issues/841).**
1+
# Community Examples > **For more information about community pipelines, please have a look at [this issue](https://github.com/huggingface/diffusers/issues/841).**
42

53
**Community** examples consist of both inference and training examples that have been added by the community.
64
Please have a look at the following table to get an overview of all community examples. Click on the **Code Example** to get a copy-and-paste ready code example that you can try out.
@@ -392,8 +390,6 @@ Allows you to edit an image using stable diffusion.
392390

393391

394392
```python
395-
396-
397393
import torch as th
398394
import numpy as np
399395
import requests
@@ -419,6 +415,7 @@ pipe = DiffusionPipeline.from_pretrained(
419415
).to(device)
420416

421417

418+
<<<<<<< HEAD
422419
>>>>>>> initial commit to add imagic to stable diffusion community pipelines
423420
def dummy(images, **kwargs):
424421
return images, False
@@ -490,13 +487,11 @@ image.save('./seed_resize/seed_resize_{w}_{h}_image_compare.png'.format(w=width,
490487
```
491488
=======
492489
images = []
490+
=======
491+
>>>>>>> clean up example code and add line back in to pipeline_stable_diffusion for imagic pipeline
493492
generator = th.Generator("cuda").manual_seed(0)
494-
495493
seed = 0
496494
prompt = "A photo of Barack Obama smiling with a big grin"
497-
498-
images = []
499-
500495
url = 'https://www.dropbox.com/s/6tlwzr73jd1r9yk/obama.png?dl=1'
501496

502497
response = requests.get(url)

src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ def __call__(
264264
f" {self.tokenizer.model_max_length} tokens: {removed_text}"
265265
)
266266
text_input_ids = text_input_ids[:, : self.tokenizer.model_max_length]
267+
text_embeddings = self.text_encoder(text_input_ids.to(self.device))[0]
267268

268269
# duplicate text embeddings for each generation per prompt, using mps friendly method
269270
bs_embed, seq_len, _ = text_embeddings.shape

0 commit comments

Comments
 (0)