How to use BART as an encoder and a decoder separately for summarization?

Hi! I am a new comer to huggingface. I wanted to modify the encoder outputs from BART’s encoder and apply some operations on them, and then generate tokens from the decoder step by step. But I am not able to find any BARTEncoder model in huggingface, neither a BARTDecoder, so how should I go about it?

1 Like

You might need to modify the encoder (and/or) the decoder in this:

https://huggingface.co/transformers/_modules/transformers/models/bart/modeling_bart.html#BartModel

Copy-paste the entire file, save it locally as ‘modifiedbart.py’, and call it instead of the default “BARTModel” in transformers.