diff --git a/modules/async_worker.py b/modules/async_worker.py index fd785f07..1faba66e 100644 --- a/modules/async_worker.py +++ b/modules/async_worker.py @@ -250,6 +250,25 @@ def worker(): adm_scaler_negative = 1.0 adm_scaler_end = 0.0 + elif performance_selection == Performance.LIGHTNING: + print('Enter Lightning mode.') + progressbar(async_task, 1, 'Downloading Lightning components ...') + loras += [(modules.config.downloading_sdxl_lightning_lora(), 1.0)] + + if refiner_model_name != 'None': + print(f'Refiner disabled in Lightning mode.') + + refiner_model_name = 'None' + sampler_name = 'euler' + scheduler_name = 'sgm_uniform' + sharpness = 0.0 + guidance_scale = 1.0 + adaptive_cfg = 1.0 + refiner_switch = 1.0 + adm_scaler_positive = 1.0 + adm_scaler_negative = 1.0 + adm_scaler_end = 0.0 + print(f'[Parameters] Adaptive CFG = {adaptive_cfg}') print(f'[Parameters] Sharpness = {sharpness}') print(f'[Parameters] ControlNet Softness = {controlnet_softness}') diff --git a/modules/config.py b/modules/config.py index 09c8fd7c..35b10fab 100644 --- a/modules/config.py +++ b/modules/config.py @@ -475,6 +475,7 @@ with open(config_example_path, "w", encoding="utf-8") as json_file: model_filenames = [] lora_filenames = [] sdxl_lcm_lora = 'sdxl_lcm_lora.safetensors' +sdxl_lightning_lora = 'sdxl_lightning_4step_lora.safetensors' def get_model_filenames(folder_paths, name_filter=None): @@ -538,6 +539,14 @@ def downloading_sdxl_lcm_lora(): ) return sdxl_lcm_lora +def downloading_sdxl_lightning_lora(): + load_file_from_url( + url='https://huggingface.co/ByteDance/SDXL-Lightning/resolve/main/sdxl_lightning_4step_lora.safetensors', + model_dir=paths_loras[0], + file_name=sdxl_lightning_lora + ) + return sdxl_lightning_lora + def downloading_controlnet_canny(): load_file_from_url( diff --git a/modules/flags.py b/modules/flags.py index 6f12bc8f..3fe7b2ef 100644 --- a/modules/flags.py +++ b/modules/flags.py @@ -89,8 +89,6 @@ metadata_scheme = [ (f'{MetadataScheme.A1111.value} (plain text)', MetadataScheme.A1111.value), ] -lora_count = 5 - controlnet_image_count = 4 @@ -98,18 +96,21 @@ class Steps(IntEnum): QUALITY = 60 SPEED = 30 EXTREME_SPEED = 8 + LIGHTNING = 4 class StepsUOV(IntEnum): QUALITY = 36 SPEED = 18 EXTREME_SPEED = 8 + LIGHTNING = 4 class Performance(Enum): QUALITY = 'Quality' SPEED = 'Speed' EXTREME_SPEED = 'Extreme Speed' + LIGHTNING = 'Lightning' @classmethod def list(cls) -> list: