bert-serving-start TypeError: ‘NoneType‘ object is not iterable window cpu环境下解决方案

window环境下随缘发生以上问题,昨天还好用,今天server启动不了报错如文章标题

相关的解决方案链接:
https://blog.csdn.net/konghao_xia/article/details/103418919?utm_medium=distribute.pc_relevant_t0.none-task-blog-OPENSEARCH-1.control&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-OPENSEARCH-1.control

该博主提供了一些线索吧,并没能解决我的问题。

从源码里看问题可能有两个。首先吧:
graph.py里的这个try except 去掉,详细找下问题


def optimize_graph(args, logger=None):
    if not logger:
        logger = set_logger(colored('GRAPHOPT', 'cyan'), args.verbose)
    try:
    # 里面内容取出来

可能的问题1:

with tf.gfile.GFile(config_fp, 'r') as f:
	bert_config = modeling.BertConfig.from_dict(json.load(f))

文件路径一定要保证对,在对的情况下这个bert_config.json里的内容可能不能被正确读取,可以自己复制出来做成dict传给modeling.BertConfig.from_dict

dicti = {
    "attention_probs_dropout_prob": 0.1,
    "directionality": "bidi",
    "hidden_act": "gelu",
    "hidden_dropout_prob": 0.1,
    "hidden_size": 768,
    "initializer_range": 0.02,
    "intermediate_size": 3072,
    "max_position_embeddings": 512,
    "num_attention_heads": 12,
    "num_hidden_layers": 12,
    "pooler_fc_size": 768,
    "pooler_num_attention_heads": 12,
    "pooler_num_fc_layers": 3,
    "pooler_size_per_head": 128,
    "pooler_type": "first_token_transform",
    "type_vocab_size": 2,
    "vocab_size": 21128
}
bert_config = modeling.BertConfig.from_dict(dicti)

可能的问题2

pandas.core.computation’ has no attribute 'expressions
dask 版本不对,pandas版本太低
升级dask 到2.6.0 pandas到0.25.3

如果出现新的报错:

if fsspec is None or LooseVersion(fsspec.__version__) < LooseVersion("0.3.3"):
    raise ImportError(
        "fsspec is required to use any file-system functionality."
        " Please install using\n"
        "conda install -c conda-forge 'fsspec>=0.3.3'\n"
        "or\n"
        "pip install 'fsspec>=0.3.3'"
    )

说明没有安装fsspec
fsspec 安装0.8.3版本即可

后续server即可正常工作……

2020-12-25 11:24:24.746125: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_100.dll'; dlerror: cudart64_100.dll not found
2020-12-25 11:24:24.746661: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
I:VENTILATOR:freeze, optimize and export graph, could take a while...
2020-12-25 11:24:28.751671: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_100.dll'; dlerror: cudart64_100.dll not found
2020-12-25 11:24:28.752207: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
WARNING:tensorflow:From C:\Users\zlh\AppData\Roaming\Python\Python36\site-packages\bert_serving\server\helper.py:186: The name tf.logging.set_verbosity is deprecated. Please use tf.compat.v1.logging.set_verbosity instead.
WARNING:tensorflow:From C:\Users\zlh\AppData\Roaming\Python\Python36\site-packages\bert_serving\server\helper.py:186: The name tf.logging.ERROR is deprecated. Please use tf.compat.v1.logging.ERROR instead.
I:GRAPHOPT:model config: .\chinese_L-12_H-768_A-12\bert_config.json
I:GRAPHOPT:checkpoint: .\chinese_L-12_H-768_A-12\bert_model.ckpt
I:GRAPHOPT:build graph...
2020-12-25 11:24:40.003702: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2020-12-25 11:24:40.010406: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'nvcuda.dll'; dlerror: nvcuda.dll not found
2020-12-25 11:24:40.012193: E tensorflow/stream_executor/cuda/cuda_driver.cc:318] failed call to cuInit: UNKNOWN ERROR (303)
2020-12-25 11:24:40.016423: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: DESKTOP-2MUS58Q
2020-12-25 11:24:40.017082: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: DESKTOP-2MUS58Q
I:GRAPHOPT:load parameters from checkpoint...
I:GRAPHOPT:optimize...
I:GRAPHOPT:freeze...
I:GRAPHOPT:write graph to a tmp file: C:\Users\zlh\AppData\Local\Temp\tmphht802ch
I:VENTILATOR:optimized graph is stored at: C:\Users\zlh\AppData\Local\Temp\tmphht802ch
I:VENTILATOR:bind all sockets
I:VENTILATOR:open 8 ventilator-worker sockets
I:VENTILATOR:start the sink
2020-12-25 11:24:45.601424: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_100.dll'; dlerror: cudart64_100.dll not found
2020-12-25 11:24:45.601814: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
I:SINK:ready
I:VENTILATOR:get devices
I:VENTILATOR:device map: 
		worker  0 -> cpu
2020-12-25 11:24:50.476211: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_100.dll'; dlerror: cudart64_100.dll not found
2020-12-25 11:24:50.476746: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
I:WORKER-0:use device cpu, load graph from C:\Users\zlh\AppData\Local\Temp\tmphht802ch
WARNING:tensorflow:From C:\Users\zlh\AppData\Roaming\Python\Python36\site-packages\bert_serving\server\helper.py:186: The name tf.logging.set_verbosity is deprecated. Please use tf.compat.v1.logging.set_verbosity instead.
WARNING:tensorflow:From C:\Users\zlh\AppData\Roaming\Python\Python36\site-packages\bert_serving\server\helper.py:186: The name tf.logging.ERROR is deprecated. Please use tf.compat.v1.logging.ERROR instead.
2020-12-25 11:24:57.460612: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2020-12-25 11:24:57.463279: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'nvcuda.dll'; dlerror: nvcuda.dll not found
2020-12-25 11:24:57.463640: E tensorflow/stream_executor/cuda/cuda_driver.cc:318] failed call to cuInit: UNKNOWN ERROR (303)
2020-12-25 11:24:57.467545: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: DESKTOP-2MUS58Q
2020-12-25 11:24:57.468147: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: DESKTOP-2MUS58Q
I:WORKER-0:ready and listening!
I:VENTILATOR:all set, ready to serve request!

你可能感兴趣的:(工程,tensorflow)