xmxoxo / BERT-train2deploy

BERT模型从训练到部署
517 stars 165 forks source link

服务端接收请求后无响应 #29

Closed hejinlong closed 2 years ago

hejinlong commented 2 years ago

服务端:

 * Serving Flask app 'bert_base.server.http' (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on all addresses.
   WARNING: This is a development server. Do not use it in a production deployment.
 * Running on http://127.0.0.1:8091/ (Press CTRL+C to quit)
Process BertWorker-3:
Traceback (most recent call last):
  File "/home/long/anaconda3/envs/py36/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/home/long/anaconda3/envs/py36/lib/python3.6/site-packages/bert_base-0.0.9-py3.6.egg/bert_base/server/__init__.py", line 490, in run
    self._run()
  File "/home/long/anaconda3/envs/py36/lib/python3.6/site-packages/pyzmq-22.3.0-py3.6-linux-x86_64.egg/zmq/decorators.py", line 76, in wrapper
    return func(*args, **kwargs)
  File "/home/long/anaconda3/envs/py36/lib/python3.6/site-packages/bert_base-0.0.9-py3.6.egg/bert_base/server/zmq_decor.py", line 27, in wrapper
    return func(*args, **kwargs)
  File "/home/long/anaconda3/envs/py36/lib/python3.6/site-packages/bert_base-0.0.9-py3.6.egg/bert_base/server/__init__.py", line 508, in _run
    for r in estimator.predict(input_fn=self.input_fn_builder(receivers, tf), yield_single_examples=False):
  File "/home/long/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 622, in predict
    features, None, ModeKeys.PREDICT, self.config)
  File "/home/long/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 1149, in _call_model_fn
    model_fn_results = self._model_fn(features=features, **kwargs)
  File "/home/long/anaconda3/envs/py36/lib/python3.6/site-packages/bert_base-0.0.9-py3.6.egg/bert_base/server/__init__.py", line 466, in classification_model_fn
    pred_probs = tf.import_graph_def(graph_def, name='', input_map=input_map, return_elements=['pred_prob:0'])
  File "/home/long/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow_core/python/util/deprecation.py", line 507, in new_func
    return func(*args, **kwargs)
  File "/home/long/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow_core/python/framework/importer.py", line 405, in import_graph_def
    producer_op_list=producer_op_list)
  File "/home/long/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow_core/python/framework/importer.py", line 535, in _import_graph_def_internal
    ', '.join(missing_unused_input_keys))
ValueError: Attempted to map inputs that were not found in graph_def: [segment_ids:0]
I:PROXY:[htt:enc: 47]:new request from 127.0.0.1
{'id': 111, 'texts': ['总的来说,这款手机性价比是特别高的。', '槽糕的售后服务!!!店大欺客'], 'is_tokenized': False}
I:VENTILATOR:[__i:_ru:215]:new encode request   req id: 1   size: 2 client: b'a70d9fe9-5fa6-487f-9e0d-6063053bd11b'
I:SINK:[__i:_ru:369]:job register   size: 2 job id: b'a70d9fe9-5fa6-487f-9e0d-6063053bd11b#1'

客户端: curl -X POST http://127.0.0.1:8091/encode -H 'content-type: application/json' -d '{"id": 111,"texts": ["总的来说,这款手机性价比是特别高的。","槽糕的售后服务!!!店大欺客"], "is_tokenized": false}'