{"record":{"id":"5c2cbfa767e4e716","repo":"sgl-project/sglang","slug":"error-model-type-requires-a-value","errorCode":null,"errorMessage":"Error: --model-type requires a value.","messagePattern":"Error: --model-type requires a value\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/cli/serve.py","lineNumber":37,"sourceCode":"\nlogger = logging.getLogger(__name__)\n\n\ndef _extract_model_type_override(extra_argv):\n    \"\"\"Extract and remove the backend selector from argv.\n\n    Validation is deferred to :class:`ServeBackendRegistry` because installed\n    out-of-tree entry points dynamically extend the accepted values.\n    \"\"\"\n\n    backend_name = \"auto\"\n    filtered_argv = []\n    i = 0\n    while i < len(extra_argv):\n        arg = extra_argv[i]\n        if arg == \"--model-type\":\n            if i + 1 >= len(extra_argv):\n                raise ValueError(\"Error: --model-type requires a value.\")\n            backend_name = extra_argv[i + 1]\n            i += 2\n            continue\n\n        if arg.startswith(\"--model-type=\"):\n            backend_name = arg.split(\"=\", 1)[1]\n            i += 1\n            continue\n\n        filtered_argv.append(arg)\n        i += 1\n\n    if not backend_name:\n        raise ValueError(\"Error: --model-type requires a non-empty value.\")\n    return backend_name, filtered_argv\n\n\ndef _normalize_positional_model_path(extra_argv):","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/cli/serve.py#L19-L55","documentation":"In the BFloat16 branch (gated by __HIP_ARCH__ >= 800), deterministic_all_reduce requires bf16 element counts divisible by the pack width P::size.","triggerScenarios":"Calling deterministic allreduce with a bfloat16 tensor whose numel is not a multiple of the pack width.","commonSituations":"bf16 models with hidden dims not divisible by the pack width; sliced/dynamic-shape tensors in deterministic mode on ROCm.","solutions":["Pad to a multiple of the pack width and slice after","Choose hidden sizes divisible by 8","Use RCCL for non-conforming tensors"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"d = 8  # bf16 pack width\nassert out.numel() % d == 0, f'size must be multiple of {d}'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pad bf16 tensors to pack multiples","Ensure hardware is gfx8+ for bf16 kernels"],"tags":["rocm","allreduce","deterministic","alignment","bfloat16"],"backgroundTag":"size-alignment-mismatch","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}