{"record":{"id":"49913d3e529e30ab","repo":"unslothai/unsloth","slug":"base-precision-base-precision-r-is-not-validated","errorCode":null,"errorMessage":"base_precision={base_precision!r} is not validated for training {resolved_family}. Use 'nf4', 'int8', 'bf16', or 'auto'.","messagePattern":"base_precision=(.+?) is not validated for training (.+?)\\. Use 'nf4', 'int8', 'bf16', or 'auto'\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"studio/backend/core/training/diffusion_train_common.py","lineNumber":1137,"sourceCode":"            # inference allows it: qwen-image fp8 now renders inside the accuracy gate, but no one has measured whether a\n            # LoRA converges against fp8-frozen linears, so it fails fast here rather than silently training on faith.\n            # MiniMax-H3 runs all three modalities through one set of linears, so the\n            # per-family activation range the fp8 module filter was measured against does not\n            # describe it. Refuse the float8 modes rather than train against a clipped forward.\n            if resolved_family == \"minimax-h3\" and base_precision in (\"fp8\", \"mxfp8\"):\n                raise ValueError(\n                    f\"base_precision={base_precision!r} is not supported for minimax-h3: its \"\n                    f\"packed sequence mixes video, audio and text through one set of linears, \"\n                    f\"so the activation range fp8 was measured against does not apply. Use \"\n                    f\"'nf4', 'int8', 'bf16', or 'auto'.\"\n                )\n            # _family_train_denied, not _family_denied: it is the strict superset (every inference\n            # deny plus the training-only ones), so importing the narrower helper here would let a\n            # scheme cleared only for rendering reach a trainer.\n            from core.inference.diffusion_transformer_quant import _family_train_denied\n\n            if _family_train_denied(resolved_family, base_precision):\n                raise ValueError(\n                    f\"base_precision={base_precision!r} is not validated for training \"\n                    f\"{resolved_family}. Use 'nf4', 'int8', 'bf16', or 'auto'.\"\n                )\n        # flow_shift: None resolves to the family default (\"auto\" only for qwen-image, whose scheduler skips its static shift under use_dynamic_shifting); an explicit value is validated and kept.\n        flow_shift = self.flow_shift\n        if flow_shift is None:\n            flow_shift = \"auto\" if resolved_family in AUTO_FLOW_SHIFT_FAMILIES else 1.0\n        if isinstance(flow_shift, str):\n            flow_shift = flow_shift.strip().lower()\n            if flow_shift != \"auto\":\n                try:\n                    flow_shift = float(flow_shift)\n                except ValueError as exc:\n                    raise ValueError(\n                        f\"flow_shift must be a positive number or 'auto', got {self.flow_shift!r}\"\n                    ) from exc\n        if not isinstance(flow_shift, str):\n            flow_shift = float(flow_shift)","sourceCodeStart":1119,"sourceCodeEnd":1155,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/core/training/diffusion_train_common.py#L1119-L1155","documentation":"Beyond the hard-coded refusals, the trainer consults _family_train_denied(family, precision) from core.inference.diffusion_transformer_quant — the strict superset of inference denials plus training-only holds. If a scheme is cleared for rendering but never measured for LoRA convergence (e.g. qwen-image fp8), it is rejected here rather than trained on faith.","triggerScenarios":"A non-SDXL family with a dense base_precision that passes the bf16-compute and MiniMax gates but is listed in the training-deny table: currently qwen-image with 'fp8' (and any family/scheme pair _family_train_denied returns True for).","commonSituations":"Inference works fine with a quantized checkpoint, so the same quantization is assumed trainable; a new scheme is enabled for inference in a newer release but its training validation lags.","solutions":["Switch base_precision to one of the validated training schemes: 'nf4', 'int8', 'bf16', or 'auto'.","Check core/inference/diffusion_transformer_quant.py's deny tables to see which schemes are training-validated for the family.","If you control the bar, measure LoRA convergence for the scheme on the family and update _family_train_denied deliberately — do not bypass it."],"exampleFix":"# before\ncfg = DiffusionLoraConfig(base_model='Qwen/Qwen-Image', base_precision='fp8', mixed_precision='bf16')\n# after\ncfg = DiffusionLoraConfig(base_model='Qwen/Qwen-Image', base_precision='bf16', mixed_precision='bf16')","handlingStrategy":"validation","validationCode":"from core.inference.diffusion_transformer_quant import _family_train_denied\ndef validated_precision(family, base_precision):\n    bp = str(base_precision or 'nf4').strip().lower()\n    if _family_train_denied(family, bp):\n        raise ValueError(f'{bp} not validated for training {family}')\n    return bp","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Call _family_train_denied in your own preflight so the refusal happens in your UI, not in the trainer.","Track deny-table changes when upgrading: a scheme enabled for inference may still be denied for training."],"tags":["training","precision","validation","diffusion","family-gating"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}