{"record":{"id":"1564d6cc2a872d56","repo":"PaddlePaddle/PaddleOCR","slug":"model-name-is-not-supported-please-check-if-the","errorCode":null,"errorMessage":"{model_name} is not supported. Please check if the model is supported by the PaddleOCR wheel.","messagePattern":"(.+?) is not supported\\. Please check if the model is supported by the PaddleOCR wheel\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"tools/infer/predict_cls.py","lineNumber":47,"sourceCode":"\nimport tools.infer.utility as utility\nfrom ppocr.postprocess import build_post_process\nfrom ppocr.utils.logging import get_logger\nfrom ppocr.utils.utility import get_image_file_list, check_and_read\n\nlogger = get_logger()\n\n\nclass TextClassifier(object):\n    def __init__(self, args):\n        if os.path.exists(f\"{args.cls_model_dir}/inference.yml\"):\n            model_config = utility.load_config(f\"{args.cls_model_dir}/inference.yml\")\n            model_name = model_config.get(\"Global\", {}).get(\"model_name\", \"\")\n            if model_name and model_name not in [\n                \"PP-LCNet_x1_0_textline_ori\",\n                \"PP-LCNet_x0_25_textline_ori\",\n            ]:\n                raise ValueError(\n                    f\"{model_name} is not supported. Please check if the model is supported by the PaddleOCR wheel.\"\n                )\n\n        self.cls_image_shape = [int(v) for v in args.cls_image_shape.split(\",\")]\n        self.cls_batch_num = args.cls_batch_num\n        self.cls_thresh = args.cls_thresh\n        postprocess_params = {\n            \"name\": \"ClsPostProcess\",\n            \"label_list\": args.label_list,\n        }\n        self.postprocess_op = build_post_process(postprocess_params)\n        (\n            self.predictor,\n            self.input_tensor,\n            self.output_tensors,\n            _,\n        ) = utility.create_predictor(args, \"cls\", logger)\n        self.use_onnx = args.use_onnx","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/PaddlePaddle/PaddleOCR/blob/2661c7c0ef5c613e8f93c6e93b2e052399f0f854/tools/infer/predict_cls.py#L29-L65","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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)"],"exampleFix":"# before\npython -m tools.infer.utility --cls_model_dir=./my_cls\n# ValueError: cls_mobile_v1.0 is not supported...\n\n# after\nwget https://paddleocr.bj.bcebos.com/.../PP-LCNet_x0_25_textline_ori_train.tar\ntar -xf PP-LCNet_x0_25_textline_ori_train.tar -C inference/\npython tools/infer/predict_system.py --image_dir=... --cls_model_dir=inference/PP-LCNet_x0_25_textline_ori","handlingStrategy":"validation","validationCode":"import os, yaml\nSUPPORTED_CLS = {'PP-LCNet_x1_0_textline_ori', 'PP-LCNet_x0_25_textline_ori'}\nyml = os.path.join(cls_model_dir, 'inference.yml')\nif os.path.exists(yml):\n    name = yaml.safe_load(open(yml)).get('Global', {}).get('model_name', '')\n    assert not name or name in SUPPORTED_CLS, f'cls model {name!r} unsupported by wheel'","typeGuard":null,"tryCatchPattern":"try:\n    cls_predictor = TextClassifier(args)\nexcept ValueError as e:\n    if 'not supported' in str(e):\n        logger.error('switch to a wheel-supported textline-ori model')\n        raise SystemExit(2)\n    raise","preventionTips":["Pin model versions that match your PaddleOCR package version","Wrap predictor construction so model-whitelist failures surface as actionable errors, not mid-run crashes"],"tags":["model-compatibility","whitelist","cls","wheel"],"backgroundTag":null,"analyzedSha":"2661c7c0ef5c613e8f93c6e93b2e052399f0f854","analyzedAt":"2026-08-14T20:17:30.180Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}