From 6b7cf3f3bedb8c8ab04dfe1cbaba34a2ec485f93 Mon Sep 17 00:00:00 2001 From: Sergey Borisov Date: Sat, 17 Jun 2023 21:00:16 +0300 Subject: [PATCH] Add lms and dpmpp2_s karras scheduler --- invokeai/backend/install/legacy_arg_parsing.py | 2 ++ invokeai/backend/stable_diffusion/schedulers/schedulers.py | 6 ++++-- invokeai/backend/web/modules/parameters.py | 2 ++ invokeai/frontend/web/src/app/constants.ts | 2 ++ .../web/src/services/api/models/InpaintInvocation.ts | 2 +- .../src/services/api/models/LatentsToLatentsInvocation.ts | 2 +- .../web/src/services/api/models/TextToLatentsInvocation.ts | 2 +- 7 files changed, 13 insertions(+), 5 deletions(-) diff --git a/invokeai/backend/install/legacy_arg_parsing.py b/invokeai/backend/install/legacy_arg_parsing.py index 85ca588fe2..b4f3ab1186 100644 --- a/invokeai/backend/install/legacy_arg_parsing.py +++ b/invokeai/backend/install/legacy_arg_parsing.py @@ -9,6 +9,7 @@ SAMPLER_CHOICES = [ "ddpm", "deis", "lms", + "lms_k", "pndm", "heun", "heun_k", @@ -18,6 +19,7 @@ SAMPLER_CHOICES = [ "kdpm_2", "kdpm_2_a", "dpmpp_2s", + "dpmpp_2s_k", "dpmpp_2m", "dpmpp_2m_k", "unipc", diff --git a/invokeai/backend/stable_diffusion/schedulers/schedulers.py b/invokeai/backend/stable_diffusion/schedulers/schedulers.py index 08f85cf559..d8da143962 100644 --- a/invokeai/backend/stable_diffusion/schedulers/schedulers.py +++ b/invokeai/backend/stable_diffusion/schedulers/schedulers.py @@ -7,7 +7,8 @@ SCHEDULER_MAP = dict( ddim=(DDIMScheduler, dict()), ddpm=(DDPMScheduler, dict()), deis=(DEISMultistepScheduler, dict()), - lms=(LMSDiscreteScheduler, dict()), + lms=(LMSDiscreteScheduler, dict(use_karras_sigmas=False)), + lms_k=(LMSDiscreteScheduler, dict(use_karras_sigmas=True)), pndm=(PNDMScheduler, dict()), heun=(HeunDiscreteScheduler, dict(use_karras_sigmas=False)), heun_k=(HeunDiscreteScheduler, dict(use_karras_sigmas=True)), @@ -16,7 +17,8 @@ SCHEDULER_MAP = dict( euler_a=(EulerAncestralDiscreteScheduler, dict()), kdpm_2=(KDPM2DiscreteScheduler, dict()), kdpm_2_a=(KDPM2AncestralDiscreteScheduler, dict()), - dpmpp_2s=(DPMSolverSinglestepScheduler, dict()), + dpmpp_2s=(DPMSolverSinglestepScheduler, dict(use_karras_sigmas=False)), + dpmpp_2s_k=(DPMSolverSinglestepScheduler, dict(use_karras_sigmas=True)), dpmpp_2m=(DPMSolverMultistepScheduler, dict(use_karras_sigmas=False)), dpmpp_2m_k=(DPMSolverMultistepScheduler, dict(use_karras_sigmas=True)), unipc=(UniPCMultistepScheduler, dict(cpu_only=True)) diff --git a/invokeai/backend/web/modules/parameters.py b/invokeai/backend/web/modules/parameters.py index 9a4bc0aec3..9b00093a44 100644 --- a/invokeai/backend/web/modules/parameters.py +++ b/invokeai/backend/web/modules/parameters.py @@ -7,6 +7,7 @@ SAMPLER_CHOICES = [ "ddpm", "deis", "lms", + "lms_k", "pndm", "heun", 'heun_k', @@ -16,6 +17,7 @@ SAMPLER_CHOICES = [ "kdpm_2", "kdpm_2_a", "dpmpp_2s", + "dpmpp_2s_k", "dpmpp_2m", "dpmpp_2m_k", "unipc", diff --git a/invokeai/frontend/web/src/app/constants.ts b/invokeai/frontend/web/src/app/constants.ts index c2e525ad7d..3506bafac2 100644 --- a/invokeai/frontend/web/src/app/constants.ts +++ b/invokeai/frontend/web/src/app/constants.ts @@ -3,10 +3,12 @@ export const SCHEDULERS = [ 'ddim', 'lms', + 'lms_k', 'euler', 'euler_k', 'euler_a', 'dpmpp_2s', + 'dpmpp_2s_k', 'dpmpp_2m', 'dpmpp_2m_k', 'kdpm_2', diff --git a/invokeai/frontend/web/src/services/api/models/InpaintInvocation.ts b/invokeai/frontend/web/src/services/api/models/InpaintInvocation.ts index b8ed268ef9..7eb0039c87 100644 --- a/invokeai/frontend/web/src/services/api/models/InpaintInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/InpaintInvocation.ts @@ -45,7 +45,7 @@ export type InpaintInvocation = { /** * The scheduler to use */ - scheduler?: 'ddim' | 'ddpm' | 'deis' | 'lms' | 'pndm' | 'heun' | 'heun_k' | 'euler' | 'euler_k' | 'euler_a' | 'kdpm_2' | 'kdpm_2_a' | 'dpmpp_2s' | 'dpmpp_2m' | 'dpmpp_2m_k' | 'unipc'; + scheduler?: 'ddim' | 'ddpm' | 'deis' | 'lms' | 'lms_k' | 'pndm' | 'heun' | 'heun_k' | 'euler' | 'euler_k' | 'euler_a' | 'kdpm_2' | 'kdpm_2_a' | 'dpmpp_2s' | 'dpmpp_2s_k' | 'dpmpp_2m' | 'dpmpp_2m_k' | 'unipc'; /** * The model to use (currently ignored) */ diff --git a/invokeai/frontend/web/src/services/api/models/LatentsToLatentsInvocation.ts b/invokeai/frontend/web/src/services/api/models/LatentsToLatentsInvocation.ts index 60504459e7..174d368178 100644 --- a/invokeai/frontend/web/src/services/api/models/LatentsToLatentsInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/LatentsToLatentsInvocation.ts @@ -42,7 +42,7 @@ export type LatentsToLatentsInvocation = { /** * The scheduler to use */ - scheduler?: 'ddim' | 'ddpm' | 'deis' | 'lms' | 'pndm' | 'heun' | 'heun_k' | 'euler' | 'euler_k' | 'euler_a' | 'kdpm_2' | 'kdpm_2_a' | 'dpmpp_2s' | 'dpmpp_2m' | 'dpmpp_2m_k' | 'unipc'; + scheduler?: 'ddim' | 'ddpm' | 'deis' | 'lms' | 'lms_k' | 'pndm' | 'heun' | 'heun_k' | 'euler' | 'euler_k' | 'euler_a' | 'kdpm_2' | 'kdpm_2_a' | 'dpmpp_2s' | 'dpmpp_2s_k' | 'dpmpp_2m' | 'dpmpp_2m_k' | 'unipc'; /** * The model to use (currently ignored) */ diff --git a/invokeai/frontend/web/src/services/api/models/TextToLatentsInvocation.ts b/invokeai/frontend/web/src/services/api/models/TextToLatentsInvocation.ts index 2db0657e25..117533f106 100644 --- a/invokeai/frontend/web/src/services/api/models/TextToLatentsInvocation.ts +++ b/invokeai/frontend/web/src/services/api/models/TextToLatentsInvocation.ts @@ -42,7 +42,7 @@ export type TextToLatentsInvocation = { /** * The scheduler to use */ - scheduler?: 'ddim' | 'ddpm' | 'deis' | 'lms' | 'pndm' | 'heun' | 'heun_k' | 'euler' | 'euler_k' | 'euler_a' | 'kdpm_2' | 'kdpm_2_a' | 'dpmpp_2s' | 'dpmpp_2m' | 'dpmpp_2m_k' | 'unipc'; + scheduler?: 'ddim' | 'ddpm' | 'deis' | 'lms' | 'lms_k' | 'pndm' | 'heun' | 'heun_k' | 'euler' | 'euler_k' | 'euler_a' | 'kdpm_2' | 'kdpm_2_a' | 'dpmpp_2s' | 'dpmpp_2s_k' | 'dpmpp_2m' | 'dpmpp_2m_k' | 'unipc'; /** * The model to use (currently ignored) */