MCPcopy
hub / github.com/lllyasviel/Fooocus / handler

Function handler

modules/async_worker.py:1071–1463  ·  view source on GitHub ↗
(async_task: AsyncTask)

Source from the content-addressed store, hash-verified

1069 @torch.no_grad()
1070 @torch.inference_mode()
1071 def handler(async_task: AsyncTask):
1072 preparation_start_time = time.perf_counter()
1073 async_task.processing = True
1074
1075 async_task.outpaint_selections = [o.lower() for o in async_task.outpaint_selections]
1076 base_model_additional_loras = []
1077 async_task.uov_method = async_task.uov_method.casefold()
1078 async_task.enhance_uov_method = async_task.enhance_uov_method.casefold()
1079
1080 if fooocus_expansion in async_task.style_selections:
1081 use_expansion = True
1082 async_task.style_selections.remove(fooocus_expansion)
1083 else:
1084 use_expansion = False
1085
1086 use_style = len(async_task.style_selections) > 0
1087
1088 if async_task.base_model_name == async_task.refiner_model_name:
1089 print(f'Refiner disabled because base model and refiner are same.')
1090 async_task.refiner_model_name = 'None'
1091
1092 current_progress = 0
1093 if async_task.performance_selection == Performance.EXTREME_SPEED:
1094 set_lcm_defaults(async_task, current_progress, advance_progress=True)
1095 elif async_task.performance_selection == Performance.LIGHTNING:
1096 set_lightning_defaults(async_task, current_progress, advance_progress=True)
1097 elif async_task.performance_selection == Performance.HYPER_SD:
1098 set_hyper_sd_defaults(async_task, current_progress, advance_progress=True)
1099
1100 print(f'[Parameters] Adaptive CFG = {async_task.adaptive_cfg}')
1101 print(f'[Parameters] CLIP Skip = {async_task.clip_skip}')
1102 print(f'[Parameters] Sharpness = {async_task.sharpness}')
1103 print(f'[Parameters] ControlNet Softness = {async_task.controlnet_softness}')
1104 print(f'[Parameters] ADM Scale = '
1105 f'{async_task.adm_scaler_positive} : '
1106 f'{async_task.adm_scaler_negative} : '
1107 f'{async_task.adm_scaler_end}')
1108 print(f'[Parameters] Seed = {async_task.seed}')
1109
1110 apply_patch_settings(async_task)
1111
1112 print(f'[Parameters] CFG = {async_task.cfg_scale}')
1113
1114 initial_latent = None
1115 denoising_strength = 1.0
1116 tiled = False
1117
1118 width, height = async_task.aspect_ratios_selection.replace('×', ' ').split(' ')[:2]
1119 width, height = int(width), int(height)
1120
1121 skip_prompt_processing = False
1122
1123 inpaint_worker.current_task = None
1124 inpaint_parameterized = async_task.inpaint_engine != 'None'
1125 inpaint_image = None
1126 inpaint_mask = None
1127 inpaint_head_model_path = None
1128

Callers 1

workerFunction · 0.85

Calls 15

logFunction · 0.90
generate_mask_from_imageFunction · 0.90
SAMOptionsClass · 0.90
erode_or_dilateFunction · 0.90
set_lcm_defaultsFunction · 0.85
set_lightning_defaultsFunction · 0.85
set_hyper_sd_defaultsFunction · 0.85
apply_patch_settingsFunction · 0.85
apply_image_inputFunction · 0.85
progressbarFunction · 0.85
apply_overridesFunction · 0.85
process_promptFunction · 0.85

Tested by

no test coverage detected