1
0
Fork 0

load controlnets from network models list

This commit is contained in:
Sean Sube 2023-04-12 08:51:16 -05:00
parent 9e017ee35d
commit 948bec6d0f
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
2 changed files with 9 additions and 6 deletions

View File

@ -280,11 +280,13 @@ def load_pipeline(
) )
if control is not None: if control is not None:
components["controlnet"] = OnnxRuntimeModel(OnnxRuntimeModel.load_model( components["controlnet"] = OnnxRuntimeModel(
control, OnnxRuntimeModel.load_model(
path.join(server.model_path, "control", f"{control}.onnx"),
provider=device.ort_provider(), provider=device.ort_provider(),
sess_options=device.sess_options(), sess_options=device.sess_options(),
)) )
)
pipe = pipeline.from_pretrained( pipe = pipeline.from_pretrained(
model, model,

View File

@ -20,6 +20,7 @@ from .load import (
get_config_value, get_config_value,
get_correction_models, get_correction_models,
get_highres_methods, get_highres_methods,
get_network_models,
get_upscaling_models, get_upscaling_models,
) )
from .utils import get_model_path from .utils import get_model_path
@ -42,13 +43,13 @@ def pipeline_from_request(
device = platform device = platform
# pipeline stuff # pipeline stuff
control = get_not_empty(request.args, "control", get_config_value("control"))
lpw = get_not_empty(request.args, "lpw", "false") == "true" lpw = get_not_empty(request.args, "lpw", "false") == "true"
model = get_not_empty(request.args, "model", get_config_value("model")) model = get_not_empty(request.args, "model", get_config_value("model"))
model_path = get_model_path(server, model) model_path = get_model_path(server, model)
scheduler = get_from_list( scheduler = get_from_list(
request.args, "scheduler", list(pipeline_schedulers.keys()) request.args, "scheduler", list(pipeline_schedulers.keys())
) )
control = get_from_list(request.args, "control", get_network_models())
if scheduler is None: if scheduler is None:
scheduler = get_config_value("scheduler") scheduler = get_config_value("scheduler")