-
同时导入torch 和RapidOCR会导致GPU占用问题,不知道能不能解决?Python 3.10.13 | packaged by Anaconda, Inc. | (main, Sep 11 2023, 13:24:38) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> from rapidocr_paddle import RapidOCR
Error: Can not import paddle core while this file exists: F:\anaconda3\envs\OCR\lib\site-packages\paddle\base\libpaddle.pyd
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "F:\anaconda3\envs\OCR\lib\site-packages\rapidocr_paddle\__init__.py", line 4, in <module>
from .main import RapidOCR
File "F:\anaconda3\envs\OCR\lib\site-packages\rapidocr_paddle\main.py", line 12, in <module>
File "F:\anaconda3\envs\OCR\lib\site-packages\rapidocr_paddle\ch_ppocr_v2_cls\__init__.py", line 4, in <module>
from .text_cls import TextClassifier
File "F:\anaconda3\envs\OCR\lib\site-packages\rapidocr_paddle\ch_ppocr_v2_cls\text_cls.py", line 23, in <module>
from rapidocr_paddle.utils import PaddleInferSession, read_yaml
File "F:\anaconda3\envs\OCR\lib\site-packages\rapidocr_paddle\utils.py", line 16, in <module>
import paddle
File "F:\anaconda3\envs\OCR\lib\site-packages\paddle\__init__.py", line 28, in <module>
from .base import core # noqa: F401
File "F:\anaconda3\envs\OCR\lib\site-packages\paddle\base\__init__.py", line 36, in <module>
from . import core
File "F:\anaconda3\envs\OCR\lib\site-packages\paddle\base\core.py", line 380, in <module>
raise e
File "F:\anaconda3\envs\OCR\lib\site-packages\paddle\base\core.py", line 268, in <module>
from . import libpaddle
ImportError: generic_type: type "_gpuDeviceProperties" is already registered! |
Beta Was this translation helpful? Give feedback.
Replies: 10 comments 1 reply
-
这个待我周末看一下,第一次见到这个问题 |
Beta Was this translation helpful? Give feedback.
-
我再Google Colab上试了一下,用了T4 GPU,并没有复现该问题。 |
Beta Was this translation helpful? Give feedback.
-
@SWHL 你那边是不是多块GPU? 这个问题的原因是GPU被注册了,如果你用多块的话可能会解决这个问题 |
Beta Was this translation helpful? Give feedback.
-
不是多块,我就是在Google Colab上申请了一个T4卡,跑的这个代码啊 |
Beta Was this translation helpful? Give feedback.
-
我也出现了“ImportError: generic_type: type "_gpuDeviceProperties" is already registered!”,只要导入了torch的包就会出现。 |
Beta Was this translation helpful? Give feedback.
-
@chunmengtu 能否提供一下运行环境和复现代码。看来这个问题仍然存在 |
Beta Was this translation helpful? Give feedback.
-
我的版本为
我的环境版本为: 代码: engine = RapidOCR() |
Beta Was this translation helpful? Give feedback.
-
你的运行机器是多个显卡,还是只有一个显卡呢? |
Beta Was this translation helpful? Give feedback.
-
只有一张显卡,RTX3060 |
Beta Was this translation helpful? Give feedback.
-
刚才查了一下,不是我这的问题,是Paddle和PyTorch兼容性问题。在Paddle issue #56812中有说到。该问题在Paddle PR #63595中显示已经修复。 可以尝试安装paddlepaddle develop版本,来看是否解决问题。安装命令如下: python -m pip install --pre paddlepaddle-gpu -i https://www.paddlepaddle.org.cn/packages/nightly/cu118/ |
Beta Was this translation helpful? Give feedback.
刚才查了一下,不是我这的问题,是Paddle和PyTorch兼容性问题。在Paddle issue #56812中有说到。该问题在Paddle PR #63595中显示已经修复。
可以尝试安装paddlepaddle develop版本,来看是否解决问题。安装命令如下: