{"record":{"id":"14e138708f46428e","repo":"hiyouga/LlamaFactory","slug":"this-device-does-not-support-pure-bf16","errorCode":null,"errorMessage":"This device does not support `pure_bf16`.","messagePattern":"This device does not support `pure_bf16`\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/llamafactory/hparams/parser.py","lineNumber":500,"sourceCode":"    ):\n        raise ValueError(\"Please make sure eval_dataset be provided or val_size >1e-6\")\n\n    if training_args.predict_with_generate:\n        if is_deepspeed_zero3_enabled():\n            raise ValueError(\"`predict_with_generate` is incompatible with DeepSpeed ZeRO-3.\")\n\n        if finetuning_args.compute_accuracy:\n            raise ValueError(\"Cannot use `predict_with_generate` and `compute_accuracy` together.\")\n\n    if training_args.do_train and model_args.quantization_device_map == \"auto\":\n        raise ValueError(\"Cannot use device map for quantized models in training.\")\n\n    if finetuning_args.pissa_init and is_deepspeed_zero3_enabled():\n        raise ValueError(\"Please use scripts/pissa_init.py to initialize PiSSA in DeepSpeed ZeRO-3.\")\n\n    if finetuning_args.pure_bf16:\n        if not (is_torch_bf16_gpu_available() or (is_torch_npu_available() and torch.npu.is_bf16_supported())):\n            raise ValueError(\"This device does not support `pure_bf16`.\")\n\n        if is_deepspeed_zero3_enabled():\n            raise ValueError(\"`pure_bf16` is incompatible with DeepSpeed ZeRO-3.\")\n\n    if training_args.parallel_mode == ParallelMode.DISTRIBUTED:\n        if finetuning_args.use_galore and finetuning_args.galore_layerwise:\n            raise ValueError(\"Distributed training does not support layer-wise GaLore.\")\n\n        if finetuning_args.use_apollo and finetuning_args.apollo_layerwise:\n            raise ValueError(\"Distributed training does not support layer-wise APOLLO.\")\n\n        if finetuning_args.use_badam:\n            if finetuning_args.badam_mode == \"ratio\":\n                raise ValueError(\"Radio-based BAdam does not yet support distributed training, use layer-wise BAdam.\")\n            elif not is_deepspeed_zero3_enabled():\n                raise ValueError(\"Layer-wise BAdam only supports DeepSpeed ZeRO-3 training.\")\n\n    if training_args.deepspeed is not None and (finetuning_args.use_galore or finetuning_args.use_apollo):","sourceCodeStart":482,"sourceCodeEnd":518,"githubUrl":"https://github.com/hiyouga/LlamaFactory/blob/f28afaf6355af515454dfb16c97d728307c93897/src/llamafactory/hparams/parser.py#L482-L518","documentation":"Raised in parser.py:500 when finetuning_args.pure_bf16 is set but the hardware does not support bfloat16: neither is_torch_bf16_gpu_available() nor (NPU with torch.npu.is_bf16_supported()). pure_bf16 (DeepSpeed-style full-bf16 training) is a hardware capability, not just a dtype switch.","triggerScenarios":"`pure_bf16: true` on pre-Ampere GPUs (e.g. Tesla T4, V100, GTX series) or unsupported accelerators; also on NPUs whose CANN/torch build lacks bf16 support.","commonSituations":"Copying a config tuned on an A100/H100 and running it on a cloud T4 instance or an older on-prem GPU; Colab/kaggle T4 sessions.","solutions":["Remove `pure_bf16: true` and keep default mixed precision (bf16 auto-falls back or use fp16: true on Ampere- hardware)","If bf16 is required, switch to an Ampere+ GPU (A100, A10, RTX 30xx+, H100) or a bf16-capable NPU","Set `fp16: true` instead for pre-Ampere cards"],"exampleFix":"# before (YAML)\npure_bf16: true  # on T4/V100\n\n# after\n# pure_bf16 removed\nfp16: true","handlingStrategy":"validation","validationCode":"import torch\nbf16_ok = torch.cuda.is_available() and torch.cuda.is_bf16_supported()\nif config.get(\"pure_bf16\") and not bf16_ok:\n    raise SystemExit(\"pure_bf16 needs a bf16-capable GPU (Ampere+); use fp16 here\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Gate precision flags on a hardware probe at config-generation time","Template configs per GPU generation (fp16 for T4/V100, bf16 for A100+)"],"tags":["pure-bf16","hardware","gpu-compat","precision","config-validation"],"backgroundTag":null,"analyzedSha":"f28afaf6355af515454dfb16c97d728307c93897","analyzedAt":"2026-08-14T21:57:28.298Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}