RuntimeError with cuda

I am trying to train deep learning with my dna sequence. However I am keep getting an error message which I can not locate. Can anyone help me with this?

Model:

# import the necessary packages
from torch.nn import Module,Dropout,Conv1d,Linear,MaxPool1d,ReLU,Conv2d,MaxPool2d
import pytorch_lightning as pl
from torch import flatten
from typing import List
class model_test(nn.Module): # deepcre model  
    def __init__(self,
                 seq_len: int =1000,
                 kernel_size: int = 8,
                 p = 0.25): # drop out value 
        super().__init__()
        self.seq_len = seq_len
        # adjusting window size corresponding to sequence length 
        window_size = int(seq_len*(8/3000)) # 1000* = 2 
        
        # CNN module
        self.conv11 = Conv1d(4,64,kernel_size=(kernel_size),padding= "same",stride = 1  )
        self.relu11 = ReLU()
        self.maxpool1 = MaxPool1d(kernel_size=window_size)
        self.Dropout1 = Dropout(p)
        self.fc1 =Linear( batch_size_init*(seq_len//window_size) , 1)
    
    def forward(self, x):
       # x = xb.permute(0,2,1).unsqueeze(1)
        """Forward pass."""
        # reshape view to batch_size x 4channel x seq_len
        # permute to put channel in correct order
        # rearranges the original tensor according to the desired ordering and returns a new multidimensional rotated tensor. 
        # The size of the returned tensor remains the same as that of the original. (0,2,1) means (batch size, 4 channel - OHE(DNA), Seq.length  )
        x = x.permute(0,2,1)
        x = self.conv11(x)
        x = self.relu11(x)
        print("conv1 1st : ",x.size())
        x = self.maxpool1(x)
        print("maxpool : ",x.size())
        x = self.Dropout1(x)
        x = x.view(batch_size_init, 64*500)
        print("view1 : ",x.size())
        print("view2 : ",x.size())
        print("checking processed dimension",x.dim()
        x = self.fc1(x)
        print("linear : ",x.size())
        return x

Learner :


dls= DataLoaders(train_dl,val_dl)
net = model_test()
learn= Learner(dls, net, loss_func= nn.MSELoss(), opt_func = SGD, lr= 0.001) 

learn.fit(2)

Error :

RuntimeError: Exception occured in `Recorder` when calling event `after_batch`:
        iter.device(arg).is_cuda() INTERNAL ASSERT FAILED at "../aten/src/ATen/native/cuda/Loops.cuh":89, please 
report a bug to PyTorch. argument 1: expected a CUDA device but found cpu

Hi Jinsoo
Do you have a GPU.
Try

import torch

device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
print(f"Using device: {device}")

COPIED from How to Check if PyTorch is Using the GPU | Saturn Cloud Blog

Regards Conwyn