(self,bert_model,fea_dim)
| 135 | |
| 136 | class bComments(torch.nn.Module): |
| 137 | def __init__(self,bert_model,fea_dim): |
| 138 | super(bComments, self).__init__() |
| 139 | self.comment_dim = 768 |
| 140 | self.bert = BertModel.from_pretrained(bert_model).requires_grad_(False) |
| 141 | self.attention = Attention(dim=128,heads=4) |
| 142 | self.linear_comment = nn.Sequential(torch.nn.Linear(self.comment_dim, fea_dim),torch.nn.ReLU()) |
| 143 | self.classifier = nn.Linear(fea_dim,2) |
| 144 | |
| 145 | def forward(self, **kwargs): |
| 146 | comments_inputid = kwargs['comments_inputid'] |