GaoQ1 / rasa_nlu_gq

turn natural language into structured data(支持中文,自定义了N种模型,支持不同的场景和任务)
Apache License 2.0
304 stars 97 forks source link

使用自定义组件训练好模型后,运行出现如下错误 #28

Open nx04 opened 5 years ago

nx04 commented 5 years ago

Exception in thread Thread-11: Traceback (most recent call last): File "/usr/lib64/python3.6/threading.py", line 916, in _bootstrap_inner self.run() File "/usr/lib64/python3.6/threading.py", line 864, in run self._target(*self._args, self._kwargs) File "/usr/local/lib/python3.6/site-packages/rasa_core/channels/channel.py", line 324, in on_message_wrapper on_new_message(message) File "/usr/local/lib/python3.6/site-packages/rasa_core/agent.py", line 322, in handle_message return processor.handle_message(message) File "/usr/local/lib/python3.6/site-packages/rasa_core/processor.py", line 73, in handle_message tracker = self.log_message(message) File "/usr/local/lib/python3.6/site-packages/rasa_core/processor.py", line 119, in log_message self._handle_message_with_tracker(message, tracker) File "/usr/local/lib/python3.6/site-packages/rasa_core/processor.py", line 260, in _handle_message_with_tracker parse_data = self._parse_message(message) File "/usr/local/lib/python3.6/site-packages/rasa_core/processor.py", line 245, in _parse_message parse_data = self.interpreter.parse(message.text) File "/usr/local/lib/python3.6/site-packages/rasa_core/interpreter.py", line 245, in parse result = self.interpreter.parse(text) File "/usr/local/lib/python3.6/site-packages/rasa_nlu/model.py", line 370, in parse component.process(message, self.context) File "/home/rasa_nlu_core_use/custom_components/extractors/entity_extractor.py", line 138, in process extracted = self.add_extractor_name(self.extract_entities(message)) File "/home/rasa_nlu_core_use/custom_components/extractors/entity_extractor.py", line 146, in extract_entities entities, result = self.model.predict_entities([list(message.text)], join_chunk=''), [] File "/home/rasa_nlu_core_use/core/tasks/labeling/base_model.py", line 55, in predict_entities res = self.predict(x_data, batch_size, debug_info, predict_kwargs) File "/home/rasa_nlu_core_use/core/tasks/base_model.py", line 419, in predict pred = self.tf_model.predict(tensor, batch_size=batch_size, predict_kwargs) File "/usr/local/lib/python3.6/site-packages/tensorflow/python/keras/engine/training.py", line 1078, in predict callbacks=callbacks) File "/usr/local/lib/python3.6/site-packages/tensorflow/python/keras/engine/training_arrays.py", line 157, in model_iteration f = _make_execution_function(model, mode) File "/usr/local/lib/python3.6/site-packages/tensorflow/python/keras/engine/training_arrays.py", line 532, in _make_execution_function return model._make_execution_function(mode) File "/usr/local/lib/python3.6/site-packages/tensorflow/python/keras/engine/training.py", line 2282, in _make_execution_function self._make_predict_function() File "/usr/local/lib/python3.6/site-packages/tensorflow/python/keras/engine/training.py", line 2272, in _make_predict_function kwargs) File "/usr/local/lib/python3.6/site-packages/tensorflow/python/keras/backend.py", line 3479, in function return GraphExecutionFunction(inputs, outputs, updates=updates, **kwargs) File "/usr/local/lib/python3.6/site-packages/tensorflow/python/keras/backend.py", line 3142, in init with ops.control_dependencies([self.outputs[0]]): File "/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 5426, in control_dependencies return get_default_graph().control_dependencies(control_inputs) File "/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 4867, in control_dependencies c = self.as_graph_element(c) File "/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3796, in as_graph_element return self._as_graph_element_locked(obj, allow_tensor, allow_operation) File "/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3875, in _as_graph_element_locked raise ValueError("Tensor %s is not an element of this graph." % obj) ValueError: Tensor Tensor("layer_crf/cond/Merge:0", shape=(?, 128, 6), dtype=float32) is not an element of this graph.

GaoQ1 commented 4 years ago

这个貌似是keras版本的问题,改成keras==2.2.4试试呢