Hello,
I would like to apply grid search to Resnet18 model.Can anyone help me about it?
skorch
is a scikit-learn compatible PyTorch wrapper and provides examples on how to perform Grid search.
Hello @ptrblck
Thank you for your response. I am wondering how can change this code for implementing Resnet 18 ?
class MyModule(nn.Module):
def init(self, num_units=10, nonlin=F.relu):
super(MyModule, self).init()
self.dense0 = nn.Linear(20, num_units)
self.nonlin = nonlin
self.dropout = nn.Dropout(0.5)
self.dense1 = nn.Linear(num_units, 10)
self.output = nn.Linear(10, 2)
def forward(self, X, **kwargs):
X = self.nonlin(self.dense0(X))
X = self.dropout(X)
X = F.relu(self.dense1(X))
X = F.softmax(self.output(X))
return X
You would have to change the entire model architecture and either implement the resnet from scratch or you could use other implementations for a resnet from e.g. torchvision.models
.