152334H / tortoise-tts-fast

Fast TorToiSe inference (5x or your money back!)
GNU Affero General Public License v3.0
771 stars 179 forks source link

Implement samplers correctly #2

Open 152334H opened 1 year ago

152334H commented 1 year ago
Ryu1845 commented 1 year ago

@152334H thoughts about https://github.com/wl-zhao/UniPC ?

Ryu1845 commented 1 year ago

Examples on images https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/7710

152334H commented 1 year ago

Their project says they support $\epsilon_\theta(x_t, t)$ models, so I'll give it a go

Their code in https://github.com/wl-zhao/UniPC/blob/main/example/stable-diffusion/ldm/models/diffusion/uni_pc/uni_pc.py also seems very similar to the DPM-Solver repo, which i'll be integrating soon, so that's good

152334H commented 1 year ago

on a related note, I realised a few days ago (thanks to mrq) that my implementation of k-diffusion was actually completely wrong.

I'll be adding code that actually runs dpm++2m correctly in about an hour (the K diffusion integration is most likely screwed), then I can go for uniPC

152334H commented 1 year ago

I'll write a larger blog about this later, but to clarify, this is what happened:

tldr: past samplers were fake; dpm++2m is now experimental but real, DDIM+cond_free is preferable for steps < 20 until better samplers exist.

Consequently, I'm making DDIM the default sampler for ultra_fast for now, and have created a new preset (very_fast) that uses DPM++2M with more steps.

All claims stated here only apply to fp32 inference; I have no idea what the results are like on --half yet.

diichen commented 1 month ago

It seems you should:

  1. use GaussianDiffusion instead of SpacedDiffusion.
  2. use discrete NoiseScheduleVP instead of continuous NoiseScheduleVP.
152334H commented 1 month ago

well. yes. a bit late for that now though

diichen commented 1 month ago

Have you tried any other solver or Rectified Flow for diffusion inference speed up?

152334H commented 1 month ago

I don't actually work on this project anymore

diichen commented 1 month ago

ok, Thanks for your work, it helps me a lot.