启动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!
尚未找到不改变版本就能解决的办法