PaddlePaddle/PaddleOCR · error · ValueError

{model_name} is not supported. Please check if the model is

Error message

{model_name} is not supported. Please check if the model is supported by the PaddleOCR wheel.

What it means

TextSR (tools/infer/predict_sr.py), the text super-resolution predictor, reads inference.yml from the sr model directory and rejects any model declaring a Global.model_name — i.e. all models with new-style metadata. Like the e2e gate, this means the SR pipeline is not supported by the PaddleOCR wheel: the check exists to fail fast instead of producing subtly wrong super-resolution results.

Source

Thrown at tools/infer/predict_sr.py:45

import time
import traceback
import paddle

import tools.infer.utility as utility
from ppocr.postprocess import build_post_process
from ppocr.utils.logging import get_logger
from ppocr.utils.utility import get_image_file_list, check_and_read

logger = get_logger()


class TextSR(object):
    def __init__(self, args):
        if os.path.exists(f"{args.sr_model_dir}/inference.yml"):
            model_config = utility.load_config(f"{args.sr_model_dir}/inference.yml")
            model_name = model_config.get("Global", {}).get("model_name", "")
            if model_name:
                raise ValueError(
                    f"{model_name} is not supported. Please check if the model is supported by the PaddleOCR wheel."
                )

        self.sr_image_shape = [int(v) for v in args.sr_image_shape.split(",")]
        self.sr_batch_num = args.sr_batch_num

        (
            self.predictor,
            self.input_tensor,
            self.output_tensors,
            self.config,
        ) = utility.create_predictor(args, "sr", logger)
        self.benchmark = args.benchmark
        if args.benchmark:
            import auto_log

            pid = os.getpid()
            gpu_id = utility.get_infer_gpuid()

View on GitHub (pinned to 2661c7c0ef)

Solutions

  1. Use the legacy SR model packages from the model zoo that ship without inference.yml
  2. Remove inference.yml from the model directory to bypass the gate (only for the original SR architectures)
  3. Run SR from a PaddleOCR source checkout where the wheel restrictions do not apply

Example fix

# before
--sr_model_dir=./inference/TE_PGN  # ValueError if inference.yml exists

# after
rm ./inference/TE_PGN/inference.yml
# or unpack the original zoo tarball untouched
Defensive patterns

Strategy: validation

Validate before calling

import os
if os.path.exists(os.path.join(sr_model_dir, 'inference.yml')):
    raise SystemExit('SR models with inference.yml are rejected by the wheel — use the legacy zoo package or remove the yml')

Try / catch

try:
    sr = TextSR(args)
except ValueError as e:
    if 'not supported' in str(e):
        raise SystemExit('SR unsupported by wheel; run from source or drop SR from the pipeline')
    raise

Prevention

When it happens

Trigger: Running SR inference with --sr_model_dir pointing at a model directory containing an inference.yml with a non-empty Global.model_name.

Common situations: Repackaged SR models (e.g. TE_PGN/ch_PP-OCRv3) with added metadata; using the wheel but expecting legacy SR support; wrong flag pointing a modern model dir at --sr_model_dir.

Related errors


AI-assisted analysis of PaddlePaddle/PaddleOCR@2661c7c0ef (2026-08-14). Data as JSON: /api/errors/4729d502f826c49f. Report an issue: GitHub.