{"record":{"id":"a81b172ba847129c","repo":"PaddlePaddle/PaddleOCR","slug":"not-find-model-file-path","errorCode":null,"errorMessage":"not find model file path {}","messagePattern":"not find model file path (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"tools/infer/utility.py","lineNumber":205,"sourceCode":"        model_dir = args.ser_model_dir\n    elif mode == \"re\":\n        model_dir = args.re_model_dir\n    elif mode == \"sr\":\n        model_dir = args.sr_model_dir\n    elif mode == \"layout\":\n        model_dir = args.layout_model_dir\n    else:\n        model_dir = args.e2e_model_dir\n\n    if model_dir is None:\n        logger.info(\"not find {} model file path {}\".format(mode, model_dir))\n        sys.exit(0)\n    if args.use_onnx:\n        import onnxruntime as ort\n\n        model_file_path = model_dir\n        if not os.path.exists(model_file_path):\n            raise ValueError(\"not find model file path {}\".format(model_file_path))\n\n        sess_options = args.onnx_sess_options or None\n\n        if args.onnx_providers and len(args.onnx_providers) > 0:\n            sess = ort.InferenceSession(\n                model_file_path,\n                providers=args.onnx_providers,\n                sess_options=sess_options,\n            )\n        elif args.use_gpu:\n            sess = ort.InferenceSession(\n                model_file_path,\n                providers=[\n                    (\n                        \"CUDAExecutionProvider\",\n                        {\n                            \"device_id\": args.gpu_id,\n                            \"cudnn_conv_algo_search\": \"HEURISTIC\",","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/PaddlePaddle/PaddleOCR/blob/2661c7c0ef5c613e8f93c6e93b2e052399f0f854/tools/infer/utility.py#L187-L223","documentation":"In utility.create_predictor, when --use_onnx is set, the model path must point to an actual .onnx file (not a directory of Paddle inference files). This ValueError fires when the given path does not exist on disk. Note the separate branch above it: if model_dir itself is None the code logs and sys.exit(0)s instead — so this error specifically means 'a path was given but nothing is there'.","triggerScenarios":"Running with --use_onnx and a model path that doesn't exist: typo, wrong extension, passing a directory when an .onnx file path is required, or not having converted/downloaded the ONNX model.","commonSituations":"Converting workflow to ONNX but forgetting to run paddle2onnx; passing the Paddle model directory (containing .pdmodel) unchanged to the ONNX path; downloading models to a different folder than referenced.","solutions":["Verify the file exists and is an .onnx file: ls -la <path>","Convert a Paddle model first: paddle2onnx --model_dir inference/det --model_filename inference.pdmodel --params_filename inference.pdiparams --save_file det.onnx","Pass the full file path (dir/model.onnx), not the directory, when use_onnx is enabled"],"exampleFix":"# before\n--use_onnx --det_model_dir=./inference/det_ppocrv3  # directory, not .onnx -> ValueError\n\n# after\npaddle2onnx --model_dir ./inference/det_ppocrv3 \\\n  --model_filename inference.pdmodel --params_filename inference.pdiparams \\\n  --save_file ./inference/det.onnx\n--use_onnx --det_model_dir=./inference/det.onnx","handlingStrategy":"validation","validationCode":"import os\nassert args.use_onnx is False or (args.det_model_dir and os.path.isfile(args.det_model_dir) and args.det_model_dir.endswith('.onnx')), \\\n    'with --use_onnx the model path must be an existing .onnx file'","typeGuard":null,"tryCatchPattern":"try:\n    utility.create_predictor(args, 'det', logger)\nexcept ValueError as e:\n    if 'not find model file path' in str(e):\n        raise SystemExit(f'ONNX model missing: {args.det_model_dir} — convert with paddle2onnx first')\n    raise","preventionTips":["Verify ONNX artifacts exist as part of your build step, right after paddle2onnx","Keep a manifest mapping each pipeline stage to its concrete model file and check it at startup"],"tags":["onnx","model-path","inference","file-not-found"],"backgroundTag":null,"analyzedSha":"2661c7c0ef5c613e8f93c6e93b2e052399f0f854","analyzedAt":"2026-08-14T20:17:30.180Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}