Based on the error message it seems that batch contains a str object (besides tensors or other objects), which can’t be pushed to the GPU. Could you check the content of batch and call to(device) only on tensors?