JoeZhouWenxuan / Self-regulation-Employing-a-Generative-Adversarial-Network-to-Improve-Event-Detection

event detection
23 stars 8 forks source link

ERROR Caused by op 'feature_embedding' #4

Open ZhenHuaZhou68 opened 4 years ago

ZhenHuaZhou68 commented 4 years ago

File "train.py", line 77, in main() File "train.py", line 58, in main model = Model(config) File "/home/zhou/文档/Self-regulation-Employing-a-Generative-Adversarial-Network-to-Improve-Event-Detection-master/model.py", line 42, in init self.build() File "/home/zhou/文档/Self-regulation-Employing-a-Generative-Adversarial-Network-to-Improve-Event-Detection-master/model.py", line 78, in build name='feature_embedding' File "/home/zhou/.local/lib/python3.6/site-packages/tensorflow/python/ops/embedding_ops.py", line 122, in embedding_lookup return maybe_normalize(_do_gather(params[0], ids, name=name)) File "/home/zhou/.local/lib/python3.6/site-packages/tensorflow/python/ops/embedding_ops.py", line 42, in _do_gather return array_ops.gather(params, ids, name=name) File "/home/zhou/.local/lib/python3.6/site-packages/tensorflow/python/ops/gen_array_ops.py", line 1179, in gather validate_indices=validate_indices, name=name) File "/home/zhou/.local/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 767, in apply_op op_def=op_def) File "/home/zhou/.local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 2506, in create_op original_op=self._default_original_op, op_def=op_def) File "/home/zhou/.local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1269, in init self._traceback = _extract_stack()

InvalidArgumentError (see above for traceback): indices[0,0] = 531 is not in [0, 26) [[Node: feature_embedding = Gather[Tindices=DT_INT32, Tparams=DT_FLOAT, _class=["loc:@feature_W"], validate_indices=true, _device="/job:localhost/replica:0/task:0/cpu:0"](feature_W/read, _arg_input_0_1)]]

lhjner commented 4 years ago

@787205128 I also encountered this problem, have you solved it?

ZhenHuaZhou68 commented 4 years ago

@787205128 I also encountered this problem, have you solved it?

The author gave a reason in README-NOTE:One may provide a file which contains the word embeddings pretrained by her/himself. In such a case, the file name should be the same with that we mentioned above.If not, you'd better comment out the 57th line in train.py,and meanwhile modify the 58th line as config['feature_init_weight'] = None.

ZhenHuaZhou68 commented 4 years ago

@787205128 I also encountered this problem, have you solved it? And , how did you process ACE-2005, An event trigger may correspond to multiple words in a metion,this caused the length of tks != tgs,this will cause errors later, Do you have any solution?

lhjner commented 4 years ago

@787205128 I also encountered this problem, have you solved it? And , how did you process ACE-2005, An event trigger may correspond to multiple words in a metion,this caused the length of tks != tgs,this will cause errors later, Do you have any solution? 我是这样处理的,但是不知道结果怎么样。使用预训练词向量一直报错,所以按您前面所说的改后是没有问题的。 I mean , it ' s conceivable that the other six have all gotten together in Marinello ' s absence and drafted her , but it also seems pretty clear that she has agreed to do it , and , if all the rumors are true and she steps down , it will be so that she can take on these new responsibilities . O O O O O O O O O O O O O O O O O O O O O start-position O O O O O O O O O O O O O O O O O O O O O O O O O O end-position end-position O O O O O O O O O O O O O O

lhjner commented 4 years ago

@787205128 Excuse me, did you run this code, I encountered many problems in the subsequent process, and now the test result is always 0. /home/lhj/anaconda3/envs/segan/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:458: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint8 = np.dtype([("qint8", np.int8, 1)]) /home/lhj/anaconda3/envs/segan/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:459: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_quint8 = np.dtype([("quint8", np.uint8, 1)]) /home/lhj/anaconda3/envs/segan/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:460: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint16 = np.dtype([("qint16", np.int16, 1)]) /home/lhj/anaconda3/envs/segan/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:461: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_quint16 = np.dtype([("quint16", np.uint16, 1)]) /home/lhj/anaconda3/envs/segan/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:462: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint32 = np.dtype([("qint32", np.int32, 1)]) /home/lhj/anaconda3/envs/segan/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:465: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. np_resource = np.dtype([("resource", np.ubyte, 1)])

Parameters: BATCH_SIZE = 10 CLASSES = 34 DROPOUT_RATE = 0 FEATURE_WEIGHT_DROPOUT = 0.2 FEATURE_WEIGHT_SHAPE = [19490, 300] HIDDEN_SIZE = 150 L2_RATE = 0.0 LEARNING_RATE = 0.3 LR_DECAY = 0.95 MODEL_PATH = model/best.pkl NUM_EPOCHS = 10 NUM_LAYERS = 1 RNN_UNIT = lstm SEQUENCE_LENGTH = 80 TRAIN_MAX_PATIENCE = 100

/home/lhj/anaconda3/envs/segan/lib/python3.6/site-packages/tensorflow/python/ops/gradients_impl.py:93: UserWarning: Converting sparse IndexedSlices to a dense Tensor of unknown shape. This may consume a large amount of memory. "Converting sparse IndexedSlices to a dense Tensor of unknown shape. " 2019-12-23 21:17:08.743333: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations. 2019-12-23 21:17:08.743381: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations. 2019-12-23 21:17:08.743391: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations. 2019-12-23 21:17:08.743403: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations. 2019-12-23 21:17:08.743416: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations. /home/lhj/anaconda3/envs/segan/lib/python3.6/site-packages/sklearn/metrics/classification.py:1437: UndefinedMetricWarning: Precision and F-score are ill-defined and being set to 0.0 due to no predicted samples. 'precision', 'predicted', average, warn_for) /home/lhj/anaconda3/envs/segan/lib/python3.6/site-packages/sklearn/metrics/classification.py:1439: UndefinedMetricWarning: Recall and F-score are ill-defined and being set to 0.0 due to no true samples. 'recall', 'true', average, warn_for) /home/lhj/anaconda3/envs/segan/lib/python3.6/site-packages/sklearn/metrics/classification.py:1437: UndefinedMetricWarning: Precision is ill-defined and being set to 0.0 due to no predicted samples. 'precision', 'predicted', average, warn_for) /home/lhj/anaconda3/envs/segan/lib/python3.6/site-packages/sklearn/metrics/classification.py:1439: UndefinedMetricWarning: Recall is ill-defined and being set to 0.0 due to no true samples. 'recall', 'true', average, warn_for) /home/lhj/anaconda3/envs/segan/lib/python3.6/site-packages/sklearn/metrics/classification.py:1437: UndefinedMetricWarning: F-score is ill-defined and being set to 0.0 due to no predicted samples. 'precision', 'predicted', average, warn_for) /home/lhj/anaconda3/envs/segan/lib/python3.6/site-packages/sklearn/metrics/classification.py:1439: UndefinedMetricWarning: F-score is ill-defined and being set to 0.0 due to no true samples. 'recall', 'true', average, warn_for) multi-classification precision 0, recall 0, f1 0 binary-classification precision 0, recall 0, f1 0

amirveyseh commented 4 years ago

I have the same environment (Tensorflow 1.2 and python 3.6) but when I run 'python train.py' I have this error:

Parameters: BATCH_SIZE = 10 CLASSES = 34 DROPOUT_RATE = 0 FEATURE_WEIGHT_DROPOUT = 0.2 FEATURE_WEIGHT_SHAPE = [19490, 300] HIDDEN_SIZE = 150 L2_RATE = 0.0 LEARNING_RATE = 0.3 LR_DECAY = 0.95 MODEL_PATH = model/best.pkl NUM_EPOCHS = 200 NUM_LAYERS = 1 RNN_UNIT = lstm SEQUENCE_LENGTH = 80 TRAIN_MAX_PATIENCE = 100

Traceback (most recent call last): File "train.py", line 70, in main() File "train.py", line 55, in main model = Model(config) File "/disk/apouranb/cybersequrity/cybersecurityEvent/mycode/self/self/model.py", line 42, in init self.build() File "/disk/apouranb/cybersequrity/cybersecurityEvent/mycode/self/self/model.py", line 204, in build self.train_op_g = optimizer_g.minimize(self.g_loss + 0.1 * self.diff_loss, var_list=vars_g) File "/home/users/apouranb/miniconda2/envs/myenv3/lib/python3.6/site-packages/tensorflow/python/training/optimizer.py", line 315, in minimize grad_loss=grad_loss) File "/home/users/apouranb/miniconda2/envs/myenv3/lib/python3.6/site-packages/tensorflow/python/training/optimizer.py", line 380, in compute_gradients raise ValueError("No variables to optimize.") ValueError: No variables to optimize.