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

启动时时报【GRAPHOPT:fail to optimize the graph!】

Open shamrockzhao opened this issue 4 years ago • 14 comments

I:VENTILATOR:freeze, optimize and export graph, could take a while... I:GRAPHOPT:model config: /d/work/chinese_L-12_H-768_A-12/bert_config.json I:GRAPHOPT:checkpoint: /d/work/chinese_L-12_H-768_A-12/bert_model.ckpt E:GRAPHOPT:fail to optimize the graph! Traceback (most recent call last): File "D:\Python\Python37\Lib\runpy.py", line 193, in run_module_as_main "main", mod_spec) File "D:\Python\Python37\Lib\runpy.py", line 85, in run_code exec(code, run_globals) File "D:\Softwares\envNLP\Scripts\bert-serving-start.exe_main.py", line 7, in File "d:\softwares\envnlp\lib\site-packages\bert_serving\server\cli_init.py", line 4, in main with BertServer(get_run_args()) as server: File "d:\softwares\envnlp\lib\site-packages\bert_serving\server_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

shamrockzhao avatar Oct 23 '19 06:10 shamrockzhao

I have the same issue and it seems related to path but no other mentioned solutions worked. Now I need to read the source code and edit it myself.

Nikronic avatar Oct 23 '19 14:10 Nikronic

@shamrockzhao I traced the code and found error but I am not familiar with Tensorflow so I could not fix it. #469

Nikronic avatar Oct 23 '19 21:10 Nikronic

I had the same issue. Downgraded from TF 2.0 to 1.10 and it worked. Something to do with new logging

sergey-volokhin avatar Oct 28 '19 21:10 sergey-volokhin

I downgraded to 1.15 and it did not work. Also I changed source code and removed all loggings and added some breakpoints and found out the model cannot be constructed and code never stops in loggings even before I remove them.

Nikronic avatar Oct 29 '19 09:10 Nikronic

Try giving the absolute path for the model dir

markedmiston avatar Nov 01 '19 18:11 markedmiston

@mtedmist I tried all possible way of giving the path and it does not work on tensorflow 1.15> I have not tried tf 1.10 yet as @TheJdxfh said. I think he is right, because other issues pointing out to tf version and the ones who achieved output, did not used updated tensorflow.

Nikronic avatar Nov 01 '19 20:11 Nikronic

@Nikronic 1.15 works for me. Make sure you extract the model and point to the directory

markedmiston avatar Nov 01 '19 23:11 markedmiston

I am also facing same issues, but on one machine with GPU MX130 it runs with tensorflow1.15 but only on CPU not on GPU, but with same software environment its not working another machine with GTX 960M.

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 E:[36mGRAPHOPT[0m:fail to optimize the graph! Traceback (most recent call last): File "d:\anaconda3\envs\gpu_test\lib\runpy.py", line 193, in run_module_as_main "main", mod_spec) File "d:\anaconda3\envs\gpu_test\lib\runpy.py", line 85, in run_code exec(code, run_globals) File "D:\Anaconda3\envs\gpu_test\Scripts\bert-serving-start.exe_main.py", line 7, in File "d:\anaconda3\envs\gpu_test\lib\site-packages\bert_serving\server\cli_init.py", line 4, in main with BertServer(get_run_args()) as server: File "d:\anaconda3\envs\gpu_test\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

.................................................... Im meeting same error with cuda 9.0, tf=1.10

loveneet29 avatar Nov 09 '19 11:11 loveneet29

@TheJdxfh @mtedmist

How can I downgrade my TF using anaconda on windows?

drwael avatar Dec 09 '19 21:12 drwael

@TheJdxfh @mtedmist

How can I downgrade my TF using anaconda on windows?

First you should delete the current version: pip uninstall tensorflow Then you can install the specific version you want to. Ex: pip install tensorflow==1.13.1 Then you are good to go

binhna avatar Dec 20 '19 06:12 binhna

I am also facing same issues, but on one machine with GPU MX130 it runs with tensorflow1.15 but only on CPU not on GPU, but with same software environment its not working another machine with GTX 960M.

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 E:�[36mGRAPHOPT�[0m:fail to optimize the graph! Traceback (most recent call last): File "d:\anaconda3\envs\gpu_test\lib\runpy.py", line 193, in run_module_as_main "main", mod_spec) File "d:\anaconda3\envs\gpu_test\lib\runpy.py", line 85, in run_code exec(code, run_globals) File "D:\Anaconda3\envs\gpu_test\Scripts\bert-serving-start.exe__main.py", line 7, in File "d:\anaconda3\envs\gpu_test\lib\site-packages\bert_serving\server\cli__init__.py", line 4, in main with BertServer(get_run_args()) as server: File "d:\anaconda3\envs\gpu_test\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

.................................................... Im meeting same error with cuda 9.0, tf=1.10

Most probably the script cannot find path to your model. Check whether uncased_L-12_H-768_A-12/ exists or try to provide absolute path to the model directory.

burgetrm avatar Feb 17 '20 07:02 burgetrm

You should also uninstall tensorfflow-estimator if its version > 2 pip uninstall tensorflow pip uninstall tensorflow-estimator and then pip install tensorflow=1.13.1

lassouadsouheil avatar May 11 '20 17:05 lassouadsouheil

Just use absolute path

beHappy666 avatar Jul 28 '20 02:07 beHappy666

Just use absolute path

Thanks bro

just-automatic avatar Oct 12 '20 08:10 just-automatic