Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the same or input should be a MKLDNN tensor and weight is a dense tensor #4

Closed
sudoLife opened this issue Apr 4, 2024 · 3 comments

Comments

@sudoLife
Copy link
Contributor

sudoLife commented Apr 4, 2024

Hi,

While following this guide, I get the error in the title. My code:

from autodistill_owl_vit import OWLViT
from autodistill.detection import CaptionOntology
base_model = OWLViT(
    ontology=CaptionOntology(
        {
            "white strawberry in cream": "white strawberry",
            "red strawberry": "red strawberry"
        }
    )
)
result = base_model.predict("2544.jpg")
print(result)

Any ideas?

The error occurs here:

File "/home/sudolife/projects/yolo-world/venv/lib/python3.11/site-packages/torch/nn/modules/conv.py", line 456, in _conv_forward
    return F.conv2d(input, weight, bias, self.stride,

I might investigate further a little later, but the stack trace is quite deep so it'll take some time.

@sudoLife
Copy link
Contributor Author

sudoLife commented Apr 6, 2024

Okay, so that was because the model was put on the GPU while the same wasn't being done for the inputs. Fixed it.

@ArghyaChatterjee
Copy link

ArghyaChatterjee commented May 11, 2024

Still getting the issue, is there any fix for this ?? Looks like you haven't pushed the changes to this branch or updated the binaries being installed with pip install autodistill-owl-vit .

@sudoLife
Copy link
Contributor Author

Still getting the issue, is there any fix for this ?? Looks like you haven't pushed the changes to this branch or updated the binaries being installed with pip install autodistill-owl-vit .

Hi, I can't push the changes to the branch because I'm not the maintainer of the project. That being said, you can apply the pull request to your installed version and it should work :)

capjamesg added a commit that referenced this issue Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants