keithito / tacotron

A TensorFlow implementation of Google's Tacotron speech synthesis with pre-trained model (unofficial)
MIT License
2.96k stars 957 forks source link

InvalidArgumentError (see above for traceback): Incompatible shapes: [4,7110,80] vs. [4,2000,80] #189

Closed yuuSiVo closed 6 years ago

yuuSiVo commented 6 years ago

Hi there! I got error

Exiting due to exception: Incompatible shapes: [4,7110,80] vs. [4,2000,80] [[Node: model/optimizer/gradients/model/loss/sub_grad/BroadcastGradientArgs = BroadcastGradientArgs[T=DT_INT32, _device="/job:localhost/replica:0/task:0/device:CPU:0"](model/optimizer/gradients/model/loss/sub_grad/Shape, model/optimizer/gradients/model/loss/sub_grad/Shape_1)]]

Caused by op 'model/optimizer/gradients/model/loss/sub_grad/BroadcastGradientArgs', defined at: File "train.py", line 152, in main() File "train.py", line 148, in main train(log_dir, args) File "train.py", line 65, in train model.add_optimizer(global_step) File "/mnt/c/Users/k017c1149/tacotron-master/models/tacotron.py", line 136, in add_optimizer gradients, variables = zip(optimizer.compute_gradients(self.loss)) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/training/optimizer.py", line 511, in compute_gradients colocate_gradients_with_ops=colocate_gradients_with_ops) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/ops/gradients_impl.py", line 532, in gradients gate_gradients, aggregation_method, stop_gradients) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/ops/gradients_impl.py", line 701, in _GradientsHelper lambda: grad_fn(op, out_grads)) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/ops/gradients_impl.py", line 396, in _MaybeCompile return grad_fn() # Exit early File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/ops/gradients_impl.py", line 701, in lambda: grad_fn(op, *out_grads)) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/ops/math_grad.py", line 859, in _SubGrad rx, ry = gen_array_ops.broadcast_gradient_args(sx, sy) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/ops/gen_array_ops.py", line 674, in broadcast_gradient_args "BroadcastGradientArgs", s0=s0, s1=s1, name=name) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper op_def=op_def) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 3414, in create_op op_def=op_def) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 1740, in init self._traceback = self._graph._extract_stack() # pylint: disable=protected-access

...which was originally created as op 'model/loss/sub', defined at: File "train.py", line 152, in main() [elided 0 identical lines from previous traceback] File "train.py", line 148, in main train(log_dir, args) File "train.py", line 64, in train model.add_loss() File "/mnt/c/Users/k017c1149/tacotron-master/models/tacotron.py", line 115, in add_loss self.mel_loss = tf.reduce_mean(tf.abs(self.mel_targets - self.mel_outputs)) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/ops/math_ops.py", line 847, in binary_op_wrapper return func(x, y, name=name) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/ops/gen_math_ops.py", line 8009, in sub "Sub", x=x, y=y, name=name) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper op_def=op_def) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 3414, in create_op op_def=op_def) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 1740, in init self._traceback = self._graph._extract_stack() # pylint: disable=protected-access

InvalidArgumentError (see above for traceback): Incompatible shapes: [4,7110,80] vs. [4,2000,80] [[Node: model/optimizer/gradients/model/loss/sub_grad/BroadcastGradientArgs = BroadcastGradientArgs[T=DT_INT32, _device="/job:localhost/replica:0/task:0/device:CPU:0"](model/optimizer/gradients/model/loss/sub_grad/Shape, model/optimizer/gradients/model/loss/sub_grad/Shape_1)]]

Traceback (most recent call last): File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1322, in _do_call return fn(*args) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1307, in _run_fn options, feed_dict, fetch_list, target_list, run_metadata) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1409, in _call_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.InvalidArgumentError: Incompatible shapes: [4,7110,80] vs. [4,2000,80] [[Node: model/optimizer/gradients/model/loss/sub_grad/BroadcastGradientArgs = BroadcastGradientArgs[T=DT_INT32, _device="/job:localhost/replica:0/task:0/device:CPU:0"](model/optimizer/gradients/model/loss/sub_grad/Shape, model/optimizer/gradients/model/loss/sub_grad/Shape_1)]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "train.py", line 92, in train step, loss, opt = sess.run([global_step, model.loss, model.optimize]) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 900, in run run_metadata_ptr) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1135, in _run feed_dict_tensor, options, run_metadata) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1316, in _do_run run_metadata) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1335, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.InvalidArgumentError: Incompatible shapes: [4,7110,80] vs. [4,2000,80] [[Node: model/optimizer/gradients/model/loss/sub_grad/BroadcastGradientArgs = BroadcastGradientArgs[T=DT_INT32, _device="/job:localhost/replica:0/task:0/device:CPU:0"](model/optimizer/gradients/model/loss/sub_grad/Shape, model/optimizer/gradients/model/loss/sub_grad/Shape_1)]]

Caused by op 'model/optimizer/gradients/model/loss/sub_grad/BroadcastGradientArgs', defined at: File "train.py", line 152, in main() File "train.py", line 148, in main train(log_dir, args) File "train.py", line 65, in train model.add_optimizer(global_step) File "/mnt/c/Users/k017c1149/tacotron-master/models/tacotron.py", line 136, in add_optimizer gradients, variables = zip(optimizer.compute_gradients(self.loss)) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/training/optimizer.py", line 511, in compute_gradients colocate_gradients_with_ops=colocate_gradients_with_ops) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/ops/gradients_impl.py", line 532, in gradients gate_gradients, aggregation_method, stop_gradients) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/ops/gradients_impl.py", line 701, in _GradientsHelper lambda: grad_fn(op, out_grads)) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/ops/gradients_impl.py", line 396, in _MaybeCompile return grad_fn() # Exit early File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/ops/gradients_impl.py", line 701, in lambda: grad_fn(op, *out_grads)) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/ops/math_grad.py", line 859, in _SubGrad rx, ry = gen_array_ops.broadcast_gradient_args(sx, sy) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/ops/gen_array_ops.py", line 674, in broadcast_gradient_args "BroadcastGradientArgs", s0=s0, s1=s1, name=name) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper op_def=op_def) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 3414, in create_op op_def=op_def) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 1740, in init self._traceback = self._graph._extract_stack() # pylint: disable=protected-access

...which was originally created as op 'model/loss/sub', defined at: File "train.py", line 152, in main() [elided 0 identical lines from previous traceback] File "train.py", line 148, in main train(log_dir, args) File "train.py", line 64, in train model.add_loss() File "/mnt/c/Users/k017c1149/tacotron-master/models/tacotron.py", line 115, in add_loss self.mel_loss = tf.reduce_mean(tf.abs(self.mel_targets - self.mel_outputs)) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/ops/math_ops.py", line 847, in binary_op_wrapper return func(x, y, name=name) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/ops/gen_math_ops.py", line 8009, in sub "Sub", x=x, y=y, name=name) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper op_def=op_def) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 3414, in create_op op_def=op_def) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 1740, in init self._traceback = self._graph._extract_stack() # pylint: disable=protected-access

InvalidArgumentError (see above for traceback): Incompatible shapes: [4,7110,80] vs. [4,2000,80] [[Node: model/optimizer/gradients/model/loss/sub_grad/BroadcastGradientArgs = BroadcastGradientArgs[T=DT_INT32, _device="/job:localhost/replica:0/task:0/device:CPU:0"](model/optimizer/gradients/model/loss/sub_grad/Shape, model/optimizer/gradients/model/loss/sub_grad/Shape_1)]]

2018-07-22 10:25:57.106654: W tensorflow/core/kernels/queue_base.cc:277] _0_datafeeder/input_queue: Skipping cancelled enqueue attempt with queue not closed Traceback (most recent call last): File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1322, in _do_call return fn(*args) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1307, in _run_fn options, feed_dict, fetch_list, target_list, run_metadata) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1409, in _call_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.CancelledError: Enqueue operation was cancelled [[Node: datafeeder/input_queue_enqueue = QueueEnqueueV2[Tcomponents=[DT_INT32, DT_INT32, DT_FLOAT, DT_FLOAT], timeout_ms=-1, _device="/job:localhost/replica:0/task:0/device:CPU:0"](datafeeder/input_queue, _arg_datafeeder/inputs_0_1, _arg_datafeeder/input_lengths_0_0, _arg_datafeeder/mel_targets_0_3, _arg_datafeeder/linear_targets_0_2)]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/mnt/c/Users/k017c1149/tacotron-master/datasets/datafeeder.py", line 74, in run self._enqueue_next_group() File "/mnt/c/Users/k017c1149/tacotron-master/datasets/datafeeder.py", line 96, in _enqueue_next_group self._session.run(self._enqueue_op, feed_dict=feed_dict) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 900, in run run_metadata_ptr) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1135, in _run feed_dict_tensor, options, run_metadata) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1316, in _do_run run_metadata) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1335, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.CancelledError: Enqueue operation was cancelled [[Node: datafeeder/input_queue_enqueue = QueueEnqueueV2[Tcomponents=[DT_INT32, DT_INT32, DT_FLOAT, DT_FLOAT], timeout_ms=-1, _device="/job:localhost/replica:0/task:0/device:CPU:0"](datafeeder/input_queue, _arg_datafeeder/inputs_0_1, _arg_datafeeder/input_lengths_0_0, _arg_datafeeder/mel_targets_0_3, _arg_datafeeder/linear_targets_0_2)]]

Caused by op 'datafeeder/input_queue_enqueue', defined at: File "train.py", line 152, in main() File "train.py", line 148, in main train(log_dir, args) File "train.py", line 57, in train feeder = DataFeeder(coord, input_path, hparams) File "/mnt/c/Users/k017c1149/tacotron-master/datasets/datafeeder.py", line 45, in init self._enqueue_op = queue.enqueue(self._placeholders) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/ops/data_flow_ops.py", line 346, in enqueue self._queue_ref, vals, name=scope) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/ops/gen_data_flow_ops.py", line 3977, in queue_enqueue_v2 timeout_ms=timeout_ms, name=name) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper op_def=op_def) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 3414, in create_op op_def=op_def) File "/home/yuu/.local/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 1740, in init self._traceback = self._graph._extract_stack() # pylint: disable=protected-access

CancelledError (see above for traceback): Enqueue operation was cancelled [[Node: datafeeder/input_queue_enqueue = QueueEnqueueV2[Tcomponents=[DT_INT32, DT_INT32, DT_FLOAT, DT_FLOAT], timeout_ms=-1, _device="/job:localhost/replica:0/task:0/device:CPU:0"](datafeeder/input_queue, _arg_datafeeder/inputs_0_1, _arg_datafeeder/input_lengths_0_0, _arg_datafeeder/mel_targets_0_3, _arg_datafeeder/linear_targets_0_2)]]

Plz teach me what should I do

aaroexxt commented 6 years ago

This error happens because your audio samples are too long. To fix it, either shorten your audio clips to be less than 12 seconds (I believe that is the default limit) or increase the max_iters hyperparam

keithito commented 6 years ago

Yes, please see bullet #5 here: https://github.com/keithito/tacotron/blob/master/README.md#notes-and-common-issues