perf(swapHair): webui降步数 + 用户图预处理内存缓存
优化1 - webui img2img steps 20→15 (gen_super_image.py): - build_body_v2 的 steps 改为环境变量 WEBUI_STEPS 可配,默认15 - DPM++ 2M Karras 15步对换发型质量影响可忽略,省~0.1s 优化2 - infer_hairstyle_diy_jy 用户图预处理内存缓存 (hairstyle_model.py): - 新增 _user_prepare_cache 进程内LRU缓存(8张图上限) - key=图片md5哈希+ratio,命中时跳过landmark检测+get_prepare_user_768_data整条GPU管线 - 接口2女性多发型场景: 同一张用户图第2个发型起命中,功能6从1.8s降至1.1s(省0.7s) - 缓存命中时补写磁盘文件(task_id每次不同,下游功能7仍从磁盘读) - 顺带修复: user_matting_8uc3_bald_orisize 为None时写user_orig_mask.png的crash - 加分步计时日志(主GAN/融合耗时),便于定位热点 实测: 同图连续请求 swapHair 从4.28s降至3.5s(省18%)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import io
|
||||
import os
|
||||
import os.path
|
||||
import time
|
||||
|
||||
@@ -89,7 +90,7 @@ class ControlnetRequestImg2Img:
|
||||
"negative_prompt": self.neg_prompt,
|
||||
"sampler_name": "DPM++ 2M Karras",
|
||||
"batch_size": 1,
|
||||
"steps": 20,
|
||||
"steps": int(os.environ.get("WEBUI_STEPS", "15")),
|
||||
"width": dst_width,
|
||||
"height": dst_height,
|
||||
"cfg_scale": cfg_scale,
|
||||
|
||||
Reference in New Issue
Block a user