[diffusion] fix: fix missing backend argument in pipelines_core initialization (#17343)
This commit is contained in:
@@ -547,7 +547,7 @@ class PipelineConfig:
|
|||||||
f"using {pipeline_config_cls.__name__} directly without model_index.json"
|
f"using {pipeline_config_cls.__name__} directly without model_index.json"
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
model_info = get_model_info(model_path)
|
model_info = get_model_info(model_path, backend=kwargs.get("backend"))
|
||||||
if model_info is None:
|
if model_info is None:
|
||||||
from sglang.multimodal_gen.registry import (
|
from sglang.multimodal_gen.registry import (
|
||||||
_PIPELINE_CONFIG_REGISTRY,
|
_PIPELINE_CONFIG_REGISTRY,
|
||||||
@@ -563,7 +563,7 @@ class PipelineConfig:
|
|||||||
)
|
)
|
||||||
pipeline_config_cls = model_info.pipeline_config_cls
|
pipeline_config_cls = model_info.pipeline_config_cls
|
||||||
else:
|
else:
|
||||||
model_info = get_model_info(model_path)
|
model_info = get_model_info(model_path, backend=kwargs.get("backend"))
|
||||||
if model_info is None:
|
if model_info is None:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
f"Could not get model info for '{model_path}'. "
|
f"Could not get model info for '{model_path}'. "
|
||||||
|
|||||||
@@ -417,14 +417,17 @@ class SamplingParams:
|
|||||||
def from_pretrained(cls, model_path: str, **kwargs) -> "SamplingParams":
|
def from_pretrained(cls, model_path: str, **kwargs) -> "SamplingParams":
|
||||||
from sglang.multimodal_gen.registry import get_model_info
|
from sglang.multimodal_gen.registry import get_model_info
|
||||||
|
|
||||||
model_info = get_model_info(model_path)
|
backend = kwargs.pop("backend", None)
|
||||||
|
model_info = get_model_info(model_path, backend=backend)
|
||||||
sampling_params: SamplingParams = model_info.sampling_param_cls(**kwargs)
|
sampling_params: SamplingParams = model_info.sampling_param_cls(**kwargs)
|
||||||
return sampling_params
|
return sampling_params
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def from_user_sampling_params_args(model_path: str, server_args, *args, **kwargs):
|
def from_user_sampling_params_args(model_path: str, server_args, *args, **kwargs):
|
||||||
try:
|
try:
|
||||||
sampling_params = SamplingParams.from_pretrained(model_path)
|
sampling_params = SamplingParams.from_pretrained(
|
||||||
|
model_path, backend=server_args.backend
|
||||||
|
)
|
||||||
except (AttributeError, ValueError) as e:
|
except (AttributeError, ValueError) as e:
|
||||||
# Handle safetensors files or other cases where model_index.json is not available
|
# Handle safetensors files or other cases where model_index.json is not available
|
||||||
# Use appropriate SamplingParams based on pipeline_class_name from registry
|
# Use appropriate SamplingParams based on pipeline_class_name from registry
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ async def available_models():
|
|||||||
if not server_args:
|
if not server_args:
|
||||||
raise HTTPException(status_code=500, detail="Server args not initialized")
|
raise HTTPException(status_code=500, detail="Server args not initialized")
|
||||||
|
|
||||||
model_info = get_model_info(server_args.model_path)
|
model_info = get_model_info(server_args.model_path, backend=server_args.backend)
|
||||||
|
|
||||||
card_kwargs = {
|
card_kwargs = {
|
||||||
"id": server_args.model_path,
|
"id": server_args.model_path,
|
||||||
@@ -222,7 +222,7 @@ async def retrieve_model(model: str):
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
model_info = get_model_info(server_args.model_path)
|
model_info = get_model_info(server_args.model_path, backend=server_args.backend)
|
||||||
|
|
||||||
card_kwargs = {
|
card_kwargs = {
|
||||||
"id": model,
|
"id": model,
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ def build_pipeline(
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
logger.info("No pipeline_class_name specified, using model_index.json")
|
logger.info("No pipeline_class_name specified, using model_index.json")
|
||||||
model_info = get_model_info(model_path)
|
model_info = get_model_info(model_path, backend=server_args.backend)
|
||||||
pipeline_cls = model_info.pipeline_cls
|
pipeline_cls = model_info.pipeline_cls
|
||||||
logger.info(f"Using pipeline from model_index.json: {pipeline_cls.__name__}")
|
logger.info(f"Using pipeline from model_index.json: {pipeline_cls.__name__}")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user