MCPcopy Create free account
hub / github.com/DLVulDet/PrimeVul / ModelWithCLRForClassification

Class ModelWithCLRForClassification

os_expr/model.py:127–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125 return loss,prob,labels
126
127class ModelWithCLRForClassification(ModelWithCLR):
128 def __init__(self, encoder, config, tokenizer, args):
129 super().__init__(encoder, config, tokenizer, args, clr_mask=False)
130
131 def forward(self, input_ids=None, labels=None):
132 attention_mask = input_ids.ne(1)
133 outputs = self.encoder(input_ids,attention_mask)
134 cls_output = self.cls_head(outputs[0])
135 logits=cls_output
136 prob=torch.sigmoid(logits)
137 return prob
138
139
140class DefectModel(nn.Module):

Callers 1

mainFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected