only use Bartmodel BartEncoder to replace seq2seq encoder(I'm an NLP kid)

29 Views Asked by At

In the seq2seq model, whether only the BartEncoder in the BartModel is used and the decoder uses its own definition, or whether the decoder in another seq2seq model is used. Is there a big guy who can provide some experience or links to relevant code projects? thanks!

I tried to use a seq2seq model for a project and tried to replace the encoder with a pre-trained BartEncoder, but didn't know how to interact with the previous decoder.


bart_config = BartConfig.from_pretrained("/home/xxx/bart-large-cnn/")
self.encoder = BartModel(bart_config).get_encoder()

...

**# How should I change this ???**
memory_bank = self.model.encoder(src, src_lens, src_mask)
state = self.model.decoder.init_state(memory_bank, src_mask)
control_embed = self.model.decoder.forward_seg(state)
0

There are 0 best solutions below