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

DDIM sampling do not use x0_strength, and always iterate for ddim_steps=20, time consuming. #133

Open
Sutongtong233 opened this issue Jun 6, 2024 · 1 comment

Comments

@Sutongtong233
Copy link

for i, step in enumerate(iterator):

When the x0_strength is small, it will be a long waste of time to reach
if strength >= 0 and i == int(

Previous blended img is useless,
img = self.model.q_sample(x0, ts)

Maybe we can directly:

for i, step in enumerate(time_range):
    index = total_steps - i - 1
    if strength >= 0 and i == int(total_steps * strength) and x0 is not None:
        ts = torch.full((b, ), step, device=device, dtype=torch.long)
        break
img = self.model.q_sample(x0, ts)

to get xt, and then denoise from this timestep. For controller, we always fetch the last item:

x0 = F.instance_norm(x0) * self.step_store['first_ada'][-1] + self.step_store['first_ada'][-2]
@williamyang1991
Copy link
Owner

Yes, we just use this naive implementation for quick code devolopement.
In our diffusers implementation, we have fixed this wasting iterations

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