I have a deep but simple model (bunch of convs, relu, bn) and data that i feed it. I’ve moved the weights with model.cuda() and the data with .to(device) but it fails and tells me that input is torch.cuda.FloatTensor and weights are torch.FloatTensor. Which is very wierd.
When I don’t move data with .to(device) then it says that input is torch.FloatTensor and weights are torch.cuda.FloatTensor.
If I place .to within dataset class getitem then I gett multiprocessing error for cuda. Does anyone know why mysteriously when I set both model.cuda() and data.to(device) it doesnt work?
dataset = SomeDataset()
dataloader = DataLoader(dataset, batch_size=10, num_workers=1)
model = Model3000()
model.cuda()
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
model = model.to(device)
print("Using device: ", device) # this displays cuda:0
n_iters = 100
for i in range(1, n_iters):
for batch_ndx, sample in enumerate(tqdm(dataloader, desc=f"Epoch {i}: ")):
data = sample[0]
iz = model(data)