Skip to content

Add vae tiling and slicing in img2img and inpaint - #6871

Merged
yiyixuxu merged 2 commits into
huggingface:mainfrom
MrSyee:feat/add-vae-tiling
Feb 8, 2024
Merged

Add vae tiling and slicing in img2img and inpaint#6871
yiyixuxu merged 2 commits into
huggingface:mainfrom
MrSyee:feat/add-vae-tiling

Conversation

@MrSyee

@MrSyeeMrSyee commented Feb 6, 2024

Copy link
Copy Markdown
Contributor

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

@MrSyeeMrSyee changed the title Add vae tiling in img2img and inpaintAdd vae tiling and slicing in img2img and inpaintFeb 6, 2024
@MrSyee

Copy link
Copy Markdown
ContributorAuthor

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

@MrSyee

Copy link
Copy Markdown
ContributorAuthor

Simple test

importtorchfromdiffusersimportAutoPipelineForImage2Imagefromdiffusers.utilsimportload_imagepipe=AutoPipelineForImage2Image.from_pretrained(
"runwayml/stable-diffusion-v1-5",
torch_dtype=torch.float16,
use_safetensors=True,
).to("cuda")
pipe.enable_vae_tiling()
# prepare imageurl="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 pipelineimage=pipe(prompt, image=init_image).images[0]
image.save("./result.png")
  • Result:
    result

@sayakpaulsayakpaul left a comment

Copy link
Copy Markdown
Member

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?

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

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
Copy Markdown
Collaborator

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:mainFeb 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 freeto 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

@MrSyee@HuggingFaceDocBuilderDev@yiyixuxu@sayakpaul