I want to apply cross validation in Pytorch using skorch, so I prepared my model and my tensorDataset which returns (image,caption and captions_length) and so it has X and Y, so I'll not be able to set Y in the method
net.fit(dataset)
but when I tried that I got an error :
ValueError: Stratified CV requires explicitly passing a suitable y
Here's part of my code:
start = time.time()
net = NeuralNetClassifier(
decoder, criterion= nn.CrossEntropyLoss,
max_epochs=args.epochs,
lr=args.lr,
optimizer=optim.SGD,
device='cuda', # uncomment this to train with CUDA
)
net.fit(dataset, y=None)
end = time.time()