Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: 'NoneType' object is not iterable #655

Open
4 tasks
muzimua opened this issue Mar 21, 2022 · 2 comments
Open
4 tasks

TypeError: 'NoneType' object is not iterable #655

muzimua opened this issue Mar 21, 2022 · 2 comments

Comments

@muzimua
Copy link

muzimua commented Mar 21, 2022

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):
  • TensorFlow installed from (source or binary):
  • TensorFlow version: 1.13.1
  • Python version: python3.6.13
  • bert-as-service version:
  • GPU model and memory:
  • 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:

.../Users/litingting/opt/anaconda3/envs/deeplearning/lib/python3.6/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)])
/Users/litingting/opt/anaconda3/envs/deeplearning/lib/python3.6/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)])
/Users/litingting/opt/anaconda3/envs/deeplearning/lib/python3.6/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)])
/Users/litingting/opt/anaconda3/envs/deeplearning/lib/python3.6/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)])
/Users/litingting/opt/anaconda3/envs/deeplearning/lib/python3.6/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)])
/Users/litingting/opt/anaconda3/envs/deeplearning/lib/python3.6/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)])
usage: /Users/litingting/opt/anaconda3/envs/deeplearning/bin/bert-serving-start -model_dir=/Users/litingting/Desktop/Bert/chinese_L-12_H-768_A-12 -num_worker=4
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 = /Users/litingting/Desktop/Bert/chinese_L-12_H-768_A-12
no_position_embeddings = False
no_special_token = False
num_worker = 4
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:VENTILATOR:[__i:__i: 67]:freeze, optimize and export graph, could take a while...
I:GRAPHOPT:[gra:opt: 53]:model config: /Users/litingting/Desktop/Bert/chinese_L-12_H-768_A-12/bert_config.json
I:GRAPHOPT:[gra:opt: 56]:checkpoint: /Users/litingting/Desktop/Bert/chinese_L-12_H-768_A-12/bert_model.ckpt
E:GRAPHOPT:[gra:opt:154]:fail to optimize the graph!
Traceback (most recent call last):
File "/Users/litingting/opt/anaconda3/envs/deeplearning/lib/python3.6/site-packages/bert_serving/server/graph.py", line 58, in optimize_graph
bert_config = modeling.BertConfig.from_dict(json.load(f))
File "/Users/litingting/opt/anaconda3/envs/deeplearning/lib/python3.6/json/init.py", line 296, in load
return loads(fp.read(),
File "/Users/litingting/opt/anaconda3/envs/deeplearning/lib/python3.6/site-packages/tensorflow/python/lib/io/file_io.py", line 125, in read
self._preread_check()
File "/Users/litingting/opt/anaconda3/envs/deeplearning/lib/python3.6/site-packages/tensorflow/python/lib/io/file_io.py", line 85, in _preread_check
compat.as_bytes(self.__name), 1024 * 512, status)
File "/Users/litingting/opt/anaconda3/envs/deeplearning/lib/python3.6/site-packages/tensorflow/python/framework/errors_impl.py", line 528, in exit
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.PermissionDeniedError: /Users/litingting/Desktop/Bert/chinese_L-12_H-768_A-12/bert_config.json; Operation not permitted
Traceback (most recent call last):
File "/Users/litingting/opt/anaconda3/envs/deeplearning/bin/bert-serving-start", line 8, in
sys.exit(main())
File "/Users/litingting/opt/anaconda3/envs/deeplearning/lib/python3.6/site-packages/bert_serving/server/cli/init.py", line 4, in main
with BertServer(get_run_args()) as server:
File "/Users/litingting/opt/anaconda3/envs/deeplearning/lib/python3.6/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

Error log:tensorflow.python.framework.errors_impl.PermissionDeniedError: /Users/litingting/Desktop/Bert/chinese_L-12_H-768_A-12/bert_config.json; Operation not permitted

How can I solve this problem?

@bilalghanem
Copy link

I solved it by downloading tensorflow-gpu==1.15.0.

@lixuanhng
Copy link

I solved it by downloading tensorflow-gpu==1.15.0.

Hi can I ask how the others versions chosen? I set python=3.6.13, tensorflow-gpu=1.15.0, bert-serving-client/server=1.10.0, but still got [TypeError: 'NoneType' object is not iterable] error (tensorflow-gpu works well btw). Thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants