capreolus.reranker.TFBERTMaxP

Module Contents

Classes

TFBERTMaxP_Class(extractor, config, *args, **kwargs)
TFBERTMaxP(config=None, provide=None, share_dependency_objects=False, build=True) 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.
class capreolus.reranker.TFBERTMaxP.TFBERTMaxP_Class(extractor, config, *args, **kwargs)[source]

Bases: tensorflow.keras.layers.Layer

call(self, x, **kwargs)[source]

Returns logits of shape [2]

predict_step(self, data)[source]

Scores each passage and applies max pooling over it.

score(self, x, **kwargs)[source]
score_pair(self, x, **kwargs)[source]
class capreolus.reranker.TFBERTMaxP.TFBERTMaxP(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 = TFBERTMaxP[source]
dependencies[source]
config_spec[source]
build_model(self)[source]