# Unified interface for encoder-decoder and decoder-only translation

**URL:** <https://discuss.huggingface.co/t/unified-interface-for-encoder-decoder-and-decoder-only-translation/27824>\
**Category:** Beginners\
**Created:** [December 14, 2022, 7:36pm UTC](https://discuss.huggingface.co/t/unified-interface-for-encoder-decoder-and-decoder-only-translation/27824 "2022-12-14T19:36:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![celinelee](https://avatars.discourse-cdn.com/v4/letter/c/a183cd/32.png) [@celinelee](https://discuss.huggingface.co/u/celinelee)\
**Post date:** [December 14, 2022, 7:36pm UTC](https://discuss.huggingface.co/t/unified-interface-for-encoder-decoder-and-decoder-only-translation/27824/1 "2022-12-14T19:36:04Z")

</div>

I have a translation task and I want to try both encoder-decoder models and decoder-only models. Is there a standardized way to switch between the two?

For example, some HF frontend that lets me pass in the model (and type) and paired translation data; then it, based on the model type, formats and inputs the data as either seq2seq (input: src tokens; label: target toks) or decoder-only (input: src toks target toks).

Or do people simply write different code for the two options?
