PaddlePaddle/PaddleOCR · error · ValueError
Invalid precision: {precision}. Supported values are: {SUPPO
Error message
Invalid precision: {precision}. Supported values are: {SUPPORTED_PRECISION_LIST}. What it means
ValueError raised by parse_common_args when precision is not in SUPPORTED_PRECISION_LIST (['fp32', 'fp16']). Unlike engine, precision is always checked even at its default, so an invalid value anywhere in the config chain fails immediately.
Source
Thrown at paddleocr/_common_args.py:67
"enable_cinn": DEFAULT_USE_CINN,
}
unknown_names = kwargs.keys() - default_vals.keys()
for name in unknown_names:
raise ValueError(f"Unknown argument: {name}")
kwargs = {**default_vals, **kwargs}
if (
kwargs["engine"] is not None
and kwargs["engine"] not in SUPPORTED_INFERENCE_ENGINE_LIST
):
raise ValueError(
f"Invalid engine: {kwargs['engine']}. Supported values are: {SUPPORTED_INFERENCE_ENGINE_LIST}."
)
if kwargs["precision"] not in SUPPORTED_PRECISION_LIST:
raise ValueError(
f"Invalid precision: {kwargs['precision']}. Supported values are: {SUPPORTED_PRECISION_LIST}."
)
kwargs["use_pptrt"] = kwargs.pop("use_tensorrt")
kwargs["pptrt_precision"] = kwargs.pop("precision")
return kwargs
def _build_paddle_static_engine_config(common_args, device_type):
cfg = {}
if device_type == "gpu":
if common_args["use_pptrt"]:
if common_args["pptrt_precision"] == "fp32":
cfg["run_mode"] = "trt_fp32"
else:
assert common_args["pptrt_precision"] == "fp16", common_args[
"pptrt_precision"View on GitHub (pinned to 2661c7c0ef)
Solutions
- Use exactly 'fp32' or 'fp16' (lowercase)
- For other numeric formats on TensorRT paths, check whether your version supports them via SUPPORTED_PRECISION_LIST before passing
Example fix
# before ocr = PaddleOCR(precision='float16', use_tensorrt=True) # after ocr = PaddleOCR(precision='fp16', use_tensorrt=True)
Defensive patterns
Strategy: type-guard
Validate before calling
from paddleocr._constants import SUPPORTED_PRECISION_LIST
if precision not in SUPPORTED_PRECISION_LIST:
raise ValueError(f'precision must be one of {SUPPORTED_PRECISION_LIST}') Type guard
from typing import Literal
Precision = Literal['fp32', 'fp16']
def is_precision(v: str) -> 'TypeGuard[Precision]':
return v in ('fp32', 'fp16') Prevention
- Use lowercase 'fp32'/'fp16' exactly
- Check SUPPORTED_PRECISION_LIST when upgrading, not docs memory
When it happens
Trigger: PaddleOCR(precision='int8'), precision='float16', or precision='FP16' (case-sensitive check).
Common situations: Coming from TensorRT configs where 'int8'/'bf16' are valid; assuming case-insensitivity; abbreviating float16 as fp16 correctly but trying bfloat16.
Related errors
- worker mode does not support a custom fetch implementation.
- Conflicting values provided for ${label}: ${aliases.join(",
- ${modelRole} model selection must define model_name.
- OCR model selection must define both detection and recogniti
- worker must be a boolean or an options object.
AI-assisted analysis of PaddlePaddle/PaddleOCR@2661c7c0ef (2026-08-14).
Data as JSON: /api/errors/972d026b0ec5ae78.
Report an issue: GitHub.