PaddlePaddle / PaddleNLP

👑 Easy-to-use and powerful NLP and LLM library with 🤗 Awesome model zoo, supporting wide-range of NLP tasks from research to industrial applications, including 🗂Text Classification, 🔍 Neural Search, ❓ Question Answering, ℹ️ Information Extraction, 📄 Document Intelligence, 💌 Sentiment Analysis etc.
https://paddlenlp.readthedocs.io
Apache License 2.0
12.14k stars 2.94k forks source link

[Bug]: Taskflow预测二分类问题,多线程预测程序崩溃 #9066

Closed zhangdd3537 closed 2 months ago

zhangdd3537 commented 2 months ago

软件环境

- paddlepaddle:2.6.1
- paddlepaddle-gpu: 2.6.1
- paddlenlp: 2.6.1

重复问题

错误描述

按照这个教程(https://github.com/PaddlePaddle/PaddleNLP/tree/release/2.6/applications/text_classification/multi_class)训练完成的模型,使用Taskflow进行预测, 单进程运行没有问题,但是多进程或者多线程(进程或者线程数大于2)程序就会崩溃(主要报错Segmentation fault)

稳定复现步骤 & 代码

https://github.com/PaddlePaddle/PaddleNLP/tree/release/2.6/applications/text_classification/multi_class 训练完成的模型,使用Taskflow进行多线程预测,程序会崩溃(主要报错Segmentation fault)

wawltor commented 2 months ago

能发下报错截图吗?

zhangdd3537 commented 2 months ago

已经解决,加线程锁,参考代码https://github.com/PaddlePaddle/PaddleNLP/blob/release/2.6/paddlenlp/server/taskflow_manager.py