Bert-as-service: TypeError: 'NoneType' object is not iterable

Created on 18 Mar 2020  路  3Comments  路  Source: hanxiao/bert-as-service

env
win10
python3.6
bert-serving-client/server 1.9.9
tensorflow 1.13.1
and i got this:

usage: C:Usersnon-admin.condaenvstextsummScriptsbert-serving-start -model_dir cased_L-12_H-768_A-12/ -num_worker=1
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 = cased_L-12_H-768_A-12/
no_position_embeddings = False
no_special_token = False
num_worker = 1
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:freeze, optimize and export graph, could take a while...
I:GRAPHOPT:model config: cased_L-12_H-768_A-12/bert_config.json
I:GRAPHOPT:checkpoint: cased_L-12_H-768_A-12/bert_model.ckpt
E:GRAPHOPT:fail to optimize the graph!
Traceback (most recent call last):
File "c:usersnon-admin.condaenvstextsummlibrunpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:usersnon-admin.condaenvstextsummlibrunpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:Usersnon-admin.condaenvstextsummScriptsbert-serving-start.exe__main__.py", line 9, in
File "c:usersnon-admin.condaenvstextsummlibsite-packagesbert_servingservercli__init__.py", line 4, in main
with BertServer(get_run_args()) as server:
File "c:usersnon-admin.condaenvstextsummlibsite-packagesbert_servingserver__init__.py", line 71, in __init__
self.graph_path, self.bert_config = pool.apply(optimize_graph, (self.args,))
TypeError: 'NoneType' object is not iterable

Most helpful comment

The problem is with TF 2.0. I tested and it work fine on tf 1.15 but not on tf 2.0

All 3 comments

model_dir must be the absolute path.

if your model's name is bert-base-german-cased
rename like this
bert-base-german-cased.index
bert-base-german-cased.meta
bert-base-german-cased.data-00000-of-00001
bert_config.json
vocab.txt

The problem is with TF 2.0. I tested and it work fine on tf 1.15 but not on tf 2.0

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kapilkd13 picture kapilkd13  路  4Comments

zhant09 picture zhant09  路  3Comments

loretoparisi picture loretoparisi  路  6Comments

astariul picture astariul  路  7Comments

un-lock-me picture un-lock-me  路  3Comments