CUDA Error: an illegal memory access was encountered with ProArt 4080 Super

I had google and read various error of illegal memory access was encountered. But before I got this error, I was able to run just fine for weeks prior. All I am doing is a simple binary classification using Pytoruch and Cuda 12.6 (was 12.4 before) and encounter this error. I had contact ASUS support and they suspect this is an Pytorch issue. As such, I here looking for help.

Here is the output of the error with this fragment of code:


num_epochs = 20

# We use the pre-defined number of epochs to determine how many iterations to train the network on
for epoch in range(num_epochs):
    print("Computing Epoch " + str(epoch) + "...")
    # Load in the data in batches using the train_dataloader object
    for i, (images, labels) in enumerate(train_dataloader):
        # Move tensors to the configured device
        images = images.to(device)
        labels = labels.to(device)

        # Forward pass
        outputs = model(images)
        loss = criterion(outputs, labels)

        # Backward and optimize
        optimizer.zero_grad()
        loss.backward()
        optimizer.step()

    print('Epoch [{}/{}], Loss: {:.4f}'.format(epoch+1, num_epochs, loss.item()))

Error Output:

Any help would be appreciated. I can also provide the test.py if required as it is a basic binary classification with random generated image. And also the output from “compute-sanitizer python .\test.py”.