Open lovychen opened 6 years ago
Set use_character_lstm
in src/parameters.ini
to false.
When i set use_character_lstm in src/parameters.ini to false. After i train a model,when i use the model to do some prediction,it has some wrong,i just set use_pretrained_model in src/parameters.ini to True.
File "server_debug.py", line 131, in main
handler.init(argv[1:])
File "server_debug.py", line 111, in init
self.nn = NeuroNER(arguments)
File "/home/wcg/wcg_work/ner/NeuroNER/src_predict/neuroner.py", line 284, in init
self.transition_params_trained = model.restore_from_pretrained_model(parameters, dataset, sess, token_to_vector=token_to_vector)
File "/home/wcg/wcg_work/ner/NeuroNER/src_predict/entity_lstm.py", line 329, in restore_from_pretrained_model
self.saver.restore(sess, pretrained_model_checkpoint_filepath) # Works only when the dimensions of tensor variables are matched.
File "/home/wcg/tools/local/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1560, in restore
{self.saver_def.filename_tensor_name: save_path})
File "/home/wcg/tools/local/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 895, in run
run_metadata_ptr)
File "/home/wcg/tools/local/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1124, in _run
feed_dict_tensor, options, run_metadata)
File "/home/wcg/tools/local/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1321, in _do_run
options, run_metadata)
File "/home/wcg/tools/local/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1340, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.NotFoundError: Key character_lstm/bidirectional_LSTM/bidirectional_rnn/bw/coupled_input_forget_gate_lstm_cell/W_0 not found in checkpoint
[[Node: save/RestoreV2_4 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/cpu:0"](_arg_save/Const_0_0, save/RestoreV2_4/tensor_names, save/RestoreV2_4/shape_and_slices)]]
Caused by op 'save/RestoreV2_4', defined at:
File "server_debug.py", line 163, in
NotFoundError (see above for traceback): Key character_lstm/bidirectional_LSTM/bidirectional_rnn/bw/coupled_input_forget_gate_lstm_cell/W_0 not found in checkpoint [[Node: save/RestoreV2_4 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/cpu:0"](_arg_save/Const_0_0, save/RestoreV2_4/tensor_names, save/RestoreV2_4/shape_and_slices)]]
Exception ignored in: <bound method NeuroNER.del of <neuroner.NeuroNER object at 0x7f35981d7400>> Traceback (most recent call last): File "/home/wcg/wcg_work/ner/NeuroNER/src_predict/neuroner.py", line 524, in del self.sess.close() AttributeError: 'NeuroNER' object has no attribute 'sess'
I've solved this problem, parameter.ini is in the wrong place
Great! Please close issues that have been resolved, thanks:)
Hi, @lovychen. I also have a problem when I load a saved model which I have trained ,and I trained my model without char. Have you ever had the same problem before? Could you tell me your email address? I would like to ask you a few questions about training model , if you don't mind.
hello : if i want to train this model without char,what should i do? I want to make a comparison between the model with a char and the model with no char.