Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ToME + ControlNet is supported and how much is the speed ratio? #462

Open
bigmover opened this issue Mar 12, 2024 · 1 comment
Open

ToME + ControlNet is supported and how much is the speed ratio? #462

bigmover opened this issue Mar 12, 2024 · 1 comment
Assignees

Comments

@bigmover
Copy link

Have you modified the implementation of controlnet to acheive ToME + ControlNet?

@JunnYu
Copy link
Member

JunnYu commented Mar 12, 2024

you can test speed use this code

# install develop paddlemix
pip install git+https://github.com/PaddlePaddle/PaddleMIX.git
# install paddle
pip install paddlepaddle-gpu==0.0.0.post117 -f https://www.paddlepaddle.org.cn/whl/linux/gpu/develop.html
import paddle
from ppdiffusers import ControlNetModel, StableDiffusionControlNetPipeline
from ppdiffusers.utils import load_image

controlnet = ControlNetModel.from_pretrained("lllyasviel/sd-controlnet-canny")
pipe = StableDiffusionControlNetPipeline.from_pretrained(
    "runwayml/stable-diffusion-v1-5", safety_checker=None, controlnet=controlnet, paddle_dtype=paddle.float16
)

# Apply ToMe with a 50% merging ratio
pipe.unet.apply_tome(ratio=0.5) 
pipe.controlnet.apply_tome(ratio=0.5) 

generator = paddle.Generator().manual_seed(0)
prompt = "bird"
image = load_image(
    "https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/sd_controlnet/bird_canny.png"
)

image = pipe(prompt, image, generator=generator).images[0]

image.save("bird.png")

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

No branches or pull requests

2 participants