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

TypeError: 'NoneType' object is not iterable #655

Open muzimua opened 2 years ago

muzimua commented 2 years ago

Prerequisites

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

System information

Some of this information can be collected via this script.


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 commented 2 years ago

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

lixuanhng commented 2 years ago

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!!