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

Enable no-copy API in Model API OVMS Adapter to optimize Embedding endpoint #92

Merged
merged 12 commits into from
Nov 4, 2024

Conversation

atobiszei
Copy link
Collaborator

@atobiszei atobiszei commented Oct 29, 2024

OVMS_BUFFERTYPE_CPU,
NOT_USED_NUM));
}
for (const auto& [name, input_tensor] : output) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
for (const auto& [name, input_tensor] : output) {
for (const auto& [name, output_tensor] : output) {

if (std::find(outputsSet.begin(), outputsSet.end(), outputName) == outputsSet.end()) {
output.emplace(outputName, std::move(makeOvTensor(datatype, shape, dimCount, voutputData, bytesize)));
} else {
//output.emplace(outputName, input.at(outputName));
Copy link
Collaborator

Choose a reason for hiding this comment

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

?

Copy link
Collaborator

Choose a reason for hiding this comment

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

does it mean that we only get selected outputs?

@@ -213,6 +324,21 @@ ov::PartialShape OVMSInferenceAdapter::getInputShape(const std::string& inputNam
}
return ovShape;
}
ov::PartialShape OVMSInferenceAdapter::getOutputShape(const std::string& inputName) const {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
ov::PartialShape OVMSInferenceAdapter::getOutputShape(const std::string& inputName) const {
ov::PartialShape OVMSInferenceAdapter::getOutputShape(const std::string& outputName) const {

auto it = outShapesMinMaxes.find(inputName);
if (it == outShapesMinMaxes.end()) {
LOG(INFO) << "Could not find input:" << inputName;
throw std::runtime_error(std::string("Adapter could not find input:") + inputName);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
throw std::runtime_error(std::string("Adapter could not find input:") + inputName);
throw std::runtime_error(std::string("Adapter could not find output:") + outputName);

@@ -213,6 +324,21 @@ ov::PartialShape OVMSInferenceAdapter::getInputShape(const std::string& inputNam
}
return ovShape;
}
ov::PartialShape OVMSInferenceAdapter::getOutputShape(const std::string& inputName) const {
auto it = outShapesMinMaxes.find(inputName);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
auto it = outShapesMinMaxes.find(inputName);
auto it = outShapesMinMaxes.find(outputName);

@atobiszei atobiszei force-pushed the atobisze_mp_nocopy branch 6 times, most recently from 4de817b to d493e4e Compare October 31, 2024 09:39
@atobiszei atobiszei requested a review from dkalinowski October 31, 2024 14:06
if (std::find(outputsSet.begin(), outputsSet.end(), outputName) == outputsSet.end()) {
output.emplace(outputName, std::move(makeOvTensor(datatype, shape, dimCount, voutputData, bytesize)));
} else {
//output.emplace(outputName, input.at(outputName));
Copy link
Collaborator

Choose a reason for hiding this comment

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

This line should probably be removed

@atobiszei atobiszei merged commit 3f75121 into main Nov 4, 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

Successfully merging this pull request may close these issues.

3 participants