-
Notifications
You must be signed in to change notification settings - Fork 10.3k
TAG: Tangential Amplifying Guidance #10403
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
base: master
Are you sure you want to change the base?
Conversation
|
This doesn’t seem like TAG. TAG splits the solver’s updates (DDIM, DPM, etc.) into normal and tangential components. Since it runs after a sampling step, the post-CFG level probably cannot handle this. |
|
Well, I used the code straight from the repo: https://github.com/hyeon-cho/Tangential-Amplifying-Guidance/blob/74005bdd265c0a6d85099ab234b22b437ff6c774/pipelines/pipeline_tag_stablediffusion3.py#L375-L396 latents_dtype = latents.dtype
output = self.scheduler.step(noise_pred, t, latents, return_dict=False)[0]
if t <= sta_tpd and t >= end_tpd:
post_latents = latents
v_t_2d = post_latents / (post_latents.norm(p=2, dim=(1,2,3), keepdim=True) + 1e-8)
latents = output
delta_latents = latents - post_latents
delta_unit = (delta_latents * v_t_2d).sum(dim=(1,2,3), keepdim=True)
normal_update_vector = delta_unit * v_t_2d
tangential_update_vector = delta_latents - normal_update_vector
eta_v = t_guidance_scale
eta_n = r_guidance_scale
latents = post_latents + \
eta_v * tangential_update_vector + \
eta_n * normal_update_vector
else: # [NOTE] Simple Path (equal to original)
latents = outputI don't see it requires extra steps. "sampler_post_cfg_function" is the end function of all samplers, basically just after the sampler's step technically Lines 353 to 390 in b4f30bd
|
In diffusers, a scheduler's Simplified Euler in comfy (k-diffusion) as example: The post-CFG functions occur during the call to |
This Pull Request implements "TAG: Tangential Amplifying Guidance for Hallucination-Resistant Diffusion Sampling" from https://huggingface.co/papers/2510.04533.
The code is organized in the same manner as the vanilla TCFG node with the similar, but different concept.
Tangential Amplifying Guidance (TAG) improves diffusion model sample quality by directly amplifying tangential components of estimated scores without modifying the model architecture.
Source code: https://github.com/hyeon-cho/Tangential-Amplifying-Guidance. Project page: https://hyeon-cho.github.io/TAG/
Examples (Flux):
Closes #10323.