{"record":{"id":"9cbf5ab029c15946","repo":"PaddlePaddle/PaddleOCR","slug":"repetition-penalty-must-be-greater-than-0","errorCode":null,"errorMessage":"repetition_penalty must be greater than 0.","messagePattern":"repetition_penalty must be greater than 0\\.","errorType":"validation","errorClass":"InvalidRequestError","httpStatus":null,"severity":"error","filePath":"paddleocr/_api_client/models.py","lineNumber":192,"sourceCode":"        value = getattr(options, field.name)\n        if value is None:\n            continue\n        if field.name == \"extra_options\":\n            payload.update(value)\n        else:\n            payload[snake_to_camel(field.name)] = value\n    return payload\n\n\ndef _validate_vl_options(options: PaddleOCRVLOptions) -> None:\n    if options.top_p is not None and not (0 < options.top_p <= 1):\n        raise InvalidRequestError(\n            \"top_p must be greater than 0 and less than or equal to 1.\"\n        )\n    if options.temperature is not None and options.temperature < 0:\n        raise InvalidRequestError(\"temperature must be greater than or equal to 0.\")\n    if options.repetition_penalty is not None and options.repetition_penalty <= 0:\n        raise InvalidRequestError(\"repetition_penalty must be greater than 0.\")\n    if options.min_pixels is not None and options.min_pixels <= 0:\n        raise InvalidRequestError(\"min_pixels must be greater than 0.\")\n    if options.max_pixels is not None and options.max_pixels <= 0:\n        raise InvalidRequestError(\"max_pixels must be greater than 0.\")\n    if (\n        options.min_pixels is not None\n        and options.max_pixels is not None\n        and options.min_pixels > options.max_pixels\n    ):\n        raise InvalidRequestError(\"min_pixels cannot be greater than max_pixels.\")\n","sourceCodeStart":174,"sourceCodeEnd":203,"githubUrl":"https://github.com/PaddlePaddle/PaddleOCR/blob/2661c7c0ef5c613e8f93c6e93b2e052399f0f854/paddleocr/_api_client/models.py#L174-L203","documentation":"InvalidRequestError raised by _validate_vl_options when PaddleOCRVLOptions.repetition_penalty is <= 0. The penalty multiplies token logits, so zero or negative values are invalid; the client enforces positivity before sending.","triggerScenarios":"PaddleOCRVLOptions(repetition_penalty=0) or a negative value; confusing repetition_penalty (typically ~1.0) with a 0-1 penalty fraction.","commonSituations":"Assuming penalty is a probability-like 0..1 knob and setting 0.0 to 'disable' it (use 1.0 for no penalty instead).","solutions":["Set repetition_penalty to a positive value; use 1.0 for no penalty","Omit it (None) to accept the server default"],"exampleFix":"# before\noptions = PaddleOCRVLOptions(repetition_penalty=0.0)  # intended 'off'\n# after\noptions = PaddleOCRVLOptions(repetition_penalty=1.0)","handlingStrategy":"validation","validationCode":"if options.repetition_penalty is not None and options.repetition_penalty <= 0:\n    options.repetition_penalty = 1.0  # neutral value","typeGuard":null,"tryCatchPattern":"from paddleocr._api_client.errors import InvalidRequestError\n\ntry:\n    run(options)\nexcept InvalidRequestError as e:\n    if 'repetition_penalty' in str(e):\n        options.repetition_penalty = 1.0\n    else:\n        raise","preventionTips":["Use 1.0 to disable repetition penalty, never 0","Keep sampling params in a dataclass validated at construction"],"tags":["validation","api-client","sampling"],"backgroundTag":null,"analyzedSha":"2661c7c0ef5c613e8f93c6e93b2e052399f0f854","analyzedAt":"2026-08-14T20:17:30.180Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}