{"record":{"id":"b469e13d04bfdde6","repo":"sgl-project/sglang","slug":"modelopt-quantization-config-quant-cfg-name-no","errorCode":null,"errorMessage":"ModelOpt quantization config '{quant_cfg_name}' not found. Please verify the ModelOpt library installation.","messagePattern":"ModelOpt quantization config '(.+?)' not found\\. Please verify the ModelOpt library installation\\.","errorType":"exception","errorClass":"AttributeError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/model_loader/loader.py","lineNumber":3953,"sourceCode":"        if hasattr(model_config, \"modelopt_quant\") and model_config.modelopt_quant:\n            # Legacy modelopt_quant flag\n            quant_choice_str = model_config.modelopt_quant\n        else:\n            # Unified quantization flag - extract the type (fp8/fp4)\n            quant_choice_str = model_config._get_modelopt_quant_type()\n\n        quant_cfg_name = QUANT_CFG_CHOICES.get(quant_choice_str)\n        if not quant_cfg_name:\n            raise ValueError(\n                f\"Invalid quantization choice: '{quant_choice_str}'. \"\n                f\"Available choices: {list(QUANT_CFG_CHOICES.keys())}\"\n            )\n\n        try:\n            # getattr will fetch the config object, e.g., mtq.FP8_DEFAULT_CFG\n            quant_cfg = getattr(mtq, quant_cfg_name)\n        except AttributeError:\n            raise AttributeError(\n                f\"ModelOpt quantization config '{quant_cfg_name}' not found. \"\n                \"Please verify the ModelOpt library installation.\"\n            )\n\n        logger.info(\n            f\"Quantizing model with ModelOpt using config: mtq.{quant_cfg_name}\"\n        )\n\n        # Get ModelOpt configuration from LoadConfig\n        modelopt_config = self.load_config.modelopt_config\n        quantized_ckpt_restore_path = (\n            modelopt_config.checkpoint_restore_path if modelopt_config else None\n        )\n        quantized_ckpt_save_path = (\n            modelopt_config.checkpoint_save_path if modelopt_config else None\n        )\n        export_path = modelopt_config.export_path if modelopt_config else None\n        tokenizer = AutoTokenizer.from_pretrained(","sourceCodeStart":3935,"sourceCodeEnd":3971,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/model_loader/loader.py#L3935-L3971","documentation":"After mapping the choice to a name like FP8_DEFAULT_CFG, the loader does getattr(mtq, quant_cfg_name) on the installed modelopt package; AttributeError means the installed modelopt version does not define that config symbol. This is a version skew between the sglang loader and the modelopt library.","triggerScenarios":"sglang expects e.g. mtq.FP8_DEFAULT_CFG or an NVFP4 config that the installed (typically older) nvidia-modelopt does not export; NVFP4 configs notably require recent modelopt builds.","commonSituations":"Old modelopt pinned in a Docker image; new sglang expecting new FP4/FP8 config names; mixing nightly sglang with stable modelopt or vice versa.","solutions":["Upgrade nvidia-modelopt to the version matching your sglang release (check sglang requirements/modelopt Dockerfile)","Verify the symbol: python -c \"import modelopt.torch.quantization as mtq; print(hasattr(mtq, 'FP8_DEFAULT_CFG'))\"","If upgrading modelopt is not possible, downgrade/pin sglang to a version compatible with your modelopt","For FP4 quantization, use a modelopt build with NVFP4 support (recent versions / CUDA 12.8+)"],"exampleFix":"# before\npip install nvidia-modelopt==0.08  # no FP4 config\n# AttributeError: ModelOpt quantization config 'NVFP4_DEFAULT_CFG' not found\n\n# after\npip install -U nvidia-modelopt\npython -c \"import modelopt.torch.quantization as mtq; assert hasattr(mtq,'NVFP4_DEFAULT_CFG')\"","handlingStrategy":"validation","validationCode":"import modelopt.torch.quantization as mtq\nassert hasattr(mtq, quant_cfg_name), (\n    f\"installed modelopt lacks {quant_cfg_name}; upgrade nvidia-modelopt\")","typeGuard":"def modelopt_has_cfg(name: str) -> bool:\n    import modelopt.torch.quantization as mtq\n    return hasattr(mtq, name)","tryCatchPattern":"try:\n    launch(args)\nexcept AttributeError as e:\n    if \"quantization config\" in str(e): print(\"pip install -U nvidia-modelopt\"); raise","preventionTips":["Pin compatible sglang + nvidia-modelopt version pairs","For FP4, verify NVFP4 config exists in the installed modelopt before launch","Add a startup assertion for required mtq symbols"],"tags":["modelopt","version-mismatch","attributeerror","quantization","sglang"],"backgroundTag":"package-version-incompatibility","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}