# Multi-decoder text generation with BART

**URL:** <https://discuss.huggingface.co/t/multi-decoder-text-generation-with-bart/6630>\
**Category:** 🤗Transformers\
**Created:** [June 7, 2021, 6:36pm UTC](https://discuss.huggingface.co/t/multi-decoder-text-generation-with-bart/6630 "2021-06-07T18:36:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![vnik18](https://avatars.discourse-cdn.com/v4/letter/v/6a8cbe/32.png) [@vnik18](https://discuss.huggingface.co/u/vnik18)\
**Post date:** [June 7, 2021, 6:36pm UTC](https://discuss.huggingface.co/t/multi-decoder-text-generation-with-bart/6630/1 "2021-06-07T18:36:36Z")

</div>

Hello, I would like to perform text generation with BART, which takes a single text input, and uses 2 decoders to generate two different outputs from the single input, in a multi-decoder setup. I would like to apply a constraint such as `prefix_allowed_tokens_fn` only for one of the two decoders, and use unconstrained generation for the other decoder. So my question is: is it possible to have two calls to the `model.generate()` function in such a multi-decoder setup, one for each decoder? One call (for the first decoder) to `model.generate()` would take the `prefix_allowed_tokens_fn` as a parameter input, and the other call (for the second decoder) would not.

Thank you very much!
