Hi ! I am actually building model in which we have 5 different classes of data and I use same which was given in Pannylane notebook. But its seems not perfectly work for me …
In this note book there is just 2 classes of data is used like : Ants and Bees
But I want to apply it on 5 classes of data : So Does i need to do some modification in my code you can check my code in link below: Here is my code:
Hi @M_Umer_Yasin — Welcome to the forum! Certainly if you need to classify objects into more bins you will have to do at least some modifications on the tutorial.
There are a number of ways you could do multi-class classification. One approach that is taken in the Multiclass margin classifier demo (not the only way) is to use multiple binary classfiers, where the binary choice to be made is “is it in class X or not in class X?”
22 frames
/usr/local/lib/python3.10/dist-packages/pennylane/math/single_dispatch.py in _coerce_types_torch(tensors)
603 # GPU specific case
604 device_names = ", “.join(str(d) for d in device_set)
→ 605 raise RuntimeError(
606 f"Expected all tensors to be on the same device, but found at least two devices, {device_names}!”
607 )
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0, cpu!
It looks like somewhere along the line you’re creating a torch tensor on a cpu device instead of a gpu device (or the other way around). You’ll need to do something like this:
I spoke with someone internally and it looks like this issue might be due to the fact that putting the torch tensor on a gpu is problematic when lightning-gpu is being used as well. Lightning-gpu and torch’s gpu pipeline are entirely differerent, and lightning-gpu expects the data to be on the host right now, so that should fix it!