Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23160

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

$
0
0

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)

Viewing all articles
Browse latest Browse all 23160

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>