capreolus.reranker.ptBERTMaxP

Module Contents

Classes

ElectraRelevanceHead

BERT-style ClassificationHead (i.e., out_proj only -- no dense). See transformers.ElectraClassificationHead

PTBERTMaxP_Class

PTBERTMaxP

PyTorch implementation of BERT-MaxP.

Attributes

logger

capreolus.reranker.ptBERTMaxP.logger[source]
class capreolus.reranker.ptBERTMaxP.ElectraRelevanceHead(dropout, out_proj, *args, **kwargs)[source]

Bases: torch.nn.Module

BERT-style ClassificationHead (i.e., out_proj only – no dense). See transformers.ElectraClassificationHead

call(inputs, **kwargs)[source]
class capreolus.reranker.ptBERTMaxP.PTBERTMaxP_Class(extractor, config, *args, **kwargs)[source]

Bases: torch.nn.Module

forward(doc_input, doc_mask, doc_seg)[source]

doc_input: (BS, N_PSG, SEQ_LEN) -> [psg-1, psg-2, …, [PAD], [PAD]]

predict_step(doc_input, doc_mask, doc_seg)[source]

Scores each passage and applies max pooling over it.

class capreolus.reranker.ptBERTMaxP.PTBERTMaxP(config=None, provide=None, share_dependency_objects=False, build=True)[source]

Bases: capreolus.reranker.Reranker

PyTorch implementation of BERT-MaxP.

Deeper Text Understanding for IR with Contextual Neural Language Modeling. Zhuyun Dai and Jamie Callan. SIGIR 2019. https://arxiv.org/pdf/1905.09217.pdf

module_name = ptBERTMaxP[source]
dependencies[source]
config_spec[source]
build_model()[source]
score(d)[source]
test(d)[source]