roberta custom head test3

This commit is contained in:
s444501 2023-02-12 19:35:22 +01:00
parent 9766a22440
commit f52c10479c

View File

@ -24,6 +24,7 @@ class RobertaLeakyHead(nn.Module):
classifier_dropout = (
config.classifier_dropout if config.classifier_dropout is not None else config.hidden_dropout_prob
)
self.leaky_relu = nn.LeakyReLU()
self.dropout = nn.Dropout(classifier_dropout)
self.out_proj = nn.Linear(hidden_size, config.num_labels)
@ -53,19 +54,19 @@ class RobertaLeakyHead(nn.Module):
)
x = self.dense_1(x)
x = torch.nn.LeakyReLU(x)
x = self.leaky_relu(x)
x = self.dropout(x)
x = self.dense_2(x)
x = torch.nn.LeakyReLU(x)
x = self.leaky_relu(x)
x = self.dropout(x)
x = self.dense_3(x)
x = torch.nn.LeakyReLU(x)
x = self.leaky_relu(x)
x = self.dropout(x)
x = self.dense_4(x)
x = torch.nn.LeakyReLU(x)
x = self.leaky_relu(x)
x = self.dropout(x)
x = self.out_proj(x)