コード例 #1
0
 def __init__(self, bert_large=False):
     super().__init__(bert_large)
     MUS = [-0.9, -0.7, -0.5, -0.3, -0.1, 0.1, 0.3, 0.5, 0.7, 0.9, 1.0]
     SIGMAS = [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.001]
     self.bert_ranker = VanillaBertRanker()
     self.simmat = modeling_util.SimmatModule()
     self.kernels = modeling_util.KNRMRbfKernelBank(MUS, SIGMAS)
     self.combine = torch.nn.Linear(self.kernels.count() * self.CHANNELS + self.BERT_SIZE, 1)
コード例 #2
0
 def __init__(self, bert_large=False):
     super().__init__(bert_large)
     NBINS = 11
     HIDDEN = 5
     self.bert_ranker = VanillaBertRanker()
     self.simmat = modeling_util.SimmatModule()
     self.histogram = modeling_util.DRMMLogCountHistogram(NBINS)
     self.hidden_1 = torch.nn.Linear(NBINS * self.CHANNELS + self.BERT_SIZE, HIDDEN)
     self.hidden_2 = torch.nn.Linear(HIDDEN, 1)
コード例 #3
0
 def __init__(self, bert_large=False):
     super().__init__(bert_large)
     QLEN = 20
     KMAX = 2
     NFILTERS = 32
     MINGRAM = 1
     MAXGRAM = 3
     self.simmat = modeling_util.SimmatModule()
     self.ngrams = torch.nn.ModuleList()
     self.rbf_bank = None
     for ng in range(MINGRAM, MAXGRAM+1):
         ng = modeling_util.PACRRConvMax2dModule(ng, NFILTERS, k=KMAX, channels=self.CHANNELS)
         self.ngrams.append(ng)
     qvalue_size = len(self.ngrams) * KMAX
     self.linear1 = torch.nn.Linear(self.BERT_SIZE + QLEN * qvalue_size, 32)
     self.linear2 = torch.nn.Linear(32, 32)
     self.linear3 = torch.nn.Linear(32, 1)