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

Fix Smart Search when using OpenVINO #7389

Merged
merged 9 commits into from Feb 24, 2024

Conversation

agrawalsourav98
Copy link
Contributor

This PR fixes smart search when using OpenVINO. See discussion #6869

The issue is caused due to the following bug in upstream, see here and fixed by this.

As this is the part of the v1.17.0 release and the onnxruntime_openvino package has not been updated in a while, this PR fixes the issue by changing the dir to where the external_data is loaded before the onnxruntime session is created.

Copy link
Contributor

@mertalev mertalev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! There's a possible issue in that changing the cwd might be unsound if multiple models are loaded at the same time. Fortunately, we only allow one model to load at a time so this isn't an issue in practice.

machine-learning/app/models/base.py Outdated Show resolved Hide resolved
@agrawalsourav98
Copy link
Contributor Author

agrawalsourav98 commented Feb 24, 2024

Looks good! There's a possible issue in that changing the cwd might be unsound if multiple models are loaded at the same time. Fortunately, we only allow one model to load at a time so this isn't an issue in practice.

Yes, We can always remove this in the future once the package is updated to include the fix.

@mertalev
Copy link
Contributor

It looks like the tests need to be updated.

Also, I don't have an Intel device handy. Can you check if it works without the static_path stuff? It'd be nice if we could remove that if it isn't needed.

@agrawalsourav98
Copy link
Contributor Author

It looks like the tests need to be updated.

Also, I don't have an Intel device handy. Can you check if it works without the static_path stuff? It'd be nice if we could remove that if it isn't needed.

Just checked the onnxruntime changelog and openvino supports dynamic shapes since v1.15, so the static shapes might not be required, also verified loading the weights locally. I think we can also get rid of the external_data stuff entirely if none of the models exceed 2GiBs in a single file (protobuf limit).

@mertalev
Copy link
Contributor

Sweet, then let's just remove the code for static inputs.

I think we can also get rid of the external_data stuff entirely if none of the models exceed 2GiBs in a single file (protobuf limit).

Some models do exceed this, so not really an option.

@mertalev mertalev merged commit 2a75f88 into immich-app:main Feb 24, 2024
24 checks passed
@agrawalsourav98 agrawalsourav98 deleted the fix-openvino-clip-inference branch February 25, 2024 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants