Bert-as-service: TypeError: cannot unpack non-iterable NoneType object

Created on 16 Mar 2019  ·  6Comments  ·  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):windows10
  • TensorFlow installed from (source or binary):
  • TensorFlow version:1.13.0
  • Python version:3.7
  • bert-as-service version: latest
  • GPU model and memory: 2080 8G
  • CPU model and memory: AMD 40G

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 -model_dir D:\chinese_L-12_H-768_A-12\ -num_worker=4

Then this issue shows up:
image

Traceback (most recent call last):
File "c:userskodgvanaconda3librunpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:userskodgvanaconda3librunpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:UsersKODGVAnaconda3Scriptsbert-serving-start.exe__main__.py", line 9, in
File "c:userskodgvanaconda3libsite-packagesbert_servingservercli__init__.py", line 5, in main
server = BertServer(args)
File "c:userskodgvanaconda3libsite-packagesbert_servingserver__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

i'm using the full path of the files

Most helpful comment

For those who are on a CPU:
Follow these two steps if you're getting the same error.

  1. pip uninstall ___current_version_of_tf___
  2. pip install tensorflow==1.13.0rc1

All 6 comments

it seems there may be some problems with the latest tensorflow version. i downgrade tensorflow-gpu==1.12.0 to fix the problem.

Updated the latest version of Tensorflow and have given absolute path still the same error

For those who are on a CPU:
Follow these two steps if you're getting the same error.

  1. pip uninstall ___current_version_of_tf___
  2. pip install tensorflow==1.13.0rc1

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

谷歌了很多,最后发现只有打印出真正的错误原因才可以解决。这是真的可以解决方法

Because tensorflow has no logging
The traceback error: AttributeError: module 'tensorflow' has no attribute 'logging'
So downgrade the version.

My issue was with the pre-trained model I was trying to use. Check whether you get the same error with the original pre-trained BERT models.

Was this page helpful?
0 / 5 - 0 ratings