用flask+gunicorn启动服务,调用paddleHub的gpu版模型 报错??
Created by: waywaywayw
1)版本、环境信息: paddlehub 1.5.4 paddlepaddle-gpu 1.7.0.post107 3)V100 NVIDIA-SMI 410.79 Driver Version: 410.79 CUDA Version: 10.0 4)拉取docker镜像 FROM hub.baidubce.com/paddlepaddle/paddle:1.7.0-gpu-cuda10.0-cudnn7 使用镜像里的python3.6
用单worker的flask启动,可以调用正常gpu版的paddlehub 用单worker的flask+gunicorn启动,请求时报错。
gunicorn的配置: worker_class = "gevent"
flask:
import json
import paddlehub as hub
@app.route('/query_lexical_analysis', methods=['GET', 'POST'])
def query_lexical_analysis():
# test
querys = ''.join('大通草和小通草哪个好'.split())
module = hub.Module(name="lac")
text = {"text": querys}
results = module.lexical_analysis(data=text, use_gpu=True, batch_size=10)
print(results)
return jsonify(results)
报错如下:
[2020-03-11 14:19:03,324] [ INFO] - Installing lac module
[2020-03-11 14:19:03,326] [ INFO] - Module lac already installed in /root/.paddlehub/modules/lac
[2020-03-11 14:19:03,418] [ INFO] - 20 pretrained paramaters loaded by PaddleHub
W0311 14:19:03.420081 2719 init.cc:209] Warning: PaddlePaddle catches a failure signal, it may not work properly
W0311 14:19:03.420120 2719 init.cc:211] You could check whether you killed PaddlePaddle thread/process accidentally or report the case to PaddlePaddle
W0311 14:19:03.420137 2719 init.cc:214] The detail failure signal is:
W0311 14:19:03.420143 2719 init.cc:217] *** Aborted at 1583907543 (unix time) try "date -d @1583907543" if you are using GNU date ***
W0311 14:19:03.422354 2719 init.cc:217] PC: @ 0x0 (unknown)
W0311 14:19:03.422427 2719 init.cc:217] *** SIGSEGV (@0x0) received by PID 2719 (TID 0x7f786850f700) from PID 0; stack trace: ***
W0311 14:19:03.424427 2719 init.cc:217] @ 0x7f7867bbf390 (unknown)
W0311 14:19:03.425480 2719 init.cc:217] @ 0x7f784334fccb (unknown)
W0311 14:19:03.426463 2719 init.cc:217] @ 0x7f7843351668 _Unwind_Backtrace
W0311 14:19:03.428413 2719 init.cc:217] @ 0x7f78678f9b4f backtrace
W0311 14:19:03.431886 2719 init.cc:217] @ 0x7f77fd0ed274 paddle::platform::GetTraceBackString<>()
W0311 14:19:03.434432 2719 init.cc:217] @ 0x7f77fd0ed72a paddle::platform::EnforceNotMet::EnforceNotMet()
W0311 14:19:03.438936 2719 init.cc:217] @ 0x7f77ffe1d996 paddle::platform::SetDeviceId()
W0311 14:19:03.440912 2719 init.cc:217] @ 0x7f7867bbca99 __pthread_once_slow
W0311 14:19:03.443886 2719 init.cc:217] @ 0x7f77ffe03a59 paddle::memory::allocation::CUDAAllocator::AllocateImpl()
W0311 14:19:03.449098 2719 init.cc:217] @ 0x7f77ffe23d32 paddle::memory::allocation::AlignedAllocator::AllocateImpl()
W0311 14:19:03.456087 2719 init.cc:217] @ 0x7f77ffe221f1 paddle::memory::allocation::AutoGrowthBestFitAllocator::AllocateImpl()
W0311 14:19:03.460073 2719 init.cc:217] @ 0x7f77ffe0546b paddle::memory::allocation::RetryAllocator::AllocateImpl()
W0311 14:19:03.463320 2719 init.cc:217] @ 0x7f77ffdffa63 paddle::memory::allocation::AllocatorFacade::Alloc()
W0311 14:19:03.467958 2719 init.cc:217] @ 0x7f77ffdffcfe paddle::memory::allocation::AllocatorFacade::AllocShared()
W0311 14:19:03.470901 2719 init.cc:217] @ 0x7f77ffdff47c paddle::memory::AllocShared()
W0311 14:19:03.474262 2719 init.cc:217] @ 0x7f77ffdeb8d2 paddle::framework::Tensor::mutable_data()
W0311 14:19:03.476459 2719 init.cc:217] @ 0x7f77fd1ad183 paddle::pybind::SetTensorFromPyArrayT<>()
W0311 14:19:03.478613 2719 init.cc:217] @ 0x7f77fd1b83e5 paddle::pybind::SetTensorFromPyArray<>()
W0311 14:19:03.480762 2719 init.cc:217] @ 0x7f77fd122bfa _ZZN8pybind1112cpp_function10initializeIRPFvPN6paddle9framework6TensorERKNS_6objectERKNS2_8platform9CUDAPlaceEbEvIS5_S8_SC_bEINS_4nameENS_9is_methodENS_7siblingENS_3argESJ_NS_5arg_vEEEEvOT_PFT0_DpT1_EDpRKT2_ENUlRNS_6detail13function_callEE1_4_FUNESY_
W0311 14:19:03.482812 2719 init.cc:217] @ 0x7f77fd12cfc1 pybind11::cpp_function::dispatcher()
W0311 14:19:03.485262 2719 init.cc:217] @ 0x7f7867e99d86 _PyCFunction_FastCallDict
W0311 14:19:03.487357 2719 init.cc:217] @ 0x7f7867f2ccc8 call_function
W0311 14:19:03.489573 2719 init.cc:217] @ 0x7f7867f30c47 _PyEval_EvalFrameDefault
W0311 14:19:03.491575 2719 init.cc:217] @ 0x7f7867f2c1d0 _PyFunction_FastCall
W0311 14:19:03.493618 2719 init.cc:217] @ 0x7f7867f2d0fd call_function
W0311 14:19:03.496006 2719 init.cc:217] @ 0x7f7867f30c47 _PyEval_EvalFrameDefault
W0311 14:19:03.498075 2719 init.cc:217] @ 0x7f7867f2c1d0 _PyFunction_FastCall
W0311 14:19:03.500082 2719 init.cc:217] @ 0x7f7867f2d0fd call_function
W0311 14:19:03.502377 2719 init.cc:217] @ 0x7f7867f30c47 _PyEval_EvalFrameDefault
W0311 14:19:03.504413 2719 init.cc:217] @ 0x7f7867f2cb64 _PyEval_EvalCodeWithName
W0311 14:19:03.506582 2719 init.cc:217] @ 0x7f7867f351d6 _PyFunction_FastCallDict
W0311 14:19:03.508745 2719 init.cc:217] @ 0x7f7867e3e536 _PyObject_FastCallDict