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

Add Profiling tools for Onnx Engine #2471

Closed
dhrubo-os opened this issue Mar 20, 2023 · 2 comments · Fixed by #2472
Closed

Add Profiling tools for Onnx Engine #2471

dhrubo-os opened this issue Mar 20, 2023 · 2 comments · Fixed by #2472
Labels
enhancement New feature or request

Comments

@dhrubo-os
Copy link

dhrubo-os commented Mar 20, 2023

Description

DJL has profiler support for MXNet and PyTorch [REF]. I would like to request to extend this profiler support for ONNX engine also.

References

@dhrubo-os dhrubo-os added the enhancement New feature or request label Mar 20, 2023
@frankfliu
Copy link
Contributor

You can enable onnxruntime profiler using the following code:

            Path modelDir = Paths.get("YOUR_MODEL_DIR");
            Model model = Model.newInstance("my_model");
            OrtSession.SessionOptions ortOptions = new OrtSession.SessionOptions();
            ortOptions.enableProfiling("out.txt");
            Map<String, Object> options = new ConcurrentHashMap<>();
            options.put("sessionOptions", ortOptions);
            model.load(modelDir, "mymodel.onnx", options);

@frankfliu
Copy link
Contributor

See: #2472

With this PR, you can enable profiler in a more elegant way:

Criteria<Image, Classifications> criteria =
        Criteria.builder()
            .optOption("profilerOutput", "build/testOrtProfiling")
            ...
            .build()

@zachgk zachgk linked a pull request Mar 20, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants