Commit Graph
16 Commits
Author SHA1 Message Date
Rémi Louf d889e0b71b add base for seq2seq finetuning 2019-10-11 17:36:12 +02:00
Rémi Louf f8e98d6779 load pretrained embeddings in Bert decoder
In Rothe et al.'s "Leveraging Pre-trained Checkpoints for Sequence
Generation Tasks", Bert2Bert is initialized with pre-trained weights for
the encoder, and only pre-trained embeddings for the decoder. The
current version of the code completely randomizes the weights of the
decoder.

We write a custom function to initiliaze the weights of the decoder; we
first initialize the decoder with the weights and then randomize
everything but the embeddings.
2019-10-11 16:48:11 +02:00
Rémi Louf 1e68c28670 add test for initialization of Bert2Rnd 2019-10-10 18:07:11 +02:00
Rémi Louf fa218e648a fix syntax errors 2019-10-10 15:16:07 +02:00
Rémi Louf 3e1cd8241e fix stupid (re)naming issue 2019-10-10 14:18:20 +02:00
Rémi Louf 81ee29ee8d remove the staticmethod used to load the config 2019-10-10 14:13:37 +02:00
Rémi Louf d7092d592c rename the attributes in the Bert Layer
Since the preloading of weights relies on the name of the class's
attributes changing the namespace breaks loading pretrained weights on
Bert and all related models. I reverted `self_attention` to `attention`
and us `crossattention` for the decoder instead.
2019-10-10 12:51:14 +02:00
Rémi Louf 51261167b4 prune both attention and self-attention heads 2019-10-10 12:17:22 +02:00
Rémi Louf 17177e7379 add is_decoder as an attribute to Config class 2019-10-10 12:03:58 +02:00
Rémi Louf df85a0ff0b replace double quotes with simple quotes 2019-10-10 11:38:26 +02:00
Rémi Louf 9ca788b2e8 merge the two Bert layers classes 2019-10-10 11:33:28 +02:00
Rémi Louf edfc8f8225 Remove and do the branching in 2019-10-10 10:17:27 +02:00
Rémi Louf 09cfd12235 remove and do the branching in 2019-10-10 10:15:27 +02:00
Rémi Louf 877ef2c6ca override from_pretrained in Bert2Rnd
In the seq2seq model we need to both load pretrained weights in the
encoder and initialize the decoder randomly. Because the
`from_pretrained` method defined in the base class relies on module
names to assign weights, it would also initialize the decoder with
pretrained weights. To avoid this we override the method to only
initialize the encoder with pretrained weights.
2019-10-10 10:02:18 +02:00
Rémi Louf 851ef592c5 add comment on recursive weights loading 2019-10-10 10:02:03 +02:00
Rémi Louf 770b15b58c rename class in __init__ 2019-10-08 17:32:28 +02:00