Unified interface for encoder-decoder and decoder-only translation

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?