Exercise 4: I’m getting the following error while running validate_epoch():
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!
The model instantiation cell is locked (model = SimpleCNN(num_classes)), so I can’t add model.to(device). Could someone help identify what might be causing this device mismatch?
Perhaps you have accidentally deleted Cell 3. In Exercise 4, the line that moves the tensors to the device is already provided as a non-graded line.
If Cell 3 is missing, you will need to reset the assignment. To do this, click on the three dots in the top-right corner. First, rename or delete the current assignment, and then restore the original. This should give you a new copy of the assignment with the original cells restored.
Kindly click on my name and then message me screenshot of your codes for train epoch and validate epoch.
as per the log info, it is pointing your labels created the issue with device allocation, so in my previous response here where I mentioned move the image and labels to specified device, chances are, there might conflict of variable recall with the assigned arguments
for example if I have to move image to say tpu (this is example not directed to codes directly)
images.to(tpu), same goes for the labels as labels.to(tpu) (for the grade function the device is recalled by argument device, so I hope you have followed the same
Hi, I’ve removed the screenshots of your code solutions because sharing solution screenshots publicly is not allowed under the Code of Conduct here.
The mentor is asking if you can send the screenshots to them via private inbox. You can either do that, or you can send them to me privately through my inbox, and I’ll be happy to check the code as well. Please just make sure not to post the solutions publicly.
Hi, sorry about that. I didn’t realize posting the screenshots publicly wasn’t allowed. I’ll send them through a private inbox instead. Thanks for letting me know!