{"record":{"id":"45cbee3523dd9dd9","repo":"sgl-project/sglang","slug":"no-model-architectures-are-specified","errorCode":null,"errorMessage":"No model architectures are specified","messagePattern":"No model architectures are specified","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/models/mindspore.py","lineNumber":38,"sourceCode":"\n_is_npu = is_npu()\n\nif _is_npu:\n    import mindspore as ms\n    import numpy as np\n    import torch_npu\n    from mindspore import Tensor, mint, mutable\n\nlogger = logging.getLogger(__name__)\n\n\ndef _get_arch_from_config(config):\n    mindspore_models = import_model_classes(\"sgl_mindspore.models\")\n    architectures = getattr(config, \"architectures\", [])\n    if isinstance(architectures, str):\n        architectures = [architectures]\n    if not architectures:\n        raise ValueError(\"No model architectures are specified\")\n    for arch in architectures:\n        if arch in mindspore_models:\n            return mindspore_models[arch]\n    raise ValueError(f\"Unsupported arch {architectures}\")\n\n\ndef tensor_torch2ms(x: torch.Tensor):\n    if x is None or not isinstance(x, torch.Tensor):\n        return x\n\n    # torch tensor -> dlpack -> mindspore tensor\n    pt_dlpack = torch.utils.dlpack.to_dlpack(x)\n    ms_tensor = ms.utils.dlpack.from_dlpack(pt_dlpack)\n    return ms_tensor\n\n\ndef tensor_ms2torch(x: ms.Tensor):\n    if x is None or not isinstance(x, ms.Tensor):","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/models/mindspore.py#L20-L56","documentation":"The MindSpore model loader requires at least one architecture in config.architectures to select an implementation from sgl_mindspore.models. An empty/missing list fails immediately with this ValueError.","triggerScenarios":"Calling get_arch or get_model_config_for_expert_location with a config whose 'architectures' field is absent, empty, or an empty string.","commonSituations":"Hand-written or stripped config.json missing the architectures key; configs from tools that drop metadata; passing a raw HF config dict without architectures.","solutions":["Add the architecture name to config.json, e.g. \"architectures\": [\"MiMoV2ForCausalLM\"]","Verify the config file passed to the loader is the full model config, not a partial/truncated one","If loading from a dict, ensure 'architectures' is a non-empty list of supported class names"],"exampleFix":"// before\n{}\n// after\n{\"architectures\": [\"SomeMindSporeModelForCausalLM\"]}","handlingStrategy":"validation","validationCode":"archs = getattr(config, 'architectures', None) or []\nif isinstance(archs, str):\n    archs = [archs]\nif not archs:\n    raise SystemExit('config.json is missing \"architectures\"')","typeGuard":"def has_architectures(cfg) -> bool:\n    a = getattr(cfg, 'architectures', None)\n    return bool(a) and bool(a if isinstance(a, list) else [a])","tryCatchPattern":null,"preventionTips":["Always ship the full config.json with architectures from the source model","Sanity-check config fields before calling get_arch"],"tags":["config-validation","mindspore","model-loading"],"backgroundTag":"missing-config-field","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}