Exemplo n.º 1
0
 class Config(Task.Config):
     features: QueryDocumentPairwiseRanking.ModelInputConfig = (
         QueryDocumentPairwiseRanking.ModelInputConfig())
     model: QueryDocumentPairwiseRankingModel.Config = (
         QueryDocumentPairwiseRankingModel.Config())
     data_handler: QueryDocumentPairwiseRankingDataHandler.Config = (
         QueryDocumentPairwiseRankingDataHandler.Config())
     trainer: Trainer.Config = Trainer.Config()
     labels: Optional[DocLabelConfig] = None
     metric_reporter: PairwiseRankingMetricReporter.Config = (
         PairwiseRankingMetricReporter.Config())
    def setUp(self):
        simple_featurizer_config = SimpleFeaturizer.Config()
        simple_featurizer_config.split_regex = r""
        simple_featurizer_config.convert_to_bytes = True

        self.data_handler = QueryDocumentPairwiseRankingDataHandler.from_config(
            QueryDocumentPairwiseRankingDataHandler.Config(),
            ModelInputConfig(),
            [],
            featurizer=SimpleFeaturizer.from_config(simple_featurizer_config,
                                                    FeatureConfig()),
        )
Exemplo n.º 3
0
    def setup_data(self):
        simple_featurizer_config = SimpleFeaturizer.Config()
        simple_featurizer_config.split_regex = r""
        simple_featurizer_config.convert_to_bytes = True

        self.data_handler = QueryDocumentPairwiseRankingDataHandler.from_config(
            QueryDocumentPairwiseRankingDataHandler.Config(),
            ModelInputConfig(),
            [],
            featurizer=SimpleFeaturizer.from_config(simple_featurizer_config,
                                                    FeatureConfig()),
        )
        self.file_name = tests_module.test_file(
            "query_document_pairwise_ranking_tiny.tsv")
        self.data_handler.shuffle = False
        self.data_handler.init_metadata_from_path(self.file_name,
                                                  self.file_name,
                                                  self.file_name)