{"record":{"id":"3eb7952938c4b4b1","repo":"PaddlePaddle/PaddleOCR","slug":"model-name-is-not-supported-please-check-if-the-3eb795","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_rec.py","lineNumber":57,"sourceCode":"class TextRecognizer(object):\n    def __init__(self, args, logger=None):\n        if os.path.exists(f\"{args.rec_model_dir}/inference.yml\"):\n            model_config = utility.load_config(f\"{args.rec_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-OCRv5_mobile_rec\",\n                \"PP-OCRv5_server_rec\",\n                \"korean_PP-OCRv5_mobile_rec\",\n                \"eslav_PP-OCRv5_mobile_rec\",\n                \"latin_PP-OCRv5_mobile_rec\",\n                \"en_PP-OCRv5_mobile_rec\",\n                \"th_PP-OCRv5_mobile_rec\",\n                \"el_PP-OCRv5_mobile_rec\",\n                \"PP-OCRv6_tiny_rec\",\n                \"PP-OCRv6_small_rec\",\n                \"PP-OCRv6_medium_rec\",\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            if args.rec_char_dict_path == \"./ppocr/utils/ppocr_keys_v1.txt\":\n                rec_char_list = model_config.get(\"PostProcess\", {}).get(\n                    \"character_dict\", []\n                )\n                if rec_char_list:\n                    new_rec_char_dict_path = f\"{args.rec_model_dir}/ppocr_keys.txt\"\n                    with open(new_rec_char_dict_path, \"w\", encoding=\"utf-8\") as f:\n                        f.writelines([char + \"\\n\" for char in rec_char_list])\n                    args.rec_char_dict_path = new_rec_char_dict_path\n\n        if logger is None:\n            logger = get_logger()\n        self.rec_image_shape = [int(v) for v in args.rec_image_shape.split(\",\")]\n        self.rec_batch_num = args.rec_batch_num\n        self.rec_algorithm = args.rec_algorithm","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/PaddlePaddle/PaddleOCR/blob/2661c7c0ef5c613e8f93c6e93b2e052399f0f854/tools/infer/predict_rec.py#L39-L75","documentation":"TextRecognizer (tools/infer/predict_rec.py) reads inference.yml from the recognition model dir and rejects models whose Global.model_name is not in the whitelist (PP-OCRv5 mobile/server rec plus language-specific v5 rec models — korean, eslav, latin, en, th, el — and PP-OCRv6 tiny/small/medium). The same gate block also implements a convenience: for whitelisted models with a default dict path, the character dictionary embedded in inference.yml is written out to ppocr_keys.txt. The whitelist exists because the wheel's post-processing is tuned to these architectures/alphabets.","triggerScenarios":"Setting --rec_model_dir to a PP-OCRv3/v4 rec model, a fine-tuned rec model, or a niche language rec model (e.g. cyrillic_PP-OCRv3) whose inference.yml carries a non-whitelisted model_name.","commonSituations":"Upgrading a project pinned to PP-OCRv3/v4 rec models; using models from the multi-language zoo that predate v5; fine-tuned exports keeping their original model_name; mixing wheel and source-checkout expectations.","solutions":["Switch to a whitelisted rec model (e.g. PP-OCRv5_mobile_rec or the matching language variant like korean_PP-OCRv5_mobile_rec)","Download older zoo packages that ship without inference.yml, which bypass the gate","If the architecture matches, edit Global.model_name in the model's inference.yml to a whitelisted name","Use a source checkout of PaddleOCR (not the wheel) to run arbitrary rec models"],"exampleFix":"# before\n--rec_model_dir=./inference/en_PP-OCRv4_mobile_rec  # ValueError\n\n# after\n--rec_model_dir=./inference/PP-OCRv5_mobile_rec","handlingStrategy":"validation","validationCode":"import os, yaml\nSUPPORTED_REC = {'PP-OCRv5_mobile_rec','PP-OCRv5_server_rec','korean_PP-OCRv5_mobile_rec','eslav_PP-OCRv5_mobile_rec','latin_PP-OCRv5_mobile_rec','en_PP-OCRv5_mobile_rec','th_PP-OCRv5_mobile_rec','el_PP-OCRv5_mobile_rec','PP-OCRv6_tiny_rec','PP-OCRv6_small_rec','PP-OCRv6_medium_rec'}\nyml = os.path.join(rec_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_REC, f'rec model {name!r} unsupported'","typeGuard":null,"tryCatchPattern":"try:\n    rec = TextRecognizer(args)\nexcept ValueError as e:\n    if 'not supported' in str(e):\n        raise SystemExit('switch to a PP-OCRv5/v6 rec model or a legacy package without inference.yml')\n    raise","preventionTips":["Match the language-specific v5 rec model to your alphabet (korean/latin/th/el/eslav)","After fine-tuning, either keep the base model_name of a supported arch or run from source"],"tags":["model-compatibility","whitelist","recognition","wheel"],"backgroundTag":null,"analyzedSha":"2661c7c0ef5c613e8f93c6e93b2e052399f0f854","analyzedAt":"2026-08-14T20:17:30.180Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}