def _build_model(self) -> Estimator: """ Initializes the estimator architecture. """ super()._build_model() if self.hparams.encoder_model != "LASER": self.layer = ( int(self.hparams.layer) if self.hparams.layer != "mix" else self.hparams.layer ) self.scalar_mix = ( ScalarMixWithDropout( mixture_size=self.encoder.num_layers, dropout=self.hparams.scalar_mix_dropout, do_layer_norm=True, ) if self.layer == "mix" and self.hparams.pool != "default" else None ) self.ff = FeedForward( in_dim=self.encoder.output_units * 4, hidden_sizes=self.hparams.hidden_sizes, activations=self.hparams.activations, dropout=self.hparams.dropout, )
def _build_model(self) -> Estimator: """ Initializes the estimator architecture. """ super()._build_model() if self.hparams.encoder_model != "LASER": self.layer = (int(self.hparams.layer) if self.hparams.layer != "mix" else self.hparams.layer) self.scalar_mix = (ScalarMixWithDropout( mixture_size=self.encoder.num_layers, dropout=self.hparams.scalar_mix_dropout, do_layer_norm=True, ) if self.layer == "mix" and self.hparams.pool != "default" else None) input_emb_sz = (self.encoder.output_units * 6 if self.hparams.pool != "cls+avg" else self.encoder.output_units * 2 * 6) self.ff = FeedForward( in_dim=input_emb_sz, hidden_sizes=self.hparams.hidden_sizes, activations=self.hparams.activations, dropout=self.hparams.dropout, final_activation=( self.hparams.final_activation if hasattr( self.hparams, "final_activation" ) # compatability with older checkpoints! else "Sigmoid"), )
def _build_model(self) -> ModelBase: """ Initializes the ranking model architecture. """ super()._build_model() self.metrics = WMTKendall() if self.hparams.encoder_model != "LASER": self.layer = (int(self.hparams.layer) if self.hparams.layer != "mix" else self.hparams.layer) self.scalar_mix = (ScalarMixWithDropout( mixture_size=self.encoder.num_layers, dropout=self.hparams.scalar_mix_dropout, do_layer_norm=True, ) if self.layer == "mix" and self.hparams.pool != "default" else None)