clip-as-service icon indicating copy to clipboard operation
clip-as-service copied to clipboard

TypeError: 'NoneType' object is not iterable

Open HeziLiu opened this issue 4 years ago • 20 comments

env win10 python3.6 bert-serving-client/server 1.9.7 tensorflow 1.14.0 and i got this: E:\Software\Python3.6.5\Scripts>bert-serving-start -model_dir ./uncased_L-12_H-768_A-12/ -num_worker=4 usage: E:\Software\Python3.6.5\Scripts\bert-serving-start -model_dir ./uncased_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 = ./uncased_L-12_H-768_A-12/ 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:[35mVENTILATOR[0m:freeze, optimize and export graph, could take a while... WARNING:tensorflow:From e:\software\python3.6.5\lib\site-packages\bert_serving\server\helper.py:184: The name tf.logging.set_verbosity is deprecated. Please use tf.compat.v1.logging.set_verbosity instead.

WARNING:tensorflow:From e:\software\python3.6.5\lib\site-packages\bert_serving\server\helper.py:184: The name tf.logging.ERROR is deprecated. Please use tf.compat.v1.logging.ERROR instead.

I:[36mGRAPHOPT[0m:model config: ./uncased_L-12_H-768_A-12/bert_config.json I:[36mGRAPHOPT[0m:checkpoint: ./uncased_L-12_H-768_A-12/bert_model.ckpt I:[36mGRAPHOPT[0m:build graph... E:[36mGRAPHOPT[0m:fail to optimize the graph! Traceback (most recent call last): File "e:\software\python3.6.5\lib\runpy.py", line 193, in run_module_as_main "main", mod_spec) File "e:\software\python3.6.5\lib\runpy.py", line 85, in run_code exec(code, run_globals) File "E:\Software\Python3.6.5\Scripts\bert-serving-start.exe_main.py", line 9, in File "e:\software\python3.6.5\lib\site-packages\bert_serving\server\cli_init.py", line 4, in main with BertServer(get_run_args()) as server: File "e:\software\python3.6.5\lib\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

HeziLiu avatar Nov 29 '19 03:11 HeziLiu

I have the same question!Have you solved it?

aszhanghuali avatar Dec 02 '19 09:12 aszhanghuali

Facing the same issue when I tried to start the server, here is the stacktrace - looks like issue related to tensorflow 2.0 updates. Please let us know if this will be addressed soon.

I:VENTILATOR:[__i:__i: 67]:freeze, optimize and export graph, could take a while... E:GRAPHOPT:[gra:opt:151]:fail to optimize the graph! Traceback (most recent call last): File "skc/environments/.virtualenvs/bert/lib/python3.6/site-packages/bert_serving/server/graph.py", line 41, in optimize_graph tf = import_tf(verbose=args.verbose) File "/environments/.virtualenvs/bert/lib/python3.6/site-packages/bert_serving/server/helper.py", line 186, in import_tf tf.logging.set_verbosity(tf.logging.DEBUG if verbose else tf.logging.ERROR) AttributeError: module 'tensorflow' has no attribute 'logging' Traceback (most recent call last): File "/environments/.virtualenvs/bert/bin/bert-serving-start", line 8, in sys.exit(main()) File "/environments/.virtualenvs/bert/lib/python3.6/site-packages/bert_serving/server/cli/init.py", line 4, in main with BertServer(get_run_args()) as server: File "/home/imagen/skc/environments/.virtualenvs/bert/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 $ bert-serving-start -model_dir /bert/bert-models/cased_L-12_H-768_A-12/ -num_worker=1 /home/imagen/skc/environments/.virtualenvs/bert/lib/python3.6/site-packages/bert_serving/server/helper.py:176: UserWarning: Tensorflow 2.0.0 is not tested! It may or may not work. Feel free to submit an issue at https://github.com/hanxiao/bert-as-service/issues/ 'Feel free to submit an issue at https://github.com/hanxiao/bert-as-service/issues/' % tf.version)

sivakumarch avatar Dec 02 '19 15:12 sivakumarch

sorry - downgrading to tensorflow 1.x worked, it was due to 2.0 updates. I tried to upgrade the bert_serving scripts using 2.0 tools, but I wasn't successful as there were some errors.

sivakumarch avatar Dec 02 '19 16:12 sivakumarch

I have the same question!Have you solved it?

I change to another env with
tensorflow 1.13.1 bert-serving-client/server 1.9.9 python3.7 and it works well😀

HeziLiu avatar Dec 04 '19 03:12 HeziLiu

sorry - downgrading to tensorflow 1.x worked, it was due to 2.0 updates. I tried to upgrade the bert_serving scripts using 2.0 tools, but I wasn't successful as there were some errors.

but with my env with tensorflow 1.14.0 it seems doesn't work....

HeziLiu avatar Dec 04 '19 03:12 HeziLiu

downgrading to tensorflow version 1.15 seems to work for me

ginward avatar Dec 28 '19 16:12 ginward

check the path of the downloaded model.

nonononanana avatar Jan 20 '20 09:01 nonononanana

I have the same question!Have you solved it?

I change to another env with tensorflow 1.13.1 bert-serving-client/server 1.9.9 python3.7 and it works well😀

thank you so much , finally it work for me !

AsmaZbt avatar Jan 22 '20 22:01 AsmaZbt

I meet that issue to..but I don't want to downgrading,Is there have any other settlement work for 2.0

sprite0153 avatar Feb 26 '20 02:02 sprite0153

I am still facing the above issue have tried couple of solutions. Version - tensorflow-cpu = 1.13.1 Bert_serving_client = 1.9.9 Bert_serving_server = 1.9.9

harshitbh avatar Dec 03 '20 12:12 harshitbh

I am running the below command after locating at model_dir command bert-serving-start -model_dir uncased_L-2_H-128_A-2\ -cpu files present in model_dir :bert_config.json,bert_model.ckpt.data-00000-of-00001,bert_model.ckpt.index,vocab.txt have tried with providing absolute path till model directory too system config - 12 gb ram. let me know how could I resolve this.Thanks in advance

harshitbh avatar Dec 04 '20 10:12 harshitbh

I am getting the same problem in windows, although I tried all the methods. "TypeError: 'NoneType' object is not iterable". Please somebody help me.

Jaswanth-Batturi avatar Dec 10 '20 16:12 Jaswanth-Batturi

你们模型目录写错啦

wingzzzz avatar Jan 15 '21 06:01 wingzzzz

你们模型目录写错啦 那应该怎么写呢,没有发现哪里写错了

Doracoco avatar Mar 28 '21 07:03 Doracoco

你们模型目录写错啦 那应该怎么写呢,没有发现哪里写错了

你试试绝对路径

wingzzzz avatar Mar 28 '21 07:03 wingzzzz

你们模型目录写错啦 那应该怎么写呢,没有发现哪里写错了

你试试绝对路径

还是不行的,我的绝对路径还是不行,不过还是谢谢你啦

Doracoco avatar Mar 28 '21 07:03 Doracoco

加速 入关

nonononanana avatar Mar 29 '21 06:03 nonononanana

你们模型目录写错啦 那应该怎么写呢,没有发现哪里写错了

你试试绝对路径

还是不行的,我的绝对路径还是不行,不过还是谢谢你啦

有可能是tensorflow版本过高,api不兼容,只支持1.x.x版本的。报错信息跟进去,可以看到源码,大于1的版本会报一个未测试验证的警告。

wingzzzz avatar Apr 04 '21 02:04 wingzzzz

你们模型目录写错啦 那应该怎么写呢,没有发现哪里写错了

你最后怎么弄的呀 我要崩溃了

dogrepairditch avatar Mar 16 '22 12:03 dogrepairditch

您好,我已经收到您的邮件,我将尽快处理。                                                                                                --胡思可

Doracoco avatar Mar 16 '22 12:03 Doracoco