How to restrict the output sequence length

Greetings Fellow Researchers,

I need a help, I am having a parallel source and target data with the constant length of 60 in each . but when I am predicting the value I am getting more length of output sequence lets say 100(but output length is also constant , i.e. 100 ), but my target file has only 60 characters. Ideally it should predict the result with 60 character sequence length.

Is their is any chance to fix this and get the output length as the desired length.

I am using multi feature transformer model checkpoints to predict the output.

Thanks & Regards

Based on your post history, I assume you are using OpenNMT-tf.

Did you check if these parameters work for you?

params:
  # (optional) Minimum length of decoded sequences, end token excluded (default: 0).
  minimum_decoding_length: 0
  # (optional) Maximum length of decoded sequences, end token excluded (default: 250).
  maximum_decoding_length: 250
1 Like