mirror of
https://github.com/lllyasviel/Fooocus.git
synced 2026-08-16 13:13:16 +02:00
feat: add support for playground v2.5 (#3073)
* feat: add support for playground v2.5 * feat: add preset for playground v2.5 * feat: change URL to mashb1t * feat: optimize playground v2.5 preset
This commit is contained in:
+22
-5
@@ -828,16 +828,33 @@ def worker():
|
||||
|
||||
if scheduler_name in ['lcm', 'tcd']:
|
||||
final_scheduler_name = 'sgm_uniform'
|
||||
if pipeline.final_unet is not None:
|
||||
pipeline.final_unet = core.opModelSamplingDiscrete.patch(
|
||||
|
||||
def patch_discrete(unet):
|
||||
return core.opModelSamplingDiscrete.patch(
|
||||
pipeline.final_unet,
|
||||
sampling=scheduler_name,
|
||||
zsnr=False)[0]
|
||||
|
||||
if pipeline.final_unet is not None:
|
||||
pipeline.final_unet = patch_discrete(pipeline.final_unet)
|
||||
if pipeline.final_refiner_unet is not None:
|
||||
pipeline.final_refiner_unet = core.opModelSamplingDiscrete.patch(
|
||||
pipeline.final_refiner_unet,
|
||||
pipeline.final_refiner_unet = patch_discrete(pipeline.final_refiner_unet)
|
||||
print(f'Using {scheduler_name} scheduler.')
|
||||
elif scheduler_name == 'edm_playground_v2.5':
|
||||
final_scheduler_name = 'karras'
|
||||
|
||||
def patch_edm(unet):
|
||||
return core.opModelSamplingContinuousEDM.patch(
|
||||
unet,
|
||||
sampling=scheduler_name,
|
||||
zsnr=False)[0]
|
||||
sigma_max=120.0,
|
||||
sigma_min=0.002)[0]
|
||||
|
||||
if pipeline.final_unet is not None:
|
||||
pipeline.final_unet = patch_edm(pipeline.final_unet)
|
||||
if pipeline.final_refiner_unet is not None:
|
||||
pipeline.final_refiner_unet = patch_edm(pipeline.final_refiner_unet)
|
||||
|
||||
print(f'Using {scheduler_name} scheduler.')
|
||||
|
||||
async_task.yields.append(['preview', (flags.preparation_step_count, 'Moving model to GPU ...', None)])
|
||||
|
||||
+2
-2
@@ -21,8 +21,7 @@ from modules.lora import match_lora
|
||||
from modules.util import get_file_from_folder_list
|
||||
from ldm_patched.modules.lora import model_lora_keys_unet, model_lora_keys_clip
|
||||
from modules.config import path_embeddings
|
||||
from ldm_patched.contrib.external_model_advanced import ModelSamplingDiscrete
|
||||
|
||||
from ldm_patched.contrib.external_model_advanced import ModelSamplingDiscrete, ModelSamplingContinuousEDM
|
||||
|
||||
opEmptyLatentImage = EmptyLatentImage()
|
||||
opVAEDecode = VAEDecode()
|
||||
@@ -32,6 +31,7 @@ opVAEEncodeTiled = VAEEncodeTiled()
|
||||
opControlNetApplyAdvanced = ControlNetApplyAdvanced()
|
||||
opFreeU = FreeU_V2()
|
||||
opModelSamplingDiscrete = ModelSamplingDiscrete()
|
||||
opModelSamplingContinuousEDM = ModelSamplingContinuousEDM()
|
||||
|
||||
|
||||
class StableDiffusionModel:
|
||||
|
||||
+1
-2
@@ -48,8 +48,7 @@ SAMPLERS = KSAMPLER | SAMPLER_EXTRA
|
||||
|
||||
KSAMPLER_NAMES = list(KSAMPLER.keys())
|
||||
|
||||
SCHEDULER_NAMES = ["normal", "karras", "exponential", "sgm_uniform", "simple", "ddim_uniform", "lcm", "turbo",
|
||||
"align_your_steps", "tcd"]
|
||||
SCHEDULER_NAMES = ["normal", "karras", "exponential", "sgm_uniform", "simple", "ddim_uniform", "lcm", "turbo", "align_your_steps", "tcd", "edm_playground_v2.5"]
|
||||
SAMPLER_NAMES = KSAMPLER_NAMES + list(SAMPLER_EXTRA.keys())
|
||||
|
||||
sampler_list = SAMPLER_NAMES
|
||||
|
||||
@@ -51,8 +51,6 @@ def patched_register_schedule(self, given_betas=None, beta_schedule="linear", ti
|
||||
self.linear_end = linear_end
|
||||
sigmas = torch.tensor(((1 - alphas_cumprod) / alphas_cumprod) ** 0.5, dtype=torch.float32)
|
||||
self.set_sigmas(sigmas)
|
||||
alphas_cumprod = torch.tensor(alphas_cumprod, dtype=torch.float32)
|
||||
self.set_alphas_cumprod(alphas_cumprod)
|
||||
return
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user