Hi,
I’m using the openNMT Tiny Transformer architecture to train a model. In the evaluation process during training, I got an unexpected error, that I reported below. I’m using OpenNMT-tf version 2.23.0
Running evaluation for step 5000
Traceback (most recent call last):
File “/usr/local/bin/onmt-main”, line 8, in
sys.exit(main())
File “/usr/local/lib/python3.8/dist-packages/opennmt/bin/main.py”, line 308, in main
runner.train(
File “/usr/local/lib/python3.8/dist-packages/opennmt/runner.py”, line 276, in train
summary = trainer(
File “/usr/local/lib/python3.8/dist-packages/opennmt/training.py”, line 134, in call
early_stop = self._evaluate(
File “/usr/local/lib/python3.8/dist-packages/opennmt/training.py”, line 192, in _evaluate
evaluator(step)
File “/usr/local/lib/python3.8/dist-packages/opennmt/evaluation.py”, line 319, in call
loss, predictions = self._eval_fn(source, target)
File “/usr/local/lib/python3.8/dist-packages/tensorflow/python/util/traceback_utils.py”, line 153, in error_handler raise e.with_traceback(filtered_tb) from None
File “/usr/local/lib/python3.8/dist-packages/tensorflow/python/framework/func_graph.py”, line 1129, in autograph_handler
raise e.ag_error_metadata.to_exception(e)
ValueError: in user code:
File "/usr/local/lib/python3.8/dist-packages/opennmt/models/model.py", line 162, in evaluate *
outputs, predictions = self(features, labels=labels)
File "/usr/local/lib/python3.8/dist-packages/opennmt/models/model.py", line 102, in __call__ *
outputs, predictions = super().__call__(
File "/usr/local/lib/python3.8/dist-packages/keras/utils/traceback_utils.py", line 67, in error_handler **
raise e.with_traceback(filtered_tb) from None
ValueError: Exception encountered when calling layer "transformer_tiny_1" (type TransformerTiny).
in user code:
File "/usr/local/lib/python3.8/dist-packages/opennmt/models/sequence_to_sequence.py", line 181, in call *
predictions = self._dynamic_decode(
File "/usr/local/lib/python3.8/dist-packages/opennmt/models/sequence_to_sequence.py", line 380, in _dynamic_decode *
target_tokens, sampled_length = _add_noise(
File "/usr/local/lib/python3.8/dist-packages/opennmt/models/sequence_to_sequence.py", line 640, in _add_noise *
return noiser(tokens, lengths, keep_shape=True)
File "/usr/local/lib/python3.8/dist-packages/opennmt/data/noise.py", line 69, in __call__ *
return self._call(tokens, sequence_length, keep_shape, probability)
File "/usr/local/lib/python3.8/dist-packages/opennmt/data/noise.py", line 87, in _call *
raise ValueError("unsupported rank %d for WordNoiser input" % input_rank)
ValueError: unsupported rank 3 for WordNoiser input
Call arguments received:
• features={'length': 'tf.Tensor(shape=(None,), dtype=int32)', 'tokens': 'tf.Tensor(shape=(None, None), dtype=string)', 'ids': 'tf.Tensor(shape=(None, None), dtype=int64)', 'index': 'tf.Tensor(shape=(None,), dtype=int64)'}
• labels={'length': 'tf.Tensor(shape=(None,), dtype=int32)', 'tokens': 'tf.Tensor(shape=(None, None), dtype=string)', 'ids': 'tf.Tensor(shape=(None, None), dtype=int64)', 'ids_out': 'tf.Tensor(shape=(None, None), dtype=int64)'}
• training=None
• step=None