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

add dpm-solver support (much faster than plms) #440

Merged
merged 2 commits into from
Nov 16, 2022
Merged

Conversation

LuChengTHU
Copy link
Contributor

DPM-Solver (https://github.com/LuChengTHU/dpm-solver) is much faster than PLMS and DDIM, which can generate almost converged samples in only 20-25 steps.

Example images of the difference between DDIM, PLMS, and DPM-Solver can be found in: https://github.com/LuChengTHU/dpm-solver/tree/main/example_v2/stable-diffusion

@LuChengTHU
Copy link
Contributor Author

An example command for sampling by DPM-Solver:

python scripts/txt2img.py --prompt "a photograph of an astronaut riding a horse" --dpm_solver --ddim_steps 25

@rromb rromb merged commit 5a00c4f into CompVis:main Nov 16, 2022
@rromb
Copy link
Collaborator

rromb commented Nov 16, 2022

This is great, thank you very much 👍

Copy link

@rajbala rajbala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used the instructions to install the dependencies:

conda env create -f environment.yaml
conda activate ldm

But I get the following error when I try to run python scripts/txt2img.py --prompt "a photograph of an astronaut riding a horse"

[Traceback (most recent call last):
  File "scripts/txt2img.py", line 20, in <module>
    from ldm.models.diffusion.dpm_solver import DPMSolverSampler
  File "/home/opc/stable-diffusion/ldm/models/diffusion/dpm_solver/__init__.py", line 1, in <module>
    from .sampler import DPMSolverSampler
  File "/home/opc/stable-diffusion/ldm/models/diffusion/dpm_solver/sampler.py", line 5, in <module>
    from .solver import NoiseScheduleVP, model_wrapper, DPM_Solver
ModuleNotFoundError: No module named 'ldm.models.diffusion.dpm_solver.solver'
]

Any ideas as to what is happening?

@rromb
Copy link
Collaborator

rromb commented Nov 16, 2022

should be fixed in 21f890f

@rajbala
Copy link

rajbala commented Nov 16, 2022

It is fixed indeed! :)

smile-struggler pushed a commit to smile-struggler/stable-diffusion that referenced this pull request Jul 5, 2024
add dpm-solver support (much faster than plms)
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

Successfully merging this pull request may close these issues.

3 participants