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

Trajectory Consistency Distillation Support #2985

Open
jesenzhang opened this issue Mar 6, 2024 · 19 comments
Open

Trajectory Consistency Distillation Support #2985

jesenzhang opened this issue Mar 6, 2024 · 19 comments

Comments

@jesenzhang
Copy link

Trajectory Consistency Distillation needs a confyui native TCDScheduler
https://github.com/jabir-zheng/TCD
https://huggingface.co/h1t/TCD-SDXL-LoRA

@dfl
Copy link

dfl commented Mar 7, 2024

I have attempted this but need a little help finishing it!
jabir-zheng/TCD#7

@comfyanonymous
Copy link
Owner

ComfyUI_162708_
I'm getting some success sampling this with euler ancestral while adjusting the eta of the sampler. The workflow should be attached to the image.

@jesenzhang
Copy link
Author

ComfyUI_162708_ I'm getting some success sampling this with euler ancestral while adjusting the eta of the sampler. The workflow should be attached to the image.

I have already tried it,and it would not work with '--force-fp16'.
image

@MoonRide303
Copy link
Contributor

Workflow that works pretty fine for me (with SDXL-Lightning variant):

MoonRide SDXL-Lightning+TCD workflow v1.json

image

@lucianosb
Copy link

Workflow that works pretty fine for me (with SDXL-Lightning variant):

MoonRide SDXL-Lightning+TCD workflow v1.json

I also tested this with my own base SDXL model merge. It worked fine!

I just couldn't make it work with the DPMPP_3M_SDE Sampler, I'll keep exploring.

Thank you so much!

@wangfeng35
Copy link

tcd is awesome! Hope it will be supported.

@dfl
Copy link

dfl commented Mar 24, 2024

I have this working pretty well with a modified Euler A sampler: https://github.com/dfl/comfyui-tcd-scheduler

however AFAICT the reference diffusers implementation uses modified DDPM. I haven't yet figured out how to properly rescale the samples with that though. dfl/comfyui-tcd-scheduler#3

Also:

In the diffusers implementation I get these values for 8 steps before they are modified by gamma:
timesteps: [999, 879, 759, 639, 499, 379, 259, 139]
sigmas: [0.9977, 0.9912, 0.9735, 0.9349, 0.8499, 0.7359, 0.5840, 0.3961]

However in comfy the timesteps are slightly different... is this to be expected due to minor differences in implementation frameworks?
[... 876, 751, 626, 501, 376, 251, 126, 1]

@dfl
Copy link

dfl commented Mar 26, 2024

someone asked about an img2img workflow... are there any extant nodes to extend this for img2img without rewriting the native KSampler?

Also opened up the question of how TCD might ever be natively integrated. Given my current understanding of the ComyfUI architecture, I don't see how sending additional KSampler parameters like TCD's gamma/eta could be possible... @comfyanonymous what are your thoughts/advice on this please? dfl/comfyui-tcd-scheduler#4 (comment)

I think the general notion of blending between stochastic and deterministic is pretty cool, and could be useful even without the TCD LoRA, just with more typical/traditional sampling steps.

@let-me-cook
Copy link

New Hyper-SD (Trajectory Segmented Consistency Distillation) from bytedance apparently runs atop of diffusers's TCDScheduler aswell.
https://hyper-sd.github.io/

@YanzuoLu
Copy link

New Hyper-SD (Trajectory Segmented Consistency Distillation) from bytedance apparently runs atop of diffusers's TCDScheduler aswell. https://hyper-sd.github.io/

Yes we adopt the TCDScheduler on our unified LoRAs.
And we find the corresponding implementation from @dfl in ComfyUI does not generate proper outcomes when step size is 1 or 2. https://github.com/dfl/comfyui-tcd-scheduler
Can anyone help? We are the AutoML team from ByteDance and want to integrate our unified LoRAs into ComfyUI and provide more workflows. Thanks a lot!
@lucianosb @wangfeng35 @jesenzhang @let-me-cook @dfl

@let-me-cook
Copy link

let-me-cook commented Apr 24, 2024

Not a dev so i will tag comfy instead @comfyanonymous, sir comfy please do the needful sirs

@hahy36
Copy link

hahy36 commented Apr 28, 2024

@comfyanonymous
I also have the same need.
Althought third-party plugins can achieve some of the functions of TCD ,but they lack the 'denoise'.

@dfl
Copy link

dfl commented Apr 28, 2024

Native KSampler does not support extra parameters like TCD’s Gamma.

@JettHu
Copy link
Contributor

JettHu commented Apr 28, 2024

I've implemented another tcd comfyui node. repo: https://github.com/JettHu/ComfyUI-TCD

@YanzuoLu
Copy link

@JettHu Nice done, friend!
We have tested it on our Hyper-SD and it works perfect!!!
We will soon update it on our HF page. Thanks for your great job!

@JettHu
Copy link
Contributor

JettHu commented Apr 28, 2024

@YanzuoLu I am preparing to submit a PR for comfyui to add tcd to the comfyui official scheduler.

@JettHu
Copy link
Contributor

JettHu commented Apr 28, 2024

Because the default KSampler(KSamplerAdvanced) lacks the eta parameter, the current implementation has to use SamplerCustom (otherwise the default 0.3 is used) to see if the author is willing to add an additional eta parameter.

image

@JettHu
Copy link
Contributor

JettHu commented Apr 28, 2024

@JettHu Nice done, friend! We have tested it on our Hyper-SD and it works perfect!!! We will soon update it on our HF page. Thanks for your great job!

So does Hyper-SD also need to use tcd scheduler? I am happy to provide some help.

@YanzuoLu
Copy link

@JettHu
Yes, our 1-step unified lora is able to inference on 1-8 steps with the help of TCDScheduler within single checkpoint!
And we found previous implementation of it behaves differently from diffusers and your implementation works great!
Thanks for your help!

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

10 participants