Vincent131499 / TextClassifier_Transformer

个人基于谷歌开源的BERT编写的文本分类器(基于微调方式),可自由加载NLP领域知名的预训练语言模型BERT、Bert-wwm、Roberta、ALBert以及ERNIE1.0
161 stars 46 forks source link

export.sh出错 #1

Closed lu161513 closed 5 years ago

lu161513 commented 5 years ago

Traceback (most recent call last): File "run_classifier_serving.py", line 1087, in tf.app.run() File "/data/aif/common/anaconda/envs/py3nlp_todd/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 40, in run _run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef) File "/data/aif/common/anaconda/envs/py3nlp_todd/lib/python3.6/site-packages/absl/app.py", line 300, in run _run_main(main, args) File "/data/aif/common/anaconda/envs/py3nlp_todd/lib/python3.6/site-packages/absl/app.py", line 251, in _run_main sys.exit(main(argv)) File "run_classifier_serving.py", line 1077, in main estimator.export_saved_model(FLAGS.export_dir, serving_input_fn) File "/data/aif/common/anaconda/envs/py3nlp_todd/lib/python3.6/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 732, in export_saved_model strip_default_attrs=True) File "/data/aif/common/anaconda/envs/py3nlp_todd/lib/python3.6/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 829, in _export_all_saved_models export_dir = export_lib.get_timestamped_export_dir(export_dir_base) File "/data/aif/common/anaconda/envs/py3nlp_todd/lib/python3.6/site-packages/tensorflow/python/saved_model/model_utils/export_utils.py", line 216, in get_timestamped_export_dir compat.as_bytes(export_dir_base), compat.as_bytes(str(timestamp))) File "/data/aif/common/anaconda/envs/py3nlp_todd/lib/python3.6/site-packages/tensorflow/python/util/compat.py", line 65, in as_bytes (bytes_or_text,)) TypeError: Expected binary or unicode string, got None

lu161513 commented 5 years ago

我用的调用参数

python run_classifier_serving.py \ --task_name=setiment \ --do_train=False \ --do_eval=False \ --do_predict=True \ --data_dir=./dat \ --vocab_file=/data/aif/toddlu/bert_model/chinese_roberta_wwm_large_ext_L-24_H-1024_A-16/vocab.txt \ --bert_config_file=/data/aif/toddlu/bert_model/chinese_roberta_wwm_large_ext_L-24_H-1024_A-16/bert_config.json \ --init_checkpoint=/data/aif/toddlu/bert_model/chinese_roberta_wwm_large_ext_L-24_H-1024_A-16/bert_model.ckpt \ --max_seq_length=40 \ --train_batch_size=32 \ --learning_rate=2e-5 \ --num_train_epochs=1.0 \ --output_dir=./output/mobile_0_roberta_base_epoch1 \ --do_export=True export_dir=exported1029

lu161513 commented 5 years ago

少打个-- =.=

Vincent131499 commented 5 years ago

少打个-- =.=

友情提示:这里模型导出时的max_seq_length参数值应与模型训练时的参数值保持一致。