Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot open file C:\Users\wqw/.paddleclas/inference_model\PULC\language_classification, please confirm whether the file is normal. #3317

Closed
wqw547243068 opened this issue Dec 8, 2024 · 2 comments
Assignees

Comments

@wqw547243068
Copy link

wqw547243068 commented Dec 8, 2024

系统

  • windows 10, 64位
  • Python 3.11
  • CPU only

工具包

  • paddleclas 2.6.0
  • paddleocr 2.9.1
  • paddlepaddle 2.6.2

功能:

  • 输入图片,识别语种

代码:

import paddleclas

file_name = r"E:\ocr\data\hand\3.jpg"

lang_model = paddleclas.PaddleClas(model_name="language_classification")
result = lang_model.predict(input_data=file_name)
result = list(result)
lang_type = result[0][0]['label_names'][0]
print('语言类型为:',lang_type)

错误信息

RuntimeError: (NotFound) Cannot open file C:\Users\wqw/.paddleclas/inference_model\PULC\language_classification, please confirm whether the file is normal.
 [Hint: Expected static_cast<bool>(fin.is_open()) == true, but received static_cast<bool>(fin.is_open()):0 != true:1.] (at ..\paddle\fluid\inference\api\analysis_predictor.cc:2577)

路径: 文件存在,只是路径名中的斜线异常

  • C:\Users\wqw/.paddleclas/inference_model\PULC\language_classification

image

看到别的issue里 #3311 ,提到是windows下的路径名问题

于是,我修改源码,C:\Users\wqw\AppData\Roaming\Python\Python311\site-packages\paddleclas\paddleclas.py, 49行

# BASE_DIR = os.path.expanduser("~/.paddleclas/") # 原代码
BASE_DIR = os.path.join(os.path.expanduser('~'), '.paddleclas') # 新代码

验证发现,路径矫正后,错误依然存在....

@GreatV
Copy link

GreatV commented Dec 9, 2024

试试 set FLAGS_enable_pir_api=0

@wqw547243068
Copy link
Author

wqw547243068 commented Dec 11, 2024

试试 set FLAGS_enable_pir_api=0

cmd中试了,老样子,不管用

另一个帖子里解答了,参考这个PR #3313 改下,主要是这里,验证有效

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants