{"record":{"id":"a9dd6bf05b76cd19","repo":"sgl-project/sglang","slug":"bf16-fallback-patterns-are-enabled-but-base-tra","errorCode":null,"errorMessage":"BF16 fallback patterns are enabled, but --base-transformer-dir was not provided.","messagePattern":"BF16 fallback patterns are enabled, but --base-transformer-dir was not provided\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/tools/build_modelopt_fp8_transformer.py","lineNumber":595,"sourceCode":"    is_ltx2_export = _is_ltx2_x0_export(\n        config=config,\n        source_metadata=source_metadata,\n        source_weight_map=source_weight_map_all,\n    )\n    class_name = config.get(\"_class_name\")\n    runtime_name_mapper = _get_runtime_module_name_mapper(\n        model_type=model_type, class_name=class_name\n    )\n    ignore_patterns = list(quant_config.get(\"ignore\", []) or [])\n    patterns = list(\n        get_default_keep_bf16_patterns(model_type=model_type, class_name=class_name)\n    )\n    if is_ltx2_export and model_type == \"auto\":\n        patterns.extend(DEFAULT_LTX2_KEEP_BF16_PATTERNS)\n    if keep_bf16_patterns:\n        patterns.extend(keep_bf16_patterns)\n    if patterns and base_dir is None and not is_ltx2_export:\n        raise ValueError(\n            \"BF16 fallback patterns are enabled, but --base-transformer-dir was not provided.\"\n        )\n\n    output_path = Path(output_dir).expanduser().resolve()\n    if output_path.exists():\n        if not overwrite:\n            raise FileExistsError(\n                f\"Output directory already exists: {output_path}. \"\n                \"Use --overwrite to replace it.\"\n            )\n        shutil.rmtree(output_path)\n    output_path.mkdir(parents=True, exist_ok=True)\n\n    _copy_non_shard_files(source_dir, str(output_path))\n\n    if is_ltx2_export:\n        source_weight_map = {\n            name: filename","sourceCodeStart":577,"sourceCodeEnd":613,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/tools/build_modelopt_fp8_transformer.py#L577-L613","documentation":"BF16 fallback patterns (defaults for LTX2 plus any --keep-bf16 patterns) require reading original BF16 weights via --base-transformer-dir; for non-LTX2 exports the tool refuses to proceed without that directory.","triggerScenarios":"Running the builder on a non-LTX2 ModelOpt export while BF16 keep-patterns are active (explicitly passed) but --base-transformer-dir is omitted.","commonSituations":"Copy-pasting an LTX2-oriented command for another model; intending per-pattern BF16 retention but forgetting to supply the BF16 source.","solutions":["Pass --base-transformer-dir pointing at the original BF16 export (containing transformer/config.json)","Or drop the --keep-bf16* pattern flags if BF16 retention is not needed"],"exampleFix":"# before\nbuild_modelopt_fp8_transformer(..., keep_bf16_patterns=[\"*.bias\"])\n# after\nbuild_modelopt_fp8_transformer(..., keep_bf16_patterns=[\"*.bias\"], base_transformer_dir=\"/data/bf16_export\")","handlingStrategy":"validation","validationCode":"if keep_bf16_patterns and base_transformer_dir is None and not is_ltx2:\n    raise SystemExit(\"BF16 fallback needs --base-transformer-dir\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the original BF16 export path around whenever using keep-bf16 patterns","Wire flag dependencies in argparse post-parse validation"],"tags":["modelopt","fp8","cli","missing-argument"],"backgroundTag":"missing-required-option","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}