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

[python] Fix classification usage via OVMS #198

Merged
merged 4 commits into from
Sep 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions model_api/python/model_api/models/classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,16 @@ def __init__(self, inference_adapter, configuration=dict(), preload=False):
if self.output_raw_scores:
self.out_layer_names.append(self.raw_scores_name)
except (RuntimeError, AttributeError):
self.embedded_topk = False
self.out_layer_names = _get_non_xai_names(self.outputs.keys())
self.raw_scores_name = self.out_layer_names[0]
# exception means we have a non-ov model, or a model behind OVMS
# with already inserted softmax and topk
if self.embedded_processing and len(self.outputs) >= 2:
eunwoosh marked this conversation as resolved.
Show resolved Hide resolved
self.embedded_topk = True
self.out_layer_names = ["indices", "scores"]
self.raw_scores_name = _raw_scores_name
else: # likely a non-ov model
self.embedded_topk = False
self.out_layer_names = _get_non_xai_names(self.outputs.keys())
self.raw_scores_name = self.out_layer_names[0]

self.embedded_processing = True

Expand Down
Loading