Expected cuda:0 but got CPU error

Hello everyone,
So, I have a problem and I hope that you guys can help me figure out a solution for this.
so I wrote a model and trained it and I am trying to test it out.
and I get this error so here is the full sityuation:

device = 'cuda' if torch.cuda.is_available() else 'cpu'
    with torch.no_grad():
        total_correct = 0
        size_of_set = 0
    for images, labels in DataLoader:
        images = images.to(device)
        labels = labels.to(device)
        preds = Model(images)
        total_correct+= get_correct(preds,labels)

So actually, the first print shows that cuda is available.
but the second one shows that the images are given to the cpu…
This is weird and then I get this error:
RuntimeError: expected device cuda:0 but got device cpu

Did you move your Model as well to the device using Model.to(device)?

thx for your reply.
Actually, I did and it moved to another error that is related to my code. I think that I did something wrong.