NeuroNER icon indicating copy to clipboard operation
NeuroNER copied to clipboard

when i train and close the ann:use_character_lstm = False

Open lovychen opened this issue 7 years ago • 0 comments

When I use the model to make a prediction,i also let the use_character_lstm = False,it is have some wrong, Traceback (most recent call last): File "/home/wcg/tools/local/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1327, in _do_call return fn(*args) File "/home/wcg/tools/local/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1306, in _run_fn status, run_metadata) File "/home/wcg/tools/local/anaconda3/lib/python3.6/contextlib.py", line 88, in exit next(self.gen) File "/home/wcg/tools/local/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/errors_impl.py", line 466, in raise_exception_on_not_ok_status pywrap_tensorflow.TF_GetCode(status)) 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)]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "server_debug.py", line 163, in main() 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 main() 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 276, in init model = EntityLSTM(dataset, parameters) File "/home/wcg/wcg_work/ner/NeuroNER/src_predict/entity_lstm.py", line 216, in init self.saver = tf.train.Saver(max_to_keep=parameters['maximum_number_of_epochs']) # defaults to saving all variables File "/home/wcg/tools/local/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1140, in init self.build() File "/home/wcg/tools/local/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1172, in build filename=self._filename) File "/home/wcg/tools/local/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 688, in build restore_sequentially, reshape) File "/home/wcg/tools/local/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 407, in _AddRestoreOps tensors = self.restore_op(filename_tensor, saveable, preferred_shard) File "/home/wcg/tools/local/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 247, in restore_op [spec.tensor.dtype])[0]) File "/home/wcg/tools/local/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/gen_io_ops.py", line 663, in restore_v2 dtypes=dtypes, name=name) File "/home/wcg/tools/local/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 767, in apply_op op_def=op_def) File "/home/wcg/tools/local/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 2630, in create_op original_op=self._default_original_op, op_def=op_def) File "/home/wcg/tools/local/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1204, in init self._traceback = self._graph._extract_stack() # pylint: disable=protected-access

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 0x7fbdeef18390>> 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'

What should I do?

lovychen avatar Dec 13 '17 03:12 lovychen