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

Unknown builtin op: torchvision::nms #818

Closed
anandvsr opened this issue Apr 5, 2021 · 9 comments
Closed

Unknown builtin op: torchvision::nms #818

anandvsr opened this issue Apr 5, 2021 · 9 comments

Comments

@anandvsr
Copy link

anandvsr commented Apr 5, 2021

build.gradle

    plugins {
        id 'java'
    }
    
    repositories {
        mavenCentral()
    }
    
    dependencies {
        implementation group: 'ai.djl.pytorch', name: 'pytorch-engine', version: '0.10.0'
        implementation group: 'ai.djl.pytorch', name: 'pytorch-native-cpu', version: '1.7.1'
    
        implementation group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.30'
    }

Predict.java

    import ai.djl.MalformedModelException;
    import ai.djl.Model;
    
    import javax.imageio.ImageIO;
    import java.awt.image.BufferedImage;
    import java.io.IOException;
    
    public class Predict {
        public static void main(String[] args) {
            Path modelDir = Paths.get("src/main/resources/fasterrcnn_resnet50.pt");
    
            try (Model model = Model.newInstance("fasterrcnn_resnet50")) {
                model.load(modelDir);
            } catch (IOException | MalformedModelException e) {
                e.printStackTrace();
            }
        }
    }
@stu1130
Copy link
Contributor

stu1130 commented Apr 5, 2021

@anandvsr nms is TorchVision operator that we don't support. It is still blocked by pytorch/vision#2692.

@anandvsr
Copy link
Author

anandvsr commented Apr 7, 2021

Thank you!

@anandvsr anandvsr closed this as completed Apr 7, 2021
@smeet2804
Copy link

smeet2804 commented Oct 26, 2021

Hii @stu1130,
Facing same issue while inferencing object detection using pytorch trained model.
Is there any other way to do object detection inference using pytorch trained model?

@frankfliu
Copy link
Contributor

@smeet2804

If you install torchvision with python, you can use DJL to run your model, what you need to do is set environment:

PYTORCH_EXTRA_LIBRARY_PATH=/PATH_TO_TORCHVISION/libtorchvsion.so

This is urgly, but it should work.

@smeet2804
Copy link

Hii @frankfliu ,
I installed torchvision but libtorchvision.so file is not present in the folder.

image

@frankfliu
Copy link
Contributor

@smeet2804 You need build from source: https://github.com/pytorch/vision

@smeet2804
Copy link

@frankfliu
I installed it from source using python setup.py install command but still can't locate the file.

@stu1130
Copy link
Contributor

stu1130 commented Oct 27, 2021

@smeet2804 what you need is c++ torchvision not python torchvision. The instructions are

mkdir build
cd build
# Add -DWITH_CUDA=on support for the CUDA if needed
cmake ..
make
make install

@smeet2804
Copy link

Thanks @stu1130 ,
I tried, but not able to run make command after cmake ... It gives make *** no targets specified and no makefile found. stop.
Don't know where I'm going wrong. I tried it on Windows 10 through anaconda prompt.

Lokiiiiii pushed a commit to Lokiiiiii/djl that referenced this issue Oct 10, 2023
Add GPTJ and GPTNeoX model to tests
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

4 participants