sgl-project/sglang · error · TypeError
Expected Hunyuan3D2PipelineConfig, got {type(config)}
Error message
Expected Hunyuan3D2PipelineConfig, got {type(config)} What it means
Raised by Hunyuan3D2Pipeline.load_modules when server_args.pipeline_config is not a Hunyuan3D2PipelineConfig instance. The pipeline reads component paths (shape model, texture model) exclusively from this typed config, so any other config type (or None) is rejected early with a TypeError rather than failing later with attribute errors.
Source
Thrown at python/sglang/multimodal_gen/runtime/pipelines/hunyuan3d_pipeline.py:505
)
components["delight_scheduler"] = (
EulerAncestralDiscreteScheduler.from_config(delight_scheduler_config)
)
return components
# Module loading override
def load_modules(
self,
server_args: ServerArgs,
loaded_modules: dict[str, torch.nn.Module] | None = None,
) -> dict[str, Any]:
"""Load Hunyuan3D shape and optional texture components."""
del loaded_modules
config = server_args.pipeline_config
if not isinstance(config, Hunyuan3D2PipelineConfig):
raise TypeError(f"Expected Hunyuan3D2PipelineConfig, got {type(config)}")
model_path = config.shape_model_path or server_args.model_path
logger.info("Loading Hunyuan3D shape models from %s", model_path)
config_path, ckpt_path = self._resolve_shape_dir(
model_path,
config.shape_subfolder,
config.shape_use_safetensors,
config.shape_variant,
)
with open(config_path, "r") as f:
model_config = yaml.safe_load(f)
ckpt = self._load_and_split_checkpoint(ckpt_path, config.shape_use_safetensors)
dtype = torch.float16View on GitHub (pinned to 0132848349)
Solutions
- Set server_args.pipeline_config to a Hunyuan3D2PipelineConfig instance before launching the Hunyuan3D pipeline (configure shape_model_path/texture settings on it)
- If constructing ServerArgs manually, import the config from the same module/version of sglang as the pipeline to avoid class-identity mismatches
- Add an isinstance assertion in your launcher right after assigning pipeline_config to fail fast with your own message
Example fix
// before server_args.pipeline_config = None # or generic config pipeline.load_modules(server_args) // after from sglang.multimodal_gen.runtime.pipelines.hunyuan3d_pipeline import Hunyuan3D2PipelineConfig server_args.pipeline_config = Hunyuan3D2PipelineConfig(shape_model_path=...) assert isinstance(server_args.pipeline_config, Hunyuan3D2PipelineConfig) pipeline.load_modules(server_args)
Defensive patterns
Strategy: type-guard
Validate before calling
from sglang.multimodal_gen.runtime.pipelines.hunyuan3d_pipeline import Hunyuan3D2PipelineConfig
if not isinstance(server_args.pipeline_config, Hunyuan3D2PipelineConfig):
server_args.pipeline_config = Hunyuan3D2PipelineConfig(shape_model_path=server_args.model_path) Type guard
def is_hunyuan3d_config(cfg: object) -> TypeGuard[Hunyuan3D2PipelineConfig]:
return isinstance(cfg, Hunyuan3D2PipelineConfig) Prevention
- Always construct the typed pipeline config in the same launch function that selects the pipeline
- Add an isinstance assertion on pipeline_config right after building ServerArgs
- Import config classes from the same sglang version as the pipeline to avoid identity mismatch
When it happens
Trigger: Calling load_modules(server_args) on the Hunyuan3D pipeline when server_args.pipeline_config is None, a generic PipelineConfig, or a config belonging to a different model family; e.g. launching the server with --pipeline hunyuan3d but without constructing Hunyuan3D2PipelineConfig in server args.
Common situations: Server args built programmatically or reused from another model's launch path; a default pipeline_config left as None; tests instantiating the pipeline with bare ServerArgs; version changes that renamed or moved the config class so an old import produces a lookalike object.
Related errors
- JoyEchoPipeline requires JoyEchoPipelineConfig, got {type(co
- Unknown serve backend {name!r}. Available values: {available
- Multiple distributions register serve backend {name!r}: {pro
- Failed to load serve backend {name!r} from {self._entry_poin
- Serve backend {name!r} factory returned {type(backend).__nam
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/95c0a05bc9da96c9.
Report an issue: GitHub.