有没有办法控制序列到序列文本摘要模型的输出长度?

Is there a way to control the output length of a sequence to sequence text summarization model?

有没有办法控制用于文本摘要的 seq2seq 模型生成的单词或字符的数量?示例:

"My dog is the fastest dog in the world. He loves cuddling as well."

1 输出:我的狗很快,喜欢拥抱。

2输出:我的狗是跑得最快的狗,也喜欢抱抱。

这可以通过产生输出的解码器步骤数来控制,在此 repo there are multiple approaches for text summarizations,and in eah of them there is a parameter like in the case of this model, there is a parameter named max_dec_steps (in cell 28) which controls max timesteps of decoder (max summary tokens), which simply reflects to the length of the output sentence, the repo writer also explains in detail multiple other models in this blog series

希望对您有所帮助