Beispiel #1
0
    def create_model(self, shared_rep):
        # shared_rep: do query and response share representation layer?
        metadata = self.data_handler.metadata
        model_config = QueryDocumentPairwiseRankingModel_Deprecated.Config()

        model_config.representation = QueryDocumentPairwiseRankingRep.Config()
        model_config.representation.shared_representations = shared_rep

        model_config.decoder = MLPDecoderQueryResponse.Config()
        model_config.decoder.hidden_dims = [64]
        model_config.output_layer = PairwiseRankingOutputLayer.Config()

        feat_config = ModelInputConfig()
        feat_config.pos_response = WordFeatConfig()
        feat_config.pos_response.embed_dim = 64
        feat_config.neg_response = WordFeatConfig()
        feat_config.query = WordFeatConfig()
        return QueryDocumentPairwiseRankingModel_Deprecated.from_config(
            model_config, feat_config, metadata)
Beispiel #2
0
 class Config(Task_Deprecated.Config):
     features: QueryDocumentPairwiseRanking.ModelInputConfig = (
         QueryDocumentPairwiseRanking.ModelInputConfig())
     model: QueryDocumentPairwiseRankingModel_Deprecated.Config = (
         QueryDocumentPairwiseRankingModel_Deprecated.Config())
     data_handler: QueryDocumentPairwiseRankingDataHandler.Config = (
         QueryDocumentPairwiseRankingDataHandler.Config())
     trainer: Trainer.Config = Trainer.Config()
     labels: Optional[DocLabelConfig] = None
     metric_reporter: PairwiseRankingMetricReporter.Config = (
         PairwiseRankingMetricReporter.Config())