jina-ai / clip-as-service

🏄 Scalable embedding, reasoning, ranking for images and sentences with CLIP
https://clip-as-service.jina.ai
Other
12.43k stars 2.07k forks source link

bert-serving-server在windows下的启动问题 #357

Open Constant-TL opened 5 years ago

Constant-TL commented 5 years ago

Prerequisites

Please fill in by replacing [ ] with [x].

System information

Some of this information can be collected via this script.


Description

I'm using this command to start the server:

bert-serving-start -model_dir=F:\DL\Constant-TL\BERT\chinese_L-12_H-768_A-12

Then this issue shows up:

usage: D:\DL\anaconda3\Scripts\bert-serving-start -model_dir=F:\DL\Constant-TL\BERT\chinese_L-12_H-768_A-12
                 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 = F:\DL\Constant-TL\BERT\chinese_L-12_H-768_A-12
          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...
I:?[36mGRAPHOPT?[0m:model config: F:\DL\Constant-TL\BERT\chinese_L-12_H-768_A-12\bert_config.json
I:?[36mGRAPHOPT?[0m:checkpoint: F:\DL\Constant-TL\BERT\chinese_L-12_H-768_A-12\bert_model.ckpt
E:?[36mGRAPHOPT?[0m:fail to optimize the graph!
Traceback (most recent call last):
  File "d:\dl\anaconda3\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "d:\dl\anaconda3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "D:\DL\anaconda3\Scripts\bert-serving-start.exe\__main__.py", line 9, in <module>
  File "d:\dl\anaconda3\lib\site-packages\bert_serving\server\cli\__init__.py", line 4, in main
    with BertServer(get_run_args()) as server:
  File "d:\dl\anaconda3\lib\site-packages\bert_serving\server\__init__.py", line 70, in __init__
    self.graph_path, self.bert_config = pool.apply(optimize_graph, (self.args,))
TypeError: cannot unpack non-iterable NoneType object
Constant-TL commented 5 years ago

这个问题之前在另一台Linux mint系统的服务器也出现过,不过后来不知道由于什么原因突然就可以运行了,但在windows上这个问题一直没有解决

Jeffyangchina commented 5 years ago

The same problem met in Windows10, did anyone know the result? I tried version of tensorflow-gpu 1.12 and 1.10 , 1.9.1 version of bert-server

Jeffyangchina commented 5 years ago

The problem done by reducing the version to 1.8

Constant-TL commented 5 years ago

The problem done by reducing the version to 1.8

Is the bert-as-server reduced to version 1.8? Can you send me your resolution process? @Jeffyangchina Thanks for you help.

Jeffyangchina commented 5 years ago

pip install -U bert-serving-server==1.8

Constant-TL commented 5 years ago

After reducing the version to 1.8, another problem appeared:

I:?[35mVENTILATOR?[0m:freeze, optimize and export graph, could take a while...
I:?[36mGRAPHOPT?[0m:model config: F:\DL\Constant-TL\BERT\chinese_L-12_H-768_A-12\bert_config.json
I:?[36mGRAPHOPT?[0m:checkpoint: F:\DL\Constant-TL\BERT\chinese_L-12_H-768_A-12\bert_model.ckpt
E:?[36mGRAPHOPT?[0m:fail to optimize the graph!
Traceback (most recent call last):
  File "d:\dl\anaconda3\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "d:\dl\anaconda3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "D:\DL\anaconda3\Scripts\bert-serving-start.exe\__main__.py", line 9, in <module>
  File "d:\dl\anaconda3\lib\site-packages\bert_serving\server\cli\__init__.py", line 5, in main
    server = BertServer(args)
  File "d:\dl\anaconda3\lib\site-packages\bert_serving\server\__init__.py", line 76, in __init__
    raise FileNotFoundError('graph optimization fails and returns empty result')
FileNotFoundError: graph optimization fails and returns empty result
dforel commented 5 years ago

在lib\bert_serving\server\graph.py 中引入 import traceback方法, 在150行(except Exception :后面)插入语句traceback.print_exc()。重新运行,打印出配置失败的原因是目录没对。重新检查目录后成功。所以,正确方法是打印出真正的错误原因。

yecphaha commented 5 years ago

bert-serving-server目前还不支持tensorflow2.0? TensorFlow version: 2.0.0b1 Python version: 3.7.3 bert-serving-server version: 1.8.0 bert-serving-client version: 1.9.6

bert-serving-start -model_dir=E:/code/NLP/chinese_L-12_H-768_A-12 -num_worker=2

Traceback (most recent call last): File "g:\python\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "g:\python\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "G:\Python\Scripts\bert-serving-start.exe__main__.py", line 5, in File "g:\python\lib\site-packages\bert_serving\server__init__.py", line 29, in _tfver = check_tf_version() File "g:\python\lib\site-packages\bert_serving\server\helper.py", line 141, in check_tf_version assert int(tf_ver[0]) >= 1 and int(tf_ver[1]) >= 10, 'Tensorflow >=1.10 is required!' AssertionError: Tensorflow >=1.10 is required!