Skip to content

Conversation

@MrSyee
Copy link
Contributor

@MrSyee MrSyee commented Feb 6, 2024

What does this PR do?

Fixes #6870

Before submitting

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@patrickvonplaten and @sayakpaul

@MrSyee MrSyee changed the title Add vae tiling in img2img and inpaint Add vae tiling and slicing in img2img and inpaint Feb 6, 2024
@MrSyee
Copy link
Contributor Author

MrSyee commented Feb 6, 2024

I've added vae slicing together. How can I test?

@MrSyee
Copy link
Contributor Author

MrSyee commented Feb 6, 2024

Simple test

import torch
from diffusers import AutoPipelineForImage2Image
from diffusers.utils import load_image

pipe = AutoPipelineForImage2Image.from_pretrained(
    "runwayml/stable-diffusion-v1-5",
    torch_dtype=torch.float16,
    use_safetensors=True,
).to("cuda")
pipe.enable_vae_tiling()

# prepare image
url = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/img2img-init.png"
init_image = load_image(url)

prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"

# pass prompt and image to pipeline
image = pipe(prompt, image=init_image).images[0]
image.save("./result.png")
  • Result:
    result

Copy link
Member

@sayakpaul sayakpaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! @yiyixuxu, I think it's okay to not add a test here. WDYT?

@sayakpaul sayakpaul requested a review from yiyixuxu February 7, 2024 05:51
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@yiyixuxu
Copy link
Collaborator

yiyixuxu commented Feb 8, 2024

yes I think we don't need add tests here since it's #copied from and we already have tests for stable diffusion pipeline

@yiyixuxu yiyixuxu merged commit d643b66 into huggingface:main Feb 8, 2024
@MrSyee MrSyee deleted the feat/add-vae-tiling branch February 9, 2024 17:11
AmericanPresidentJimmyCarter pushed a commit to AmericanPresidentJimmyCarter/diffusers that referenced this pull request Apr 26, 2024
* Add vae tiling in img2img and inpaint

* Add vae tiling not slicing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

enable_vae_tiling is not found SD image to image and inpaint pipeline

4 participants