Closed zhaoyukoon closed 3 years ago
tensorflow.python.framework.errors_impl.InvalidArgumentError: 4 root error(s) found. (0) Invalid argument: Incompatible shapes: [1,51,768] vs. [1,52,768] [[node replica_2/sub (defined at ./trainer/lm_runners.py:100) ]] [[Adamax/concat_8/_2086]] (1) Invalid argument: Incompatible shapes: [1,51,768] vs. [1,52,768] [[node replica_2/sub (defined at ./trainer/lm_runners.py:100) ]] [[replica_2/Cast_5/_1460]] (2) Invalid argument: Incompatible shapes: [1,51,768] vs. [1,52,768] [[node replica_2/sub (defined at ./trainer/lm_runners.py:100) ]] [[replica_1/transformer/decoder/sequential_5/dense_42/Tensordot/Prod/_1302]] (3) Invalid argument: Incompatible shapes: [1,51,768] vs. [1,52,768] [[node replica_2/sub (defined at ./trainer/lm_runners.py:100) ]]
对应的是 def bert_feature_loss(self, real, pred):
def bert_feature_loss(self, real, pred):
我现在的方案是 判定 如果 real 和 pred shape 不同,就先跳过
你的文本可能包含了空格或者标点,lm_tokens.txt里没有包含 而bert_vocab.txt里包含了
am_runner 也会遇到这个问题。
我建议添加预处理脚本,否则现在总是跑了很久才报错。
OK,安排
对应的是
def bert_feature_loss(self, real, pred):
我现在的方案是 判定 如果 real 和 pred shape 不同,就先跳过