add microsoft lens

Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
Vladimir Mandic
2026-05-23 09:49:42 +02:00
parent 5f04d472ce
commit 9fc858d75e
19 changed files with 1785 additions and 5 deletions
+2
View File
@@ -94,6 +94,8 @@ def get_model_type(pipe):
model_type = 'kolors'
elif 'Meissonic' in name:
model_type = 'meissonic'
elif 'LensPipeline' in name:
model_type = 'lens'
elif 'Qwen' in name:
model_type = 'qwen'
elif 'ErnieImage' in name or 'ERNIE-Image' in name:
+2
View File
@@ -99,6 +99,8 @@ def guess_by_name(fn, current_guess):
new_guess = 'FLUX2 Klein'
elif 'flux.2' in fn.lower():
new_guess = 'FLUX2'
elif 'lens' in fn.lower():
new_guess = 'Lens'
elif 'ultraflux' in fn.lower():
new_guess = 'UltraFlux'
elif 'flux' in fn.lower() or 'flex.1' in fn.lower():
+4
View File
@@ -486,6 +486,10 @@ def load_diffuser_force(detected_model_type, checkpoint_info, diffusers_load_con
from pipelines.model_hunyuandit import load_hunyuandit
sd_model = load_hunyuandit(checkpoint_info, diffusers_load_config)
allow_post_quant = False
elif model_type in ['Lens']:
from pipelines.model_lens import load_lens
sd_model = load_lens(checkpoint_info, diffusers_load_config)
allow_post_quant = False
elif model_type in ['Kandinsky 2.1']:
from pipelines.model_kandinsky import load_kandinsky21
sd_model = load_kandinsky21(checkpoint_info, diffusers_load_config)
+9
View File
@@ -54,6 +54,7 @@ pipelines = {
'ERNIE-Image': getattr(diffusers, 'ErnieImagePipeline', None),
'Nucleus-Image': getattr(diffusers, 'NucleusMoEImagePipeline', None),
'Z-Image': getattr(diffusers, 'ZImagePipeline', None),
'Lens': getattr(diffusers, 'LensPipeline', None),
'FLUX2': getattr(diffusers, 'Flux2Pipeline', None),
'FLUX2 Klein': getattr(diffusers, 'Flux2KleinPipeline', None),
'LongCat': getattr(diffusers, 'LongCatImagePipeline', None),
@@ -142,6 +143,12 @@ def get_pipelines():
log.error(f'ONNX initialization error: {e}')
onnx_pipelines = {}
pipelines.update(onnx_pipelines)
if 'Lens' in pipelines and pipelines['Lens'] is None:
try:
import pipelines.lens as _lens
pipelines['Lens'] = getattr(diffusers, 'LensPipeline', None)
except Exception:
pass
for k, v in pipelines.items():
if k != 'Autodetect' and v is None:
from modules.logger import log
@@ -158,6 +165,8 @@ def get_repo(model):
return 'stabilityai/stable-diffusion-3.5-medium'
elif model == 'FluxPipeline' or model == 'FLUX':
return 'black-forest-labs/FLUX.1-dev'
elif model == 'LensPipeline' or model == 'Lens':
return 'microsoft/Lens'
else:
return None
+2
View File
@@ -113,6 +113,8 @@ def create_settings(cmd_opts):
"model_qwen_layers": OptionInfo(2, "Qwen layered number of layers", gr.Slider, {"minimum": 2, "maximum": 9, "step": 1 }),
"model_ernie_sep": OptionInfo("<h2>ERNIE-Image</h2>", "", gr.HTML),
"model_ernie_enable_pe": OptionInfo(False, "Enable prompt-enhance"),
"model_lens_sep": OptionInfo("<h2>Lens</h2>", "", gr.HTML),
"model_lens_enable_pe": OptionInfo(False, "Enable prompt-enhance"),
}))
# --- Model Offloading ---
+1 -1
View File
@@ -71,7 +71,7 @@ def get_model(model_cls, variant=None):
elif model_cls in {'f1', 'h1', 'zimage', 'lumina2', 'chroma', 'longcat', 'omnigen2', 'flite', 'ovis', 'kandinsky5', 'glmimage', 'cogview3', 'cogview4', 'ultraflux'}:
model_cls = 'f1'
variant = 'TAE FLUX.1'
elif model_cls in {'f2', 'ernieimage'}:
elif model_cls in {'f2', 'ernieimage', 'lens'}:
model_cls = 'f2'
variant = 'TAE FLUX.2'
elif model_cls in {'sd3'}: