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
TextClassifier (tools/infer/predict_cls.py) reads inference.yml from the cls model directory and, when its Global.model_name is set but not in the wheel-supported whitelist (PP-LCNet_x1_0_textline_ori, PP-LCNet_x0_25_textline_ori), raises ValueError. This is a compatibility gate: the pip-installed PaddleOCR wheel only ships support for specific textline-orientation classifiers, and self-trained or third-party models are rejected up front. If inference.yml is absent, the check is skipped entirely.
Source
Thrown at tools/infer/predict_cls.py:47
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 TextClassifier(object):
def __init__(self, args):
if os.path.exists(f"{args.cls_model_dir}/inference.yml"):
model_config = utility.load_config(f"{args.cls_model_dir}/inference.yml")
model_name = model_config.get("Global", {}).get("model_name", "")
if model_name and model_name not in [
"PP-LCNet_x1_0_textline_ori",
"PP-LCNet_x0_25_textline_ori",
]:
raise ValueError(
f"{model_name} is not supported. Please check if the model is supported by the PaddleOCR wheel."
)
self.cls_image_shape = [int(v) for v in args.cls_image_shape.split(",")]
self.cls_batch_num = args.cls_batch_num
self.cls_thresh = args.cls_thresh
postprocess_params = {
"name": "ClsPostProcess",
"label_list": args.label_list,
}
self.postprocess_op = build_post_process(postprocess_params)
(
self.predictor,
self.input_tensor,
self.output_tensors,
_,
) = utility.create_predictor(args, "cls", logger)
self.use_onnx = args.use_onnxView on GitHub (pinned to 2661c7c0ef)
Solutions
- Download the supported PP-LCNet_x1_0_textline_ori / PP-LCNet_x0_25_textline_ori cls model from the official PaddleOCR model repo
- Edit inference.yml in the custom model dir and set Global.model_name to a whitelisted name (only if the model is architecturally identical)
- If the model has no inference.yml requirement, ensure the dir actually contains one — or remove inference.yml so the gate is skipped (custom models at your own risk)
Example fix
# before python -m tools.infer.utility --cls_model_dir=./my_cls # ValueError: cls_mobile_v1.0 is not supported... # after wget https://paddleocr.bj.bcebos.com/.../PP-LCNet_x0_25_textline_ori_train.tar tar -xf PP-LCNet_x0_25_textline_ori_train.tar -C inference/ python tools/infer/predict_system.py --image_dir=... --cls_model_dir=inference/PP-LCNet_x0_25_textline_ori
Defensive patterns
Strategy: validation
Validate before calling
import os, yaml
SUPPORTED_CLS = {'PP-LCNet_x1_0_textline_ori', 'PP-LCNet_x0_25_textline_ori'}
yml = os.path.join(cls_model_dir, 'inference.yml')
if os.path.exists(yml):
name = yaml.safe_load(open(yml)).get('Global', {}).get('model_name', '')
assert not name or name in SUPPORTED_CLS, f'cls model {name!r} unsupported by wheel' Try / catch
try:
cls_predictor = TextClassifier(args)
except ValueError as e:
if 'not supported' in str(e):
logger.error('switch to a wheel-supported textline-ori model')
raise SystemExit(2)
raise Prevention
- Pin model versions that match your PaddleOCR package version
- Wrap predictor construction so model-whitelist failures surface as actionable errors, not mid-run crashes
When it happens
Trigger: Pointing --cls_model_dir at a self-trained or downloaded cls model whose inference.yml declares a different model_name (e.g. 'cls_ch', 'PP-LCNet_x0_5_textline_ori', or a custom name).
Common situations: Users switching from the old GitHub-repo layout (models without inference.yml, which pass silently) to the pip wheel; downloading cls models from PaddleOCR model zoo pages that predate the whitelist; training a custom angle classifier and reusing it with the wheel.
Related errors
- {model_name} is not supported. Please check if the model is
- {model_name} is not supported. Please check if the model is
- {model_name} is not supported. Please check if the model is
- {model_name} is not supported. Please check if the model is
AI-assisted analysis of PaddlePaddle/PaddleOCR@2661c7c0ef (2026-08-14).
Data as JSON: /api/errors/1564d6cc2a872d56.
Report an issue: GitHub.