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 Latent Consistency Models Pipeline #5448

Merged
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
904b7f5
initial commit for LatentConsistencyModelPipeline and LCMScheduler ba…
dg845 Oct 19, 2023
4e25452
Add callback and freeu support.
dg845 Oct 19, 2023
3eec980
apply suggestions from review
dg845 Oct 19, 2023
cadb86b
Clean up LCMScheduler
dg845 Oct 19, 2023
0740f36
Remove timeindex argument to LCMScheduler.step.
dg845 Oct 19, 2023
b960037
Add support for clipping or thresholding the predicted original sample.
dg845 Oct 19, 2023
468511a
Remove unused methods and arguments in LCMScheduler.
dg845 Oct 19, 2023
6b00756
Improve comment about (lack of) negative prompt support.
dg845 Oct 20, 2023
cbc4d55
Change input guidance_scale to match the StableDiffusionPipeline (Ima…
dg845 Oct 20, 2023
e8f65bf
Move lcm_origin_steps from pipeline __call__ to LCMScheduler.__init__…
dg845 Oct 20, 2023
f800547
Fix typo when clipping/thresholding in LCMScheduler.
dg845 Oct 20, 2023
21cb605
Add some initial LCMScheduler tests.
dg845 Oct 20, 2023
ae358ac
add type annotations from review
dg845 Oct 20, 2023
00f4b48
Fix type annotation bug.
dg845 Oct 20, 2023
959e7f8
Override test_add_noise_device in LCMSchedulerTest since hardcoded ti…
dg845 Oct 20, 2023
696d987
Add generator argument pipeline prepare_latents call.
dg845 Oct 20, 2023
43361b7
Cast LCMScheduler.timesteps to long in set_timesteps.
dg845 Oct 20, 2023
13a54b8
Add onestep and multistep full loop scheduler tests.
dg845 Oct 20, 2023
a61b4ae
Set default height/width to None and don't hardcode guidance scale em…
dg845 Oct 20, 2023
3de1465
Add initial LatentConsistencyPipeline fast and slow tests.
dg845 Oct 20, 2023
cd4b0ab
Add initial documentation for LatentConsistencyModelPipeline and LCMS…
dg845 Oct 20, 2023
a321639
Merge branch 'main' into latent-consistency-models-pipeline
sayakpaul Oct 20, 2023
9df89ea
Make remaining failing fast tests pass.
dg845 Oct 23, 2023
0dd2a82
make style
dg845 Oct 23, 2023
cbbd187
Make original_inference_steps configurable from pipeline __call__ again.
dg845 Oct 23, 2023
8868d34
make style
dg845 Oct 23, 2023
92b68b2
Remove guidance_rescale arg from pipeline __call__ since LCM currentl…
dg845 Oct 23, 2023
24c8cad
Make LCMScheduler defaults match config of LCM_Dreamshaper_v7 checkpo…
dg845 Oct 23, 2023
e191555
Fix LatentConsistencyPipeline slow tests and add dummy expected slices.
dg845 Oct 23, 2023
e439118
Add checks for original_steps in LCMScheduler.set_timesteps.
dg845 Oct 24, 2023
516d8fd
make fix-copies
dg845 Oct 24, 2023
e57913d
Improve LatentConsistencyModelPipeline docs.
dg845 Oct 24, 2023
6faa29f
Apply suggestions from code review
patrickvonplaten Oct 24, 2023
b08df59
Apply suggestions from code review
patrickvonplaten Oct 24, 2023
264bd77
Apply suggestions from code review
patrickvonplaten Oct 24, 2023
888b96d
Update src/diffusers/schedulers/scheduling_lcm.py
patrickvonplaten Oct 24, 2023
686c0c0
Apply suggestions from code review
patrickvonplaten Oct 24, 2023
2cd1019
Merge branch 'main' into latent-consistency-models-pipeline
patrickvonplaten Oct 24, 2023
2f2d14c
finish
patrickvonplaten Oct 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/diffusers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
"HeunDiscreteScheduler",
"IPNDMScheduler",
"KarrasVeScheduler",
"LCMScheduler",
"KDPM2AncestralDiscreteScheduler",
"KDPM2DiscreteScheduler",
"PNDMScheduler",
Expand Down Expand Up @@ -226,6 +227,7 @@
"KandinskyV22Pipeline",
"KandinskyV22PriorEmb2EmbPipeline",
"KandinskyV22PriorPipeline",
"LatentConsistencyModelPipeline",
"LDMTextToImagePipeline",
"MusicLDMPipeline",
"PaintByExamplePipeline",
Expand Down Expand Up @@ -499,6 +501,7 @@
KarrasVeScheduler,
KDPM2AncestralDiscreteScheduler,
KDPM2DiscreteScheduler,
LCMScheduler,
PNDMScheduler,
RePaintScheduler,
SchedulerMixin,
Expand Down Expand Up @@ -564,6 +567,7 @@
KandinskyV22Pipeline,
KandinskyV22PriorEmb2EmbPipeline,
KandinskyV22PriorPipeline,
LatentConsistencyModelPipeline,
LDMTextToImagePipeline,
MusicLDMPipeline,
PaintByExamplePipeline,
Expand Down
2 changes: 2 additions & 0 deletions src/diffusers/pipelines/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
"KandinskyV22PriorPipeline",
]
_import_structure["latent_diffusion"].extend(["LDMTextToImagePipeline"])
_import_structure["latent_consistency_models"] = ["LatentConsistencyModelPipeline"]
_import_structure["musicldm"] = ["MusicLDMPipeline"]
_import_structure["paint_by_example"] = ["PaintByExamplePipeline"]
_import_structure["semantic_stable_diffusion"] = ["SemanticStableDiffusionPipeline"]
Expand Down Expand Up @@ -332,6 +333,7 @@
KandinskyV22PriorPipeline,
)
from .latent_diffusion import LDMTextToImagePipeline
from .latent_consistency_models import LatentConsistencyModelPipeline
from .musicldm import MusicLDMPipeline
from .paint_by_example import PaintByExamplePipeline
from .semantic_stable_diffusion import SemanticStableDiffusionPipeline
Expand Down
22 changes: 22 additions & 0 deletions src/diffusers/pipelines/latent_consistency_models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from typing import TYPE_CHECKING

from ...utils import (
_LazyModule,
)


_import_structure = {"pipeline_latent_consistency_models": ["LatentConsistencyModelPipeline"]}


if TYPE_CHECKING:
from .pipeline_latent_consistency_models import LatentConsistencyModelPipeline

else:
import sys

sys.modules[__name__] = _LazyModule(
__name__,
globals()["__file__"],
_import_structure,
module_spec=__spec__,
)

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/diffusers/schedulers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
_import_structure["scheduling_k_dpm_2_ancestral_discrete"] = ["KDPM2AncestralDiscreteScheduler"]
_import_structure["scheduling_k_dpm_2_discrete"] = ["KDPM2DiscreteScheduler"]
_import_structure["scheduling_karras_ve"] = ["KarrasVeScheduler"]
_import_structure["scheduling_lcm"] = ["LCMScheduler"]
_import_structure["scheduling_pndm"] = ["PNDMScheduler"]
_import_structure["scheduling_repaint"] = ["RePaintScheduler"]
_import_structure["scheduling_sde_ve"] = ["ScoreSdeVeScheduler"]
Expand Down Expand Up @@ -145,6 +146,7 @@
from .scheduling_k_dpm_2_ancestral_discrete import KDPM2AncestralDiscreteScheduler
from .scheduling_k_dpm_2_discrete import KDPM2DiscreteScheduler
from .scheduling_karras_ve import KarrasVeScheduler
from .scheduling_lcm import LCMScheduler
from .scheduling_pndm import PNDMScheduler
from .scheduling_repaint import RePaintScheduler
from .scheduling_sde_ve import ScoreSdeVeScheduler
Expand Down
Loading