alibaba/EasyTransfer

export to pb models occured an error:"TypeError: __int__ returned non-int (type NoneType)"

zhangyunGit opened this issue · 1 comments

when i export my text match model hcnn checkpoints use:
easy_transfer_app --mode=export --checkpointPath=./hcnn_match_models/model.ckpt-290901 --exportType=app_model --exportDirBase=./pb_models

it occured an error say:
INFO:tensorflow:<easytransfer.app_zoo.text_match.HCNNTextMatch object at 0x7f45410a8fd0>
INFO:tensorflow:Calling model_fn.
Traceback (most recent call last):
File "/usr/local/anaconda3/envs/tf1.12.3/bin/easy_transfer_app", line 33, in
sys.exit(load_entry_point('easytransfer==0.1.4', 'console_scripts', 'easy_transfer_app')())
File "/usr/local/anaconda3/envs/tf1.12.3/lib/python3.6/site-packages/easytransfer-0.1.4-py3.6.egg/easytransfer/app_zoo_cli.py", line 99, in main
File "/usr/local/anaconda3/envs/tf1.12.3/lib/python3.6/site-packages/easytransfer-0.1.4-py3.6.egg/easytransfer/app_zoo/app_utils.py", line 168, in wrapper
File "/usr/local/anaconda3/envs/tf1.12.3/lib/python3.6/site-packages/easytransfer-0.1.4-py3.6.egg/easytransfer/app_zoo/base.py", line 44, in run
File "/usr/local/anaconda3/envs/tf1.12.3/lib/python3.6/site-packages/easytransfer-0.1.4-py3.6.egg/easytransfer/app_zoo/base.py", line 164, in export
File "/usr/local/anaconda3/envs/tf1.12.3/lib/python3.6/site-packages/easytransfer-0.1.4-py3.6.egg/easytransfer/engines/model.py", line 658, in export_model
File "/usr/local/anaconda3/envs/tf1.12.3/lib/python3.6/site-packages/tensorflow/python/estimator/estimator.py", line 663, in export_savedmodel
mode=model_fn_lib.ModeKeys.PREDICT)
File "/usr/local/anaconda3/envs/tf1.12.3/lib/python3.6/site-packages/tensorflow/python/estimator/estimator.py", line 789, in _export_saved_model_for_mode
strip_default_attrs=strip_default_attrs)
File "/usr/local/anaconda3/envs/tf1.12.3/lib/python3.6/site-packages/tensorflow/python/estimator/estimator.py", line 907, in _export_all_saved_models
mode=model_fn_lib.ModeKeys.PREDICT)
File "/usr/local/anaconda3/envs/tf1.12.3/lib/python3.6/site-packages/tensorflow/python/estimator/estimator.py", line 984, in _add_meta_graph_for_mode
config=self.config)
File "/usr/local/anaconda3/envs/tf1.12.3/lib/python3.6/site-packages/tensorflow/python/estimator/estimator.py", line 1195, in _call_model_fn
model_fn_results = self._model_fn(features=features, **kwargs)
File "/usr/local/anaconda3/envs/tf1.12.3/lib/python3.6/site-packages/easytransfer-0.1.4-py3.6.egg/easytransfer/engines/model.py", line 574, in model_fn
File "/usr/local/anaconda3/envs/tf1.12.3/lib/python3.6/site-packages/easytransfer-0.1.4-py3.6.egg/easytransfer/app_zoo/text_match.py", line 618, in build_logits
File "/usr/local/anaconda3/envs/tf1.12.3/lib/python3.6/site-packages/tensorflow/python/layers/base.py", line 374, in call
outputs = super(Layer, self).call(inputs, *args, **kwargs)
File "/usr/local/anaconda3/envs/tf1.12.3/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py", line 757, in call
outputs = self.call(inputs, *args, **kwargs)
File "/usr/local/anaconda3/envs/tf1.12.3/lib/python3.6/site-packages/easytransfer-0.1.4-py3.6.egg/easytransfer/layers/cnn.py", line 204, in call
TypeError: int returned non-int (type NoneType)

it also happens at the last epoch when save model

my env is : tensorflow 1.15.0

如果使用自己手动加载ckpt文件,然后转成pb模型的方式,可以成功转成pb。但是这个pb部署在tfserving后,启动会报错.
除了hcnn,damplus也有同样的问题。
tfserving报错如下:
image