{"record":{"id":"c456469fb1447f1a","repo":"sgl-project/sglang","slug":"model-directory-model-path-does-not-contain-a-tr","errorCode":null,"errorMessage":"Model directory {model_path} does not contain a transformer/ directory.","messagePattern":"Model directory (.+?) does not contain a transformer/ directory\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/utils/hf_diffusers_utils.py","lineNumber":738,"sourceCode":"        and all(isinstance(item, str) for item in value)\n    ]\n    if component_keys:\n        missing_components = [\n            component_key\n            for component_key in component_keys\n            if not os.path.exists(os.path.join(model_path, component_key))\n        ]\n        if missing_components:\n            missing_str = \", \".join(missing_components)\n            raise ValueError(\n                f\"Model directory {model_path} is missing required component \"\n                f\"directories: {missing_str}.\"\n            )\n    else:\n        transformer_dir = os.path.join(model_path, \"transformer\")\n        vae_dir = os.path.join(model_path, \"vae\")\n        if not os.path.exists(transformer_dir):\n            raise ValueError(\n                f\"Model directory {model_path} does not contain a transformer/ directory.\"\n            )\n        if not os.path.exists(vae_dir):\n            raise ValueError(\n                f\"Model directory {model_path} does not contain a vae/ directory.\"\n            )\n    return cast(dict[str, Any], config)\n\n\ndef _resolve_remote_repo_model_index_path(model_name_or_path: str) -> str:\n    \"\"\"Return a local path to a remote repo's ``model_index.json``\"\"\"\n    try:\n        # Cache-aware: no local_dir, so the selected Hub reuses its cache and\n        # revalidates the remote file when online.\n        return hf_hub_download(repo_id=model_name_or_path, filename=\"model_index.json\")\n    except EntryNotFoundError:\n        # Repo exists but has no model_index.json (single-model repo); let the\n        # caller fall through to the single-model path.","sourceCodeStart":720,"sourceCodeEnd":756,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/utils/hf_diffusers_utils.py#L720-L756","documentation":"Fallback branch of verify_model_config_and_directory for model_index.json without component keys: it then requires a literal transformer/ subdirectory under model_path. Missing directory raises ValueError.","triggerScenarios":"Calling the verifier on a minimal/nonstandard model_index.json while the model directory also lacks a transformer/ folder (e.g. text-encoder-only or VAE-only checkpoints, or misnamed folders like 'unet/').","commonSituations":"Renamed component dirs (unet vs transformer for SD-like models); partial snapshots; pointing at a repo that is not a diffusion transformer pipeline.","solutions":["Ensure the directory containing the transformer weights is named 'transformer' (rename 'unet' where applicable)","Restore/re-download the missing component","Use a proper diffusers repo whose model_index.json declares components so the standard branch applies"],"exampleFix":"# before\n/model/sd3/unet/...\n# after (rename)\nmv /model/sd3/unet /model/sd3/transformer","handlingStrategy":"validation","validationCode":"import os\nassert os.path.isdir(os.path.join(model_path, 'transformer'))","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use standard diffusers component naming (transformer/, vae/)","Validate layout before launching serving"],"tags":["diffusers","model-files","directory-layout"],"backgroundTag":"model-files-missing","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}