启动bertserving服务报错,TypeError: ‘NoneType‘ object is not iterable

启动bertserving服务报错,TypeError: ‘NoneType’ object is not iterable

usage: D:\anaconda\envs\py36\Scripts\bert-serving-start -model_dir E:\project\event_extract\btsc\Event_ontology\model\chinese_L-12_H-768_A-12 -num_worker=1
                 ARG   VALUE
__________________________________________________
           ckpt_name = bert_model.ckpt
         config_name = bert_config.json
                cors = *
                 cpu = False
          device_map = []
       do_lower_case = True
  fixed_embed_length = False
                fp16 = False
 gpu_memory_fraction = 0.5
       graph_tmp_dir = None
    http_max_connect = 10
           http_port = None
        mask_cls_sep = False
      max_batch_size = 256
         max_seq_len = 25
           model_dir = E:\project\event_extract\btsc\Event_ontology\model\chinese_L-12_H-768_A-12
no_position_embeddings = False
    no_special_token = False
          num_worker = 1
       pooling_layer = [-2]
    pooling_strategy = REDUCE_MEAN
                port = 5555
            port_out = 5556
       prefetch_size = 10
 priority_batch_size = 16
show_tokens_to_client = False
     tuned_model_dir = None
             verbose = False
                 xla = False

I:?[35mVENTILATOR?[0m:freeze, optimize and export graph, could take a while...
D:\anaconda\envs\py36\lib\site-packages\tensorflow\python\framework\dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(
1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
D:\anaconda\envs\py36\lib\site-packages\tensorflow\python\framework\dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(
1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
D:\anaconda\envs\py36\lib\site-packages\tensorflow\python\framework\dtypes.py:528: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(
1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
D:\anaconda\envs\py36\lib\site-packages\tensorflow\python\framework\dtypes.py:529: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(
1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
D:\anaconda\envs\py36\lib\site-packages\tensorflow\python\framework\dtypes.py:530: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(
1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
D:\anaconda\envs\py36\lib\site-packages\tensorflow\python\framework\dtypes.py:535: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(
1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
I:?[36mGRAPHOPT?[0m:model config: E:\project\event_extract\btsc\Event_ontology\model\chinese_L-12_H-768_A-12\bert_config.json
I:?[36mGRAPHOPT?[0m:checkpoint: E:\project\event_extract\btsc\Event_ontology\model\chinese_L-12_H-768_A-12\bert_model.ckpt
I:?[36mGRAPHOPT?[0m:build graph...
E:?[36mGRAPHOPT?[0m:fail to optimize the graph!
Traceback (most recent call last):
  File "D:\anaconda\envs\py36\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "D:\anaconda\envs\py36\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "D:\anaconda\envs\py36\Scripts\bert-serving-start.exe\__main__.py", line 7, in <module>
  File "D:\anaconda\envs\py36\lib\site-packages\bert_serving\server\cli\__init__.py", line 4, in main
    with BertServer(get_run_args()) as server:
  File "D:\anaconda\envs\py36\lib\site-packages\bert_serving\server\__init__.py", line 71, in __init__
    self.graph_path, self.bert_config = pool.apply(optimize_graph, (self.args,))
TypeError: 'NoneType' object is not iterable

解决方法:换版本
之前:tensorflow=1.13.1,server和client都是1.10.0版本
换成 :tensorflow=1.15.0,server和client都是1.10.0版本
再次启动可以成功

2022-09-20 15:48:53.235396: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1304] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 3071 MB memory) -> physical GPU (device: 0, name: NVIDIA GeForce GTX 1660
 Ti, pci bus id: 0000:01:00.0, compute capability: 7.5)
2022-09-20 15:49:07.140398: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cublas64_100.dll
I:?[33mWORKER-0?[0m:ready and listening!
I:?[35mVENTILATOR?[0m:all set, ready to serve request!

尚未找到不改变版本就能解决的办法

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值