(self, models)
| 775 | """A wrapper around an ensemble of models.""" |
| 776 | |
| 777 | def __init__(self, models): |
| 778 | super().__init__() |
| 779 | self.models_size = len(models) |
| 780 | # method '__len__' is not supported in ModuleList for torch script |
| 781 | self.single_model = models[0] |
| 782 | self.models = nn.ModuleList(models) |
| 783 | |
| 784 | self.has_incremental: bool = False |
| 785 | if all( |
| 786 | hasattr(m, "decoder") and isinstance(m.decoder, FairseqIncrementalDecoder) |
| 787 | for m in models |
| 788 | ): |
| 789 | self.has_incremental = True |
| 790 | |
| 791 | def forward(self): |
| 792 | pass |