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

PaddleOCR is not working on GPU #7993

Closed
Kuyas opened this issue Oct 19, 2022 · 6 comments
Closed

PaddleOCR is not working on GPU #7993

Kuyas opened this issue Oct 19, 2022 · 6 comments
Assignees

Comments

@Kuyas
Copy link

Kuyas commented Oct 19, 2022

Please provide the following information to quickly locate the problem

  • System Environment:Amazon Linux 2
  • Version:Paddle:PaddlePaddle 2.3.2 PaddleOCR: paddleocr==2.6.0.2
    Command Code:CUDA_VISIBLE_DEVICES=0 python3 tools/infer/predict_system.py --image_dir="./doc/imgs_en/254.jpg" --det_model_dir="./en_PP-OCRv3_det_slim_infer/" --rec_model_dir="./en_PP-OCRv3_rec_slim_infer/" --rec_char_dict_path="./ppocr/utils/en_dict.txt"
    完整报错/Complete Error Message:

If I Install via the quickstart guide
2022/10/20 05:06:16] ppocr INFO: In PP-OCRv3, rec_image_shape parameter defaults to '3, 48, 320', if you are using recognition model with PP-OCRv2 or an older version, please set --rec_image_shape='3,32,320

C++ Traceback (most recent call last):
No stack trace in paddle, may be caused by external reasons.

Error Message Summary:
FatalError: Segmentation fault is detected by the operating system.
[TimeInfo: *** Aborted at 1666242377 (unix time) try "date -d @1666242377" if you are using GNU date ***]
[SignalInfo: *** SIGSEGV (@0x0) received by PID 46281 (TID 0x7f38e16555c0) from PID 0 ***]

Segmentation fault

If I install the docker and try to run I get the following error
AttributeError: module 'paddle.fluid.core_avx' has no attribute 'is_compiled_with_rocm'
Stacktrace:
Traceback (most recent call last):
File "", line 1, in
File "/home/PaddleOCR/paddleocr.py", line 501, in init
super().init(params)
File "/home/PaddleOCR/tools/infer/predict_system.py", line 46, in init
self.text_detector = predict_det.TextDetector(args)
File "/home/PaddleOCR/tools/infer/predict_det.py", line 137, in init
args, 'det', logger)
File "/home/PaddleOCR/tools/infer/utility.py", line 212, in create_predictor
gpu_id = get_infer_gpuid()
File "/home/PaddleOCR/tools/infer/utility.py", line 308, in get_infer_gpuid
if not paddle.fluid.core.is_compiled_with_rocm():
AttributeError: module 'paddle.fluid.core_avx' has no attribute 'is_compiled_with_rocm'

I am not able to run any version of PaddleOCR on the gpu,

I have Installed via multiple ways and I get the same error

  1. python3 -m pip install paddlepaddle-gpu -f https://paddlepaddle.org.cn/whl/stable.html
  2. pip install paddlepaddle-gpu "paddleocr>=2.0.1"
  3. Using the quickstart guide's python3 -m pip install paddlepaddle-gpu -i https://mirror.baidu.com/pypi/simple
    If I use the code, it gives
    Paddle = PaddleOCR(use_angle_cls=True, lang="en", use_gpu=True)
    im_path = 'B083GS9NVZ_4.jpg'
    result = Paddle.ocr(im_path, cls=False, det=True, rec=False)

I get segmentation fault or the kernel crashes on jupyter

I also tried https://github.com/PaddlePaddle/PaddleOCR/blob/dygraph/doc/doc_en/installation_en.md to use nvidia-docker
and tried various versions, the version used in the readme, the latest one available to no avail
I got an error like "AttributeError: module 'paddle.fluid.core_avx' has no attribute 'is_compiled_with_rocm'"

These run if I just make the use_gpu Flag False

Can you please help me out?

Thank you

@intrainepha
Copy link

try install paddlepaddle-gpu==2.4.0rc0

@Kuyas
Copy link
Author

Kuyas commented Oct 20, 2022

try install paddlepaddle-gpu==2.4.0rc0

I tried this but I still get the same error


C++ Traceback (most recent call last):

No stack trace in paddle, may be caused by external reasons.


Error Message Summary:

FatalError: Segmentation fault is detected by the operating system.
[TimeInfo: *** Aborted at 1666252410 (unix time) try "date -d @1666252410" if you are using GNU date ***]
[SignalInfo: *** SIGSEGV (@0x0) received by PID 108692 (TID 0x7fdd9933e740) from PID 0 ***]

Segmentation fault

@LightSun
Copy link

LightSun commented Oct 21, 2022

Mine is the same.
env:
system: ubuntu 18.04
paddle-gpu-2.3.2 python
cuda: 11.1

--------------------------------------
C++ Traceback (most recent call last):
--------------------------------------
No stack trace in paddle, may be caused by external reasons.

----------------------
Error Message Summary:
----------------------
FatalError: `Segmentation fault` is detected by the operating system.
  [TimeInfo: *** Aborted at 1666335819 (unix time) try "date -d @1666335819" if you are using GNU date ***]
  [SignalInfo: *** SIGSEGV (@0x0) received by PID 24602 (TID 0x7f4af0a45740) from PID 0 ***]


Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

crash at

  if args.type == 'ocr':
            result = engine.ocr(img=img,
                                det=args.det,
                                rec=args.rec,
                                cls=args.use_angle_cls
            )

pip list

absl-py                 1.1.0
astor                   0.8.1
boto3                   1.24.2
botocore                1.27.2
cachetools              5.2.0
certifi                 2022.5.18.1
charset-normalizer      2.0.12
cycler                  0.11.0
decorator               5.1.1
Deprecated              1.2.13
filelock                3.7.1
flatbuffers             2.0
fonttools               4.33.3
google-auth             2.6.6
google-auth-oauthlib    0.4.6
grpcio                  1.46.3
idna                    3.3
imageio                 2.19.3
imgaug                  0.4.0
importlib-metadata      4.11.4
jmespath                1.0.0
kiwisolver              1.4.2
lmdb                    1.3.0
loguru                  0.6.0
Markdown                3.3.7
matplotlib              3.5.2
MegEngine               1.9.1
megfile                 0.1.2
mprop                   0.16.0
networkx                2.6.3
ninja                   1.10.2.3
numpy                   1.21.6
oauthlib                3.2.0
onnx                    1.8.1
onnx-simplifier         0.3.5
onnxoptimizer           0.2.7
onnxruntime             1.9.0
opencv-python           4.5.5.64
opt-einsum              3.3.0
packaging               21.3
paddle-bfloat           0.1.7
paddle2onnx             0.9.7
paddlelite              2.9
paddlepaddle            2.3.0
paddlepaddle-gpu        2.3.2
Pillow                  9.1.1
pip                     22.1.2
protobuf                3.20.0
pyarrow                 8.0.0
pyasn1                  0.4.8
pyasn1-modules          0.2.8
pyclipper               1.3.0.post3
pycocotools             2.0.4
pyparsing               3.0.9
python-dateutil         2.8.2
PyWavelets              1.3.0
PyYAML                  6.0
requests                2.27.1
requests-oauthlib       1.3.1
rsa                     4.8
s3transfer              0.6.0
scikit-image            0.19.2
scipy                   1.7.3
setuptools              62.3.2
Shapely                 1.8.5.post1
six                     1.16.0
smart-open              6.0.0
tabulate                0.8.9
tensorboard             2.9.0
tensorboard-data-server 0.6.1
tensorboard-plugin-wit  1.8.1
thop                    0.0.31.post2005241907
tifffile                2021.11.2
torch                   1.10.1+cu111
torchaudio              0.10.1+rocm4.1
torchvision             0.11.2+cu111
tqdm                    4.64.0
typing_extensions       4.2.0
urllib3                 1.26.9
Werkzeug                2.1.2
wheel                   0.37.1
wrapt                   1.14.1

@LightSun
Copy link

i fixed from 'https://www.paddlepaddle.org.cn/'.

//before is pip install paddlepaddle-gpu==2.3.2
python -m pip install paddlepaddle-gpu==2.3.2.post111 -f https://www.paddlepaddle.org.cn/whl/linux/mkl/avx/stable.html

@GiovanniNova
Copy link

I was having issues with paddlepaddle-gpu too, no errors or warnings it just crashed, fixed them as per LightSun sugestion of getting the install commands from your website for CUDA 11.6, please update point "1.1 Paddle Installation" at https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.6/doc/doc_en/multi_languages_en.md to use the link https://www.paddlepaddle.org.cn/en/install/quick instead.

@thsno02
Copy link

thsno02 commented Oct 25, 2022

u may need to install NCCL~

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

6 participants