Segmentation fault (core dumped)
Created by: ttc9082
欢迎您反馈PaddleHub使用问题,非常感谢您对PaddleHub的贡献! 在留下您的问题时,辛苦您同步提供如下信息:
- 版本、环境信息 1)PaddleHub和PaddlePaddle版本:请提供您的PaddleHub和PaddlePaddle版本号,例如PaddleHub1.4.1,PaddlePaddle1.6.2 2)系统环境:请您描述系统类型,例如Linux/Windows/MacOS/,python版本
- 复现信息:如为报错,请给出复现环境、复现步骤
paddle版本如下: paddlehub==1.8.2 paddlepaddle-gpu==1.8.3.post107
环境是基于docker image: nvidia/cuda:10.1-cudnn8-runtime-centos7 在这个基础上安装了python3.7和一些项目中需要的库比如 cv2
FROM nvidia/cuda:10.1-cudnn8-runtime-centos7
ENV PYTHONUNBUFFERED 1
RUN yum install -y cron vim screen mesa-libGL.x86_64 libSM-1.2.2-2.el7.x86_64
RUN yum install -y zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make
RUN yum install -y libffi-devel
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN mkdir /code
WORKDIR /code
RUN mkdir /data
COPY ./data/Python-3.7.0.tgz /data/Python-3.7.0.tgz
RUN cd /data && tar zxvf Python-3.7.0.tgz
RUN cd /data/Python-3.7.0 && ./configure && make clean && make && make install
RUN mv /usr/bin/python /usr/bin/python.bak
RUN ln -s /usr/local/bin/python3 /usr/bin/python
RUN ln -s /usr/local/bin/pip3 /usr/bin/pip
RUN pip install pqi
RUN pqi use douban
RUN pip install --upgrade pip
RUN pip install ipython
COPY requirements.txt ./
RUN pip install -r requirements.txt
RUN pip install paddlepaddle-gpu
// requirements.txt
pika~=1.1.0
minio~=6.0.0
opencv-python~=4.2.0.32
numpy~=1.19.2
paddlehub
这时候执行paddle.fluid.install_check.run_check()
会报错找不到libcublas.so
和libcudnn.so
。
然后我通过locate libcublas.so
和 locate libcudnn.so
发现他们在
/usr/lib64/libcudnn.so.8
/usr/lib64/libcudnn.so.8.0.2
/usr/lib64/libcublas.so.10
/usr/lib64/libcublas.so.10.2.1.243
所以我执行了
ln -s /usr/lib64/libcudnn.so.8 /usr/lib64/libcudnn.so
ln -s /usr/lib64/libcublas.so.10 /usr/lib64/libcublas.so
哦对了,我的 LD_LIBRARY_PATH=/usr/lib64/
环境变量是这样的
然后 paddle.fluid.install_check.run_check()
就不报错了。如下:
In [2]: paddle.fluid.install_check.run_check()
Running Verify Fluid Program ...
W0927 17:31:19.729128 165 device_context.cc:252] Please NOTE: device: 0, CUDA Capability: 60, Driver API Version: 10.2, Runtime API Version: 10.0
W0927 17:31:19.732339 165 device_context.cc:260] device: 0, cuDNN Version: 8.0.
Your Paddle Fluid works well on SINGLE GPU or CPU.
Your Paddle Fluid works well on MUTIPLE GPU or CPU.
Your Paddle Fluid is installed successfully! Let's start deep Learning with Paddle Fluid now
现在的问题是: 跑deeplabv3p_xception65_humanseg 抠图模型报错如下
[2020-09-27 18:15:17,949] [ INFO] - Installing deeplabv3p_xception65_humanseg module
[2020-09-27 18:15:18,022] [ INFO] - Module deeplabv3p_xception65_humanseg already installed in /root/.paddlehub/modules/deeplabv3p_xception65_humanseg
Segmentation fault (core dumped)
看起来是解释器直接崩了,不知道如何debug,也不知道为什么会这样,代码原来用cpu跑一直是可用的
简化的代码:
human_seg_module = hub.Module(name="deeplabv3p_xception65_humanseg")
img_bytes = open('xxxxxxx', 'rb').read()
origin_img_3_channels = cv2.imdecode(np.frombuffer(img_bytes, np.uint8), 1)
results = human_seg_module.segmentation(images=[origin_img_3_channels], use_gpu=True)
就这最后一句执行的时候就崩了,求帮助,感谢!