capreolus.reranker.CEDRKNRM

Module Contents

Classes

CEDRKNRM_Class

CEDRKNRM

Base class for Reranker modules. The purpose of a Reranker is to predict relevance scores for input documents. Rerankers are generally supervised methods implemented in PyTorch or TensorFlow.

capreolus.reranker.CEDRKNRM.logger[source]
class capreolus.reranker.CEDRKNRM.CEDRKNRM_Class(extractor, config, *args, **kwargs)[source]

Bases: torch.nn.Module

masked_simmats(self, embeddings, bert_mask, bert_segments)[source]
knrm(self, bert_output, bert_mask, bert_segments, batch_size)[source]
forward(self, bert_input, bert_mask, bert_segments)[source]
class capreolus.reranker.CEDRKNRM.CEDRKNRM(config=None, provide=None, share_dependency_objects=False, build=True)[source]

Bases: capreolus.reranker.Reranker

Base class for Reranker modules. The purpose of a Reranker is to predict relevance scores for input documents. Rerankers are generally supervised methods implemented in PyTorch or TensorFlow.

Modules should provide:
  • a build_model method that initializes the model used

  • a score and a test method that take a representation created by an Extractor module as input and return document scores

  • a load_weights and a save_weights method, if the base class’ PyTorch methods cannot be used

module_name = CEDRKNRM[source]
dependencies[source]
config_spec[source]
build_model(self)[source]
score(self, d)[source]
test(self, d)[source]