Skip to content
This repository was archived by the owner on Mar 20, 2026. It is now read-only.

Commit 95294bf

Browse files
xu-songfacebook-github-bot
authored andcommitted
refactor superclass of MaskedLMModel (#2170)
Summary: masked_lm is actually encoder-only model # Before submitting - [ ] Was this discussed/approved via a Github issue? (no need for typos, doc improvements) - [x] Did you read the [contributor guideline](https://github.com/pytorch/fairseq/blob/master/CONTRIBUTING.md)? - [x] Did you make sure to update the docs? - [ ] Did you write any new necessary tests? ## What does this PR do? Class Refactor ## Did you have fun? Make sure you had fun coding � Pull Request resolved: #2170 Reviewed By: ngoyal2707 Differential Revision: D21725071 Pulled By: myleott fbshipit-source-id: 75fd36008f3e3425f8f5180472734394046dfb77
1 parent 145bc9d commit 95294bf

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

fairseq/models/masked_lm.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
from fairseq import utils
1313
from fairseq.models import (
14-
BaseFairseqModel,
14+
FairseqEncoderModel,
1515
FairseqEncoder,
1616
register_model,
1717
register_model_architecture,
@@ -28,15 +28,14 @@
2828

2929

3030
@register_model('masked_lm')
31-
class MaskedLMModel(BaseFairseqModel):
31+
class MaskedLMModel(FairseqEncoderModel):
3232
"""
3333
Class for training a Masked Language Model. It also supports an
3434
additional sentence level prediction if the sent-loss argument is set.
3535
"""
3636
def __init__(self, args, encoder):
37-
super().__init__()
37+
super().__init__(encoder)
3838
self.args = args
39-
self.encoder = encoder
4039

4140
# if specified then apply bert initialization on the model. We need
4241
# to explictly call this to make sure that the output embeddings

0 commit comments

Comments
 (0)