-
Notifications
You must be signed in to change notification settings - Fork 246
feat: Client-side input shape/element validation #742
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
base: main
Are you sure you want to change the base?
Changes from 7 commits
3178f99
7210d00
9c2941b
b4c6a17
e5e6b7e
07059a6
8b699c0
60f3f52
2a5c507
6b56c3b
223b9d8
a9a2c1c
a584741
5889b8e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| // Copyright 2020-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| // Copyright 2020-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| // | ||
| // Redistribution and use in source and binary forms, with or without | ||
| // modification, are permitted provided that the following conditions | ||
|
|
@@ -26,6 +26,10 @@ | |
|
|
||
| #include "common.h" | ||
|
|
||
| #include <numeric> | ||
|
|
||
| #include "triton/common/model_config.h" | ||
|
|
||
| namespace triton { namespace client { | ||
|
|
||
| //============================================================================== | ||
|
|
@@ -232,6 +236,26 @@ InferInput::SetBinaryData(const bool binary_data) | |
| return Error::Success; | ||
| } | ||
|
|
||
| Error | ||
| InferInput::ValidateData() const | ||
|
||
| { | ||
| inference::DataType datatype = | ||
| triton::common::ProtocolStringToDataType(datatype_); | ||
| // String inputs will be checked at core and backend to reduce overhead. | ||
| if (datatype == inference::DataType::TYPE_STRING) { | ||
| return Error::Success; | ||
| } | ||
|
|
||
| int64_t expected_byte_size = triton::common::GetByteSize(datatype, shape_); | ||
yinggeh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| if ((int64_t)byte_size_ != expected_byte_size) { | ||
| return Error( | ||
| "input '" + name_ + "' got unexpected byte size " + | ||
| std::to_string(byte_size_) + ", expected " + | ||
| std::to_string(expected_byte_size)); | ||
| } | ||
| return Error::Success; | ||
| } | ||
|
|
||
| Error | ||
| InferInput::PrepareForRequest() | ||
| { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't proto-library used for protobuf<->grpc? Why is it needed for HTTP client?
edit: guessing the requirement is here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any concerns with introducing the new protobuf dependency to the HTTP client, or any alternatives? CC @GuanLuo @tanmayv25