You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
报错如下:
2021-07-20 20:21:22.706441: W tensorflow/core/common_runtime/base_collective_executor.cc:217] BaseCollectiveExecutor::StartAbort Invalid argument: Incompatible shapes: [1,512,128] vs. [2,513,128]
[[{{node Embedding-Position/add}}]]
Traceback (most recent call last):
File "/Users/yanghp/PycharmProjects/Data_Augmentation/classification.py", line 45, in
aug_data = units.simbert_augment(train_data,create_num=3b)
File "/Users/yanghp/PycharmProjects/Data_Augmentation/units.py", line 32, in simbert_augment
aug_sentences = simbert.replace(sent=line[0], create_num=create_num)
File "/Users/yanghp/opt/anaconda3/envs/py36/lib/python3.6/site-packages/nlpcda/tools/Simbert.py", line 28, in replace
synonyms = self.model.gen_synonyms(text=sent, n=n, k=create_num)
File "/Users/yanghp/opt/anaconda3/envs/py36/lib/python3.6/site-packages/nlpcda/tools/simbert/generator.py", line 64, in gen_synonyms
r = self.generate(text, n)
File "/Users/yanghp/opt/anaconda3/envs/py36/lib/python3.6/site-packages/nlpcda/tools/simbert/generator.py", line 57, in generate
output_ids = self.random_sample([token_ids, segment_ids], n, topk)
File "/Users/yanghp/opt/anaconda3/envs/py36/lib/python3.6/site-packages/bert4keras/snippets.py", line 454, in random_sample
probas = self.predict(inputs, output_ids, step, 'probas') # 计算当前概率
File "/Users/yanghp/opt/anaconda3/envs/py36/lib/python3.6/site-packages/bert4keras/snippets.py", line 386, in new_predict
result = predict(self, inputs, output_ids, step)
File "/Users/yanghp/opt/anaconda3/envs/py36/lib/python3.6/site-packages/nlpcda/tools/simbert/generator.py", line 52, in predict
return self.seq2seq.predict([token_ids, segment_ids])[:, -1]
File "/Users/yanghp/opt/anaconda3/envs/py36/lib/python3.6/site-packages/keras/engine/training.py", line 1462, in predict
callbacks=callbacks)
File "/Users/yanghp/opt/anaconda3/envs/py36/lib/python3.6/site-packages/keras/engine/training_arrays.py", line 324, in predict_loop
batch_outs = f(ins_batch)
File "/Users/yanghp/opt/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow_core/python/keras/backend.py", line 3727, in call
outputs = self._graph_fn(*converted_inputs)
File "/Users/yanghp/opt/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow_core/python/eager/function.py", line 1551, in call
return self._call_impl(args, kwargs)
File "/Users/yanghp/opt/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow_core/python/eager/function.py", line 1591, in _call_impl
return self._call_flat(args, self.captured_inputs, cancellation_manager)
File "/Users/yanghp/opt/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow_core/python/eager/function.py", line 1692, in _call_flat
ctx, args, cancellation_manager=cancellation_manager))
File "/Users/yanghp/opt/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow_core/python/eager/function.py", line 545, in call
ctx=ctx)
File "/Users/yanghp/opt/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow_core/python/eager/execute.py", line 67, in quick_execute
six.raise_from(core._status_to_exception(e.code, message), None)
File "", line 3, in raise_from
tensorflow.python.framework.errors_impl.InvalidArgumentError: Incompatible shapes: [1,512,128] vs. [2,513,128]
[[node Embedding-Position/add (defined at /opt/anaconda3/envs/py36/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py:3009) ]] [Op:__inference_keras_scratch_graph_4612]
Function call stack:
keras_scratch_graph
更改较小的create_num会减小报错的概率,但还是会出现。请问怎么解决?
The text was updated successfully, but these errors were encountered:
报错如下:
2021-07-20 20:21:22.706441: W tensorflow/core/common_runtime/base_collective_executor.cc:217] BaseCollectiveExecutor::StartAbort Invalid argument: Incompatible shapes: [1,512,128] vs. [2,513,128]
[[{{node Embedding-Position/add}}]]
Traceback (most recent call last):
File "/Users/yanghp/PycharmProjects/Data_Augmentation/classification.py", line 45, in
aug_data = units.simbert_augment(train_data,create_num=3b)
File "/Users/yanghp/PycharmProjects/Data_Augmentation/units.py", line 32, in simbert_augment
aug_sentences = simbert.replace(sent=line[0], create_num=create_num)
File "/Users/yanghp/opt/anaconda3/envs/py36/lib/python3.6/site-packages/nlpcda/tools/Simbert.py", line 28, in replace
synonyms = self.model.gen_synonyms(text=sent, n=n, k=create_num)
File "/Users/yanghp/opt/anaconda3/envs/py36/lib/python3.6/site-packages/nlpcda/tools/simbert/generator.py", line 64, in gen_synonyms
r = self.generate(text, n)
File "/Users/yanghp/opt/anaconda3/envs/py36/lib/python3.6/site-packages/nlpcda/tools/simbert/generator.py", line 57, in generate
output_ids = self.random_sample([token_ids, segment_ids], n, topk)
File "/Users/yanghp/opt/anaconda3/envs/py36/lib/python3.6/site-packages/bert4keras/snippets.py", line 454, in random_sample
probas = self.predict(inputs, output_ids, step, 'probas') # 计算当前概率
File "/Users/yanghp/opt/anaconda3/envs/py36/lib/python3.6/site-packages/bert4keras/snippets.py", line 386, in new_predict
result = predict(self, inputs, output_ids, step)
File "/Users/yanghp/opt/anaconda3/envs/py36/lib/python3.6/site-packages/nlpcda/tools/simbert/generator.py", line 52, in predict
return self.seq2seq.predict([token_ids, segment_ids])[:, -1]
File "/Users/yanghp/opt/anaconda3/envs/py36/lib/python3.6/site-packages/keras/engine/training.py", line 1462, in predict
callbacks=callbacks)
File "/Users/yanghp/opt/anaconda3/envs/py36/lib/python3.6/site-packages/keras/engine/training_arrays.py", line 324, in predict_loop
batch_outs = f(ins_batch)
File "/Users/yanghp/opt/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow_core/python/keras/backend.py", line 3727, in call
outputs = self._graph_fn(*converted_inputs)
File "/Users/yanghp/opt/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow_core/python/eager/function.py", line 1551, in call
return self._call_impl(args, kwargs)
File "/Users/yanghp/opt/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow_core/python/eager/function.py", line 1591, in _call_impl
return self._call_flat(args, self.captured_inputs, cancellation_manager)
File "/Users/yanghp/opt/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow_core/python/eager/function.py", line 1692, in _call_flat
ctx, args, cancellation_manager=cancellation_manager))
File "/Users/yanghp/opt/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow_core/python/eager/function.py", line 545, in call
ctx=ctx)
File "/Users/yanghp/opt/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow_core/python/eager/execute.py", line 67, in quick_execute
six.raise_from(core._status_to_exception(e.code, message), None)
File "", line 3, in raise_from
tensorflow.python.framework.errors_impl.InvalidArgumentError: Incompatible shapes: [1,512,128] vs. [2,513,128]
[[node Embedding-Position/add (defined at /opt/anaconda3/envs/py36/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py:3009) ]] [Op:__inference_keras_scratch_graph_4612]
Function call stack:
keras_scratch_graph
更改较小的create_num会减小报错的概率,但还是会出现。请问怎么解决?
The text was updated successfully, but these errors were encountered: