Bert-as-service: not able to start the server

Created on 1 Jun 2019  路  3Comments  路  Source: hanxiao/bert-as-service

Prerequisites

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

System information

Some of this information can be collected via this script.

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): ubuntu 16.04
  • TensorFlow installed from (source or binary):
  • TensorFlow version:1.10
  • Python version:
  • bert-as-service version: 3.6
  • GPU model and memory: VGA compatible controller [0300]: NVIDIA Corporation GP102 [GeForce GTX 1080 Ti] [10de:1b06] (rev a1) (prog-if 00 [VGA controller])
  • CPU model and memory:

Description

Please replace YOUR_SERVER_ARGS and YOUR_CLIENT_ARGS accordingly. You can also write your own description for reproducing the issue.

I'm using this command to start the server:

bert-serving-start YOUR_SERVER_ARGS

and calling the server via:

bc = BertClient(YOUR_CLIENT_ARGS)
bc.encode()

Then this issue shows up:

E:GRAPHOPT:[gra:opt:150]:fail to optimize the graph!
Traceback (most recent call last):
  File "/home/sgnbx/anaconda3/envs/py3/lib/python3.5/site-packages/bert_serving/server/graph.py", line 57, in optimize_graph
    bert_config = modeling.BertConfig.from_dict(json.load(f))
  File "/home/sgnbx/anaconda3/envs/py3/lib/python3.5/json/__init__.py", line 265, in load
    return loads(fp.read(),
  File "/home/sgnbx/anaconda3/envs/py3/lib/python3.5/site-packages/tensorflow/python/lib/io/file_io.py", line 125, in read
    self._preread_check()
  File "/home/sgnbx/anaconda3/envs/py3/lib/python3.5/site-packages/tensorflow/python/lib/io/file_io.py", line 85, in _preread_check
    compat.as_bytes(self.__name), 1024 * 512, status)
  File "/home/sgnbx/anaconda3/envs/py3/lib/python3.5/site-packages/tensorflow/python/framework/errors_impl.py", line 519, in __exit__
    c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.NotFoundError: /tmp/english_L-12_H-768_A-12/bert_config.json; No such file or directory
Traceback (most recent call last):
  File "/home/sgnbx/anaconda3/envs/py3/bin/bert-serving-start", line 11, in <module>
    sys.exit(main())
  File "/home/sgnbx/anaconda3/envs/py3/lib/python3.5/site-packages/bert_serving/server/cli/__init__.py", line 4, in main
    with BertServer(get_run_args()) as server:
  File "/home/sgnbx/anaconda3/envs/py3/lib/python3.5/site-packages/bert_serving/server/__init__.py", line 70, in __init__
    self.graph_path, self.bert_config = pool.apply(optimize_graph, (self.args,))
TypeError: 'NoneType' object is not iterable

...

Most helpful comment

Hi, I notice one thing.
change the _PATH_ '/tmp/english_L-12_H-768_A-12/' to 'tmp/english_L-12_H-768_A-12/' or './tmp/english_L-12_H-768_A-12/' works well for me.
You might try.

All 3 comments

Hi @sariagoudarzvand as mentioned in your error log, tensorflow can't find your bert_config file. Can you make sure that it is at intended path and rerun again and see if it still throws the error.
tensorflow.python.framework.errors_impl.NotFoundError: /tmp/english_L-12_H-768_A-12/bert_config.json; No such file or directory Traceback (most recent call last):

Hi, I notice one thing.
change the _PATH_ '/tmp/english_L-12_H-768_A-12/' to 'tmp/english_L-12_H-768_A-12/' or './tmp/english_L-12_H-768_A-12/' works well for me.
You might try.

Hi, I notice one thing.
change the _PATH_ '/tmp/english_L-12_H-768_A-12/' to 'tmp/english_L-12_H-768_A-12/' or './tmp/english_L-12_H-768_A-12/' works well for me.
You might try.

Thank you very much! It works for my code.

Was this page helpful?
0 / 5 - 0 ratings