Closed jxfruit closed 5 years ago
改embedding的个数
你好,我在测试的时候输入文本中包含英文的时候就会出现下面的错误,请问怎么解决呢,非常感谢 tensorflow.python.framework.errors_impl.InvalidArgumentError: indices[0,0] = 4026 is not in [0, 4026) [[{{node bilstm_crf/embedding_lookup}} = GatherV2[Taxis=DT_INT32, Tindices=DT_INT32, Tparams=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"](bilstm_crf/Assign, _arg_input_data/input_data_0_0, bilstm_crf/embedding_lookup/axis)]] During handling of the above exception, another exception occurred: Traceback (most recent call last): Caused by op 'bilstm_crf/embedding_lookup', defined at: File "/ddhome/usr/PythonProjects/NLP/ChineseNER/tf_version/train.py", line 94, in model = Model(config, embedding_pre, dropout_keep=1) File "/ddhome/usr/PythonProjects/NLP/ChineseNER/tf_version/bilstm_crf.py", line 32, in init self._build_net() File "/ddhome/usr/PythonProjects/NLP/ChineseNER/tf_version/bilstm_crf.py", line 40, in _build_net input_embedded = tf.nn.embedding_lookup(word_embeddings, self.input_data) File "/usr/local/lib/python3.6/site-packages/tensorflow/python/ops/embedding_ops.py", line 313, in embedding_lookup transform_fn=None) File "/usr/local/lib/python3.6/site-packages/tensorflow/python/ops/embedding_ops.py", line 133, in _embedding_lookup_and_transform result = _clip(array_ops.gather(params[0], ids, name=name), File "/usr/local/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py", line 2675, in gather return gen_array_ops.gather_v2(params, indices, axis, name=name) File "/usr/local/lib/python3.6/site-packages/tensorflow/python/ops/gen_array_ops.py", line 3332, in gather_v2 "GatherV2", params=params, indices=indices, axis=axis, name=name) File "/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper op_def=op_def) File "/usr/local/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 488, in new_func return func(*args, kwargs) File "/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3274, in create_op op_def=op_def) File "/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1770, in init** self._traceback = tf_stack.extract_stack()
InvalidArgumentError (see above for traceback): indices[0,0] = 4026 is not in [0, 4026) [[node bilstm_crf/embedding_lookup (defined at /ddhome/usr/PythonProjects/NLP/ChineseNER/tf_version/bilstm_crf.py:40) = GatherV2[Taxis=DT_INT32, Tindices=DT_INT32, Tparams=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"](bilstm_crf/Assign, _arg_input_data/input_data_0_0, bilstm_crf/embedding_lookup/axis)]]
改embedding的个数,而且你这个py3.6我不确定能不能跑通
谢谢大佬,我稍微改了下,在python3.6环境下是完全没有问题的,问题已经解决
谢谢大佬,我稍微改了下,在python3.6环境下是完全没有问题的,问题已经解决
你好,我也出现了相同的问题,请问你的embedding的个数改到了多少呢?
你好,我在测试的时候输入文本中包含英文的时候就会出现下面的错误,请问怎么解决呢,非常感谢 tensorflow.python.framework.errors_impl.InvalidArgumentError: indices[0,0] = 4026 is not in [0, 4026) [[{{node bilstm_crf/embedding_lookup}} = GatherV2[Taxis=DT_INT32, Tindices=DT_INT32, Tparams=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"](bilstm_crf/Assign, _arg_input_data/input_data_0_0, bilstm_crf/embedding_lookup/axis)]] During handling of the above exception, another exception occurred: Traceback (most recent call last): Caused by op 'bilstm_crf/embedding_lookup', defined at: File "/ddhome/usr/PythonProjects/NLP/ChineseNER/tf_version/train.py", line 94, in
model = Model(config, embedding_pre, dropout_keep=1)
File "/ddhome/usr/PythonProjects/NLP/ChineseNER/tf_version/bilstm_crf.py", line 32, in init
self._build_net()
File "/ddhome/usr/PythonProjects/NLP/ChineseNER/tf_version/bilstm_crf.py", line 40, in _build_net
input_embedded = tf.nn.embedding_lookup(word_embeddings, self.input_data)
File "/usr/local/lib/python3.6/site-packages/tensorflow/python/ops/embedding_ops.py", line 313, in embedding_lookup
transform_fn=None)
File "/usr/local/lib/python3.6/site-packages/tensorflow/python/ops/embedding_ops.py", line 133, in _embedding_lookup_and_transform
result = _clip(array_ops.gather(params[0], ids, name=name),
File "/usr/local/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py", line 2675, in gather
return gen_array_ops.gather_v2(params, indices, axis, name=name)
File "/usr/local/lib/python3.6/site-packages/tensorflow/python/ops/gen_array_ops.py", line 3332, in gather_v2
"GatherV2", params=params, indices=indices, axis=axis, name=name)
File "/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/usr/local/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 488, in new_func
return func(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3274, in create_op
op_def=op_def)
File "/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1770, in init
self._traceback = tf_stack.extract_stack()
InvalidArgumentError (see above for traceback): indices[0,0] = 4026 is not in [0, 4026) [[node bilstm_crf/embedding_lookup (defined at /ddhome/usr/PythonProjects/NLP/ChineseNER/tf_version/bilstm_crf.py:40) = GatherV2[Taxis=DT_INT32, Tindices=DT_INT32, Tparams=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"](bilstm_crf/Assign, _arg_input_data/input_data_0_0, bilstm_crf/embedding_lookup/axis)]]