Open chenbaicheng opened 5 years ago
用的是作者的model文件
我也遇到了这个问题,请问你解决了嘛?
@jawhiow 不知道是不是 pip install 那个包的问题 你是不是也是用pip 安装的 删掉 然后 用 git的源码安装试试 我找了一下其他人的 作者说 pip的包有问题的 ,现在还没有解决 我等新显卡来 ,再试试
你们指定了model地址么,把你们的cmd贴出来啊。
@macanv 作者君 O(∩_∩)O谢谢 那个pd 那个参数不能指定 他会提示 argument无效 所以我删掉了
bert-base-serving-start -bert_model_dir /home/chen/Desktop/chinese_ner/360Downloads/chinese_L-12_H-768_A-12/ -model_dir /home/chen/Desktop/chinese_ner/360Downloads/BERT_NER/ -num_worker 3 -mode NER
@chenbaicheng 这个可以正常运行么?
@macanv 不行呢 它提示 fail to optimize the graph! Can't load save_path when it is None. 发生报错是这句 File "/home/chen/miniconda3/envs/bert_ner/lib/python3.6/site-packages/bert_base-0.0.9-py3.6.egg/bert_base/server/graph.py", line 295, in optimize_ner_model saver.restore(sess, tf.train.latest_checkpoint(args.model_dir)) 不能恢复模型吧 不过那个model_dir 是指哪一个呢 全部参数都给了咯谢谢
@macanv 难道参数哪里还看相对路径的吗 我是用conda安装的 然后模型放在其他地方 然后terminal的目录是根目录 ~/
@macanv 可能是tensorflow的版本问题吗 去看了一下肖大神的 bert as service 提问里面也有关于 graphic 建立失败的 作者现在是用那个版本的tensorflow
1.10和1.12我都试过,其他的没试过,我这边测试没问题,Ubuntu16.04和windows10
恩 O(∩_∩)O谢谢 我再试试 有可能我的显卡有点渣
@macanv 换了一张显卡了 name: Tesla K40c major: 3 minor: 5 memoryClockRate(GHz): 0.745 pciBusID: 0000:03:00.0 totalMemory: 11.17GiB freeMemory: 10.92GiB 不过还是不行 主要是这个 File "/home/lin/miniconda3/envs/chinese_ner/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1713, in restore raise ValueError("Can't load save_path when it is None.") ValueError: Can't load save_path when it is None. 这里的save_path是哪里指定的 作者君有试过ubantu环境吗 我看到都是window的目录 能不能贴一个例子出来 谢谢哦
model_dir: 训练好的NER模型或者文本分类模型的路径,对于上面的output_dir 我没有训练就不能用了吗
I ran this command and it works:
bert-base-serving-start -model_dir pretrain-model/BERT_NER/ -bert_model_dir ../bert-model/chinese_L-12_H-768_A-12/ -model_pb_dir pretrain-model/BERT_NER/ -mode NER"
I install the package through source code rather than using pip, and the model (contents under BERT_NER) was downloaded from authors Baidu drive.
I am using custom compiled TensorFlow 1.12.3 and Ubuntu 16.04.
@chianwei thanks you ,where baidu driver address can you write in here
@chianwei thanks you ,where baidu driver address can you write in here
The URL of the author's pretrain model is shown in the Readme page, under the "As Service" section.
I ran this command and it works:
bert-base-serving-start -model_dir pretrain-model/BERT_NER/ -bert_model_dir ../bert-model/chinese_L-12_H-768_A-12/ -model_pb_dir pretrain-model/BERT_NER/ -mode NER"
I install the package through source code rather than using pip, and the model (contents under BERT_NER) was downloaded from authors Baidu drive. I am using custom compiled TensorFlow 1.12.3 and Ubuntu 16.04.
总结一下,就是pb文件可以指向从百度盘下下来的文件夹,ner模型也指向这个
I:VENTILATOR:[i:i: 91]:lodding ner model, could take a while... 2019-05-26 21:44:51.296903: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA 2019-05-26 21:44:51.298731: I tensorflow/core/common_runtime/process_util.cc:69] Creating new thread pool with default inter op setting: 2. Tune using inter_op_parallelism_threads for best performance. E:NER_MODEL, Lodding...:[gra:opt:306]:fail to optimize the graph! Can't load save_path when it is None. Traceback (most recent call last): File "/home/chen/miniconda3/envs/bert_ner/lib/python3.6/site-packages/bert_base-0.0.9-py3.6.egg/bert_base/server/graph.py", line 295, in optimize_ner_model saver.restore(sess, tf.train.latest_checkpoint(args.model_dir)) File "/home/chen/miniconda3/envs/bert_ner/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1713, in restore raise ValueError("Can't load save_path when it is None.") ValueError: Can't load save_path when it is None. Traceback (most recent call last): File "/home/chen/miniconda3/envs/bert_ner/bin/bert-base-serving-start", line 11, in
load_entry_point('bert-base==0.0.9', 'console_scripts', 'bert-base-serving-start')()
File "/home/chen/miniconda3/envs/bert_ner/lib/python3.6/site-packages/bert_base-0.0.9-py3.6.egg/bert_base/runs/init.py", line 17, in start_server
server = BertServer(args)
File "/home/chen/miniconda3/envs/bert_ner/lib/python3.6/site-packages/bert_base-0.0.9-py3.6.egg/bert_base/server/init.py", line 102, in init
raise FileNotFoundError('graph optimization fails and returns empty result')
FileNotFoundError: graph optimization fails and returns empty result