Im following the pytorch transfer learning tutorial and applying it to the kaggle seed classification task,Im just not sure how to save the predictions in a csv file so that i can make the submission, Any suggestion would be helpful,This is what i have ,
use_gpu = torch.cuda.is_available()
model = models.resnet50(pretrained=True)
for param in model.parameters():
param.requires_grad = False
num_ftrs = model.fc.in_features
model.fc = torch.nn.Linear(num_ftrs, len(classes))
f use_gpu:
model = model.cuda()
criterion = torch.nn.CrossEntropyLoss()
optimizer = torch.optim.SGD(model.fc.parameters(), lr=0.001, momentum=0.9)
exp_lr_scheduler = lr_scheduler.StepLR(optimizer, step_size=7, gamma=0.1)
loaders = {'train':train_loader, 'valid':valid_loader, 'test': test_loader}
model = train_model(loaders, model, criterion, optimizer, exp_lr_scheduler, num_epochs=50