haozheliu-st / t-gate Goto Github PK
View Code? Open in Web Editor NEWT-GATE: Temporally Gating Attention to Accelerate Diffusion Model for Free!
License: MIT License
T-GATE: Temporally Gating Attention to Accelerate Diffusion Model for Free!
License: MIT License
I tried to implement a version of comfyui's T-GATE but seemed to encounter some problems. The quality of the generated image declined after the apply the node.
this is the repo: https://github.com/JettHu/ComfyUI_TGate
Hello, thank you for your excellent work. Your work considers the redundancy of crossattn and uses the cache approach to solve the above problem, and finally achieves the speedup of the generation. As far as I know, the computational cost of self-attn and ffn is larger than that of cross-attn. However, it is pointed out in the paper that t-gate can achieve nearly 40% speedup with only cache cross-attn. How such a high speedup is achieved, if I have some misunderstanding of the technology. I would appreciate it if you could help me solve this confusion. Thanks! 🌹
Therefore, it is actually difficult to improve the speed of models with very few noise reduction steps, such as turbo or lightning models.
When the image generated by sdxl and sd1.5 is 515512, tgate can achieve a nearly 50% improvement. However, when I increase the resolution to 10241024, the performance improvement is only about 10%.
Hi!
Thanks for your amazing work.
Playground-v2.5-1024 is a stronger T2I model based on the SD-XL architecture.
(https://huggingface.co/playgroundai/playground-v2.5-1024px-aesthetic)
I try to use the follow code to speed up the model, but the result seems terrible.
import torch
from diffusers import StableDiffusionXLPipeline
pipe = StableDiffusionXLPipeline.from_pretrained(
"playgroundai/playground-v2.5-1024px-aesthetic",
torch_dtype=torch.float16,
variant="fp16",
use_safetensors=True,
)
from tgate import TgateSDXLLoader
gate_step = 10
inference_step = 25
pipe = TgateSDXLLoader(
pipe,
gate_step=gate_step,
num_inference_steps=inference_step,
)
pipe = pipe.to("cuda")
prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k."
image = pipe.tgate(
prompt,
gate_step=gate_step,
num_inference_steps=inference_step
).images[0]
image.save(f"{prompt}.png")
Is there any way to solve the problem?
I am looking for your reply.
sorry
Hi! Thank you for the amazing work.
I encounter the ValueError when performing multiple forward inferences:
Here's the testing code I used:
pipe = TgateSDLoader(
pipe,
gate_step=gate_step,
num_inference_steps=inference_step
).to("cuda")
start_time = time.time()
for _ in range(infer_times):
tagate_image = pipe.tgate(
prompt,
gate_step=gate_step,
num_inference_steps=inference_step
).images
latency = (time.time() - start_time) / infer_times
logging.info("T-GATE: {:.2f} seconds".format(latency))
Hope you can resolve this issue.
I have found several examples about T-GATE on Diffusers. But I don't know whether T-GATE is avaible for use with controlnet in SD. Any reply will be appreciated!
Hi,
thank you for your indepth analysis,
could you open source how to compute the cross-attention Difference code given in Figue 2 ?
Hi! I'am trying to reproduce results of T_GATE (FID metric) that described in your technical report using SDXL model, DPM scheduler with 25 inference steps and gate step is 10. I'am using MS_COCO 256x256 benchmark from https://github.com/Nota-NetsPresso/BK-SDM.git repository and got very big FID instead of 22.738 that presented in your paper on arxiv. Other metrics that I measure like Inception score and CLIP score is normal. Can you please provide more information about hyperparameters (guidance scale for example), image resolution? What captions used for generation (full validation set from MSCOCO-2014 or MSCOCO-2017, or maybe some subset from them) and what real images was used to measure FID between real and generated samples?
May I ask if you are planning to pull the ComfyUI project and add this important research to ComfyUI?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.