{"record":{"id":"60319f9c7839e7f3","repo":"sgl-project/sglang","slug":"unsupported-model-type-model-type","errorCode":null,"errorMessage":"Unsupported model type: {model_type}","messagePattern":"Unsupported model type: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/apps/ComfyUI_SGLDiffusion/core/generator.py","lineNumber":146,"sourceCode":"        if model_options is None:\n            model_options = {}\n        dtype = model_options.get(\"dtype\", None)\n        # Allow loading unets from checkpoint files\n        sd = load_torch_file(model_path)\n        diffusion_model_prefix = model_detection.unet_prefix_from_state_dict(sd)\n        temp_sd = state_dict_prefix_replace(\n            sd, {diffusion_model_prefix: \"\"}, filter_keys=True\n        )\n        if len(temp_sd) > 0:\n            sd = temp_sd\n\n        parameters = calculate_parameters(sd)\n        load_device = model_management.get_torch_device()\n\n        model_detect_config = model_detection.detect_unet_config(sd, \"\")\n        model_type = model_detect_config.get(\"image_model\", None)\n        if model_type is None or model_type not in self.pipeline_class_dict:\n            raise ValueError(f\"Unsupported model type: {model_type}\")\n        model_config = model_detection.model_config_from_unet(sd, \"\")\n\n        if model_config is not None:\n            new_sd = sd\n        else:\n            new_sd = model_detection.convert_diffusers_mmdit(sd, \"\")\n            if new_sd is not None:  # diffusers mmdit\n                model_config = model_detection.model_config_from_unet(new_sd, \"\")\n                if model_config is None:\n                    return None\n            else:  # diffusers unet\n                model_config = model_detection.model_config_from_diffusers_unet(sd)\n                if model_config is None:\n                    return None\n\n                diffusers_keys = unet_to_diffusers(model_config.unet_config)\n                new_sd = {}\n                for k in diffusers_keys:","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/apps/ComfyUI_SGLDiffusion/core/generator.py#L128-L164","documentation":"In the ComfyUI SGLDiffusion generator, get_comfyui_model inspects the raw state dict with ComfyUI's model_detection to determine image_model type, then requires that type to be a key in pipeline_class_dict (the set of pipelines SGLDiffusion supports). Unknown or undetectable model architectures raise ValueError.","triggerScenarios":"Loading a checkpoint whose detect_unet_config returns an image_model value not present in self.pipeline_class_dict (e.g. an architecture ComfyUI knows but this backend doesn't map), or returns None because the checkpoint format is unrecognized.","commonSituations":"Dropping a new/exotic diffusion checkpoint (e.g. Flux variants, unconverted Diffusers uploads) into ComfyUI and trying to run it through the SGLang diffusion backend; using a checkpoint saved in a format detect_unet_config can't parse.","solutions":["Check the supported model types by printing self.pipeline_class_dict and use a checkpoint of a supported architecture","Re-save/convert the checkpoint in standard ComfyUI format so model_detection can identify it","Update sglang/ComfyUI-SGLDiffusion to a version that adds your architecture to pipeline_class_dict"],"exampleFix":"# before\nsd = safetensors.load_file(\"new_arch.safetensors\")\ngenerator.load_model(\"new_arch.safetensors\")  # raises\n\n# after\n# convert to a supported architecture or update pipeline_class_dict\nprint(generator.pipeline_class_dict)  # pick a supported model type\ngenerator.load_model(\"supported_flux_dev.safetensors\")","handlingStrategy":"try-catch","validationCode":"supported = set(generator.pipeline_class_dict.keys())\n# detect type the same way before loading\nfrom comfy import model_detection\nsd = safetensors.load_file(path)\nt = model_detection.detect_unet_config(sd, \"\").get(\"image_model\")\nif t not in supported:\n    raise SystemExit(f\"{path} is {t}; supported: {supported}\")","typeGuard":null,"tryCatchPattern":"try:\n    generator.load_model(path)\nexcept ValueError as e:\n    if \"Unsupported model type\" in str(e):\n        # fall back to a known-good checkpoint or report to user\n        raise SystemExit(f\"Unsupported: {e}\")\n    raise","preventionTips":["Whitelist checkpoints at import time against pipeline_class_dict","Keep ComfyUI-SGLDiffusion updated when new architectures land"],"tags":["comfyui","diffusion","model-loading","unsupported-architecture"],"backgroundTag":"unsupported-model-architecture","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}