Z-yq / TensorflowASR

一个执着于让CPU\端侧-Model逼近GPU-Model性能的项目,CPU上的实时率(RTF)小于0.1
Apache License 2.0
461 stars 111 forks source link

Incompatible shapes in lm_runner #23

Closed zhaoyukoon closed 3 years ago

zhaoyukoon commented 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):

我现在的方案是 判定 如果 real 和 pred shape 不同,就先跳过

Z-yq commented 3 years ago

你的文本可能包含了空格或者标点,lm_tokens.txt里没有包含 而bert_vocab.txt里包含了

zhaoyukoon commented 3 years ago

am_runner 也会遇到这个问题。

我建议添加预处理脚本,否则现在总是跑了很久才报错。

Z-yq commented 3 years ago

OK,安排