-
Notifications
You must be signed in to change notification settings - Fork 364
fix(//core/runtime): Support more delimiter variants #1004
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
Conversation
Signed-off-by: Naren Dasan <[email protected]> Signed-off-by: Naren Dasan <[email protected]>
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.
There are some changes that do not conform to C++ style guidelines:
diff --git a/workspace/core/runtime/TRTEngine.cpp b/tmp/changes.txt
index 5ba3a56..70b51e0 100644
--- a/workspace/core/runtime/TRTEngine.cpp
+++ b/tmp/changes.txt
@@ -63,7 +63,10 @@ TRTEngine::TRTEngine(std::string mod_name, std::string serialized_engine, CudaDe
auto delim = bind_name.find(".");
if (delim == std::string::npos) {
delim = bind_name.find("_");
- TORCHTRT_CHECK(delim != std::string::npos, "Unable to determine binding index for input " << bind_name << "\nEnsure module was compile with Torch-TensorRT.ts");
+ TORCHTRT_CHECK(
+ delim != std::string::npos,
+ "Unable to determine binding index for input " << bind_name
+ << "\nEnsure module was compile with Torch-TensorRT.ts");
}
std::string idx_s = bind_name.substr(delim + 1);
@@ -97,16 +100,16 @@ std::string TRTEngine::to_str() const {
ss << " Name: " << name << std::endl;
ss << " Inputs: [" << std::endl;
for (uint64_t i = 0; i < num_io.first; i++) {
- ss << " id: " << i << std::endl;
- ss << " shape: " << exec_ctx->getBindingDimensions(i) << std::endl;
- ss << " dtype: " << util::TRTDataTypeToScalarType(exec_ctx->getEngine().getBindingDataType(i)) << std::endl;
+ ss << " id: " << i << std::endl;
+ ss << " shape: " << exec_ctx->getBindingDimensions(i) << std::endl;
+ ss << " dtype: " << util::TRTDataTypeToScalarType(exec_ctx->getEngine().getBindingDataType(i)) << std::endl;
}
ss << " ]" << std::endl;
ss << " Outputs: [" << std::endl;
for (uint64_t o = 0; o < num_io.second; o++) {
- ss << " id: " << o << std::endl;
- ss << " shape: " << exec_ctx->getBindingDimensions(o) << std::endl;
- ss << " dtype: " << util::TRTDataTypeToScalarType(exec_ctx->getEngine().getBindingDataType(o)) << std::endl;
+ ss << " id: " << o << std::endl;
+ ss << " shape: " << exec_ctx->getBindingDimensions(o) << std::endl;
+ ss << " dtype: " << util::TRTDataTypeToScalarType(exec_ctx->getEngine().getBindingDataType(o)) << std::endl;
}
ss << " ]" << std::endl;
ss << " Device: " << device_info << std::endl;
ERROR: Some files do not conform to style guidelines
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.
Code conforms to Python style guidelines
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.
Code conforms to Python style guidelines
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.
There are some changes that do not conform to C++ style guidelines:
diff --git a/workspace/core/runtime/TRTEngine.cpp b/tmp/changes.txt
index 5ba3a56..70b51e0 100644
--- a/workspace/core/runtime/TRTEngine.cpp
+++ b/tmp/changes.txt
@@ -63,7 +63,10 @@ TRTEngine::TRTEngine(std::string mod_name, std::string serialized_engine, CudaDe
auto delim = bind_name.find(".");
if (delim == std::string::npos) {
delim = bind_name.find("_");
- TORCHTRT_CHECK(delim != std::string::npos, "Unable to determine binding index for input " << bind_name << "\nEnsure module was compile with Torch-TensorRT.ts");
+ TORCHTRT_CHECK(
+ delim != std::string::npos,
+ "Unable to determine binding index for input " << bind_name
+ << "\nEnsure module was compile with Torch-TensorRT.ts");
}
std::string idx_s = bind_name.substr(delim + 1);
@@ -97,16 +100,16 @@ std::string TRTEngine::to_str() const {
ss << " Name: " << name << std::endl;
ss << " Inputs: [" << std::endl;
for (uint64_t i = 0; i < num_io.first; i++) {
- ss << " id: " << i << std::endl;
- ss << " shape: " << exec_ctx->getBindingDimensions(i) << std::endl;
- ss << " dtype: " << util::TRTDataTypeToScalarType(exec_ctx->getEngine().getBindingDataType(i)) << std::endl;
+ ss << " id: " << i << std::endl;
+ ss << " shape: " << exec_ctx->getBindingDimensions(i) << std::endl;
+ ss << " dtype: " << util::TRTDataTypeToScalarType(exec_ctx->getEngine().getBindingDataType(i)) << std::endl;
}
ss << " ]" << std::endl;
ss << " Outputs: [" << std::endl;
for (uint64_t o = 0; o < num_io.second; o++) {
- ss << " id: " << o << std::endl;
- ss << " shape: " << exec_ctx->getBindingDimensions(o) << std::endl;
- ss << " dtype: " << util::TRTDataTypeToScalarType(exec_ctx->getEngine().getBindingDataType(o)) << std::endl;
+ ss << " id: " << o << std::endl;
+ ss << " shape: " << exec_ctx->getBindingDimensions(o) << std::endl;
+ ss << " dtype: " << util::TRTDataTypeToScalarType(exec_ctx->getEngine().getBindingDataType(o)) << std::endl;
}
ss << " ]" << std::endl;
ss << " Device: " << device_info << std::endl;
ERROR: Some files do not conform to style guidelines
Signed-off-by: Naren Dasan <[email protected]> Signed-off-by: Naren Dasan <[email protected]>
78f808b
to
1c3c779
Compare
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.
There are some changes that do not conform to C++ style guidelines:
diff --git a/workspace/core/runtime/TRTEngine.cpp b/tmp/changes.txt
index 5ba3a56..70b51e0 100644
--- a/workspace/core/runtime/TRTEngine.cpp
+++ b/tmp/changes.txt
@@ -63,7 +63,10 @@ TRTEngine::TRTEngine(std::string mod_name, std::string serialized_engine, CudaDe
auto delim = bind_name.find(".");
if (delim == std::string::npos) {
delim = bind_name.find("_");
- TORCHTRT_CHECK(delim != std::string::npos, "Unable to determine binding index for input " << bind_name << "\nEnsure module was compile with Torch-TensorRT.ts");
+ TORCHTRT_CHECK(
+ delim != std::string::npos,
+ "Unable to determine binding index for input " << bind_name
+ << "\nEnsure module was compile with Torch-TensorRT.ts");
}
std::string idx_s = bind_name.substr(delim + 1);
@@ -97,16 +100,16 @@ std::string TRTEngine::to_str() const {
ss << " Name: " << name << std::endl;
ss << " Inputs: [" << std::endl;
for (uint64_t i = 0; i < num_io.first; i++) {
- ss << " id: " << i << std::endl;
- ss << " shape: " << exec_ctx->getBindingDimensions(i) << std::endl;
- ss << " dtype: " << util::TRTDataTypeToScalarType(exec_ctx->getEngine().getBindingDataType(i)) << std::endl;
+ ss << " id: " << i << std::endl;
+ ss << " shape: " << exec_ctx->getBindingDimensions(i) << std::endl;
+ ss << " dtype: " << util::TRTDataTypeToScalarType(exec_ctx->getEngine().getBindingDataType(i)) << std::endl;
}
ss << " ]" << std::endl;
ss << " Outputs: [" << std::endl;
for (uint64_t o = 0; o < num_io.second; o++) {
- ss << " id: " << o << std::endl;
- ss << " shape: " << exec_ctx->getBindingDimensions(o) << std::endl;
- ss << " dtype: " << util::TRTDataTypeToScalarType(exec_ctx->getEngine().getBindingDataType(o)) << std::endl;
+ ss << " id: " << o << std::endl;
+ ss << " shape: " << exec_ctx->getBindingDimensions(o) << std::endl;
+ ss << " dtype: " << util::TRTDataTypeToScalarType(exec_ctx->getEngine().getBindingDataType(o)) << std::endl;
}
ss << " ]" << std::endl;
ss << " Device: " << device_info << std::endl;
ERROR: Some files do not conform to style guidelines
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.
Code conforms to Python style guidelines
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.
There are some changes that do not conform to C++ style guidelines:
diff --git a/workspace/core/runtime/TRTEngine.cpp b/tmp/changes.txt
index 5ba3a56..70b51e0 100644
--- a/workspace/core/runtime/TRTEngine.cpp
+++ b/tmp/changes.txt
@@ -63,7 +63,10 @@ TRTEngine::TRTEngine(std::string mod_name, std::string serialized_engine, CudaDe
auto delim = bind_name.find(".");
if (delim == std::string::npos) {
delim = bind_name.find("_");
- TORCHTRT_CHECK(delim != std::string::npos, "Unable to determine binding index for input " << bind_name << "\nEnsure module was compile with Torch-TensorRT.ts");
+ TORCHTRT_CHECK(
+ delim != std::string::npos,
+ "Unable to determine binding index for input " << bind_name
+ << "\nEnsure module was compile with Torch-TensorRT.ts");
}
std::string idx_s = bind_name.substr(delim + 1);
@@ -97,16 +100,16 @@ std::string TRTEngine::to_str() const {
ss << " Name: " << name << std::endl;
ss << " Inputs: [" << std::endl;
for (uint64_t i = 0; i < num_io.first; i++) {
- ss << " id: " << i << std::endl;
- ss << " shape: " << exec_ctx->getBindingDimensions(i) << std::endl;
- ss << " dtype: " << util::TRTDataTypeToScalarType(exec_ctx->getEngine().getBindingDataType(i)) << std::endl;
+ ss << " id: " << i << std::endl;
+ ss << " shape: " << exec_ctx->getBindingDimensions(i) << std::endl;
+ ss << " dtype: " << util::TRTDataTypeToScalarType(exec_ctx->getEngine().getBindingDataType(i)) << std::endl;
}
ss << " ]" << std::endl;
ss << " Outputs: [" << std::endl;
for (uint64_t o = 0; o < num_io.second; o++) {
- ss << " id: " << o << std::endl;
- ss << " shape: " << exec_ctx->getBindingDimensions(o) << std::endl;
- ss << " dtype: " << util::TRTDataTypeToScalarType(exec_ctx->getEngine().getBindingDataType(o)) << std::endl;
+ ss << " id: " << o << std::endl;
+ ss << " shape: " << exec_ctx->getBindingDimensions(o) << std::endl;
+ ss << " dtype: " << util::TRTDataTypeToScalarType(exec_ctx->getEngine().getBindingDataType(o)) << std::endl;
}
ss << " ]" << std::endl;
ss << " Device: " << device_info << std::endl;
ERROR: Some files do not conform to style guidelines
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.
Code conforms to Python style guidelines
@narendasan looks good, however, I rebased locally it still cannot resolve the issue that I have now. There is no delimiter such as '.' or '_' in the bind_name that I get in the model, maybe I still need to look into what happens in this model. |
We need inputs to have an index because tensorrt does not guarantee binding order. So you will need to modify whatever is coming in to have indexes |
I checked the log where we have this in conversion process:
it seems that we have input_0, then there comes serialization and deserialization, after deserialization the binding name became |
The binding is just 0? |
yes. |
hmm there is something odd there i feel. I would expect that the name would be input_0 or something |
Signed-off-by: Naren Dasan <[email protected]> Signed-off-by: Naren Dasan <[email protected]>
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.
Code conforms to Python style guidelines
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.
Code conforms to C++ style guidelines
/blossom-ci |
deserialization NOTE: This does not fully address the deserialization issue as the root cause is TensorRT modifies the input binding names which is leading to these cases of stoi errors. Signed-off-by: Naren Dasan <[email protected]> Signed-off-by: Naren Dasan <[email protected]>
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.
Code conforms to Python style guidelines
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.
There are some changes that do not conform to C++ style guidelines:
diff --git a/workspace/core/runtime/TRTEngine.cpp b/tmp/changes.txt
index dbef11b..26c755c 100644
--- a/workspace/core/runtime/TRTEngine.cpp
+++ b/tmp/changes.txt
@@ -66,8 +66,9 @@ TRTEngine::TRTEngine(std::string mod_name, std::string serialized_engine, CudaDe
delim = bind_name.find("_");
TORCHTRT_CHECK(
delim != std::string::npos,
- "Unable to determine binding index for input " << bind_name
- << "\nEnsure module was compiled with Torch-TensorRT.ts or follows Torch-TensorRT Runtime conventions");
+ "Unable to determine binding index for input "
+ << bind_name
+ << "\nEnsure module was compiled with Torch-TensorRT.ts or follows Torch-TensorRT Runtime conventions");
}
std::string idx_s = bind_name.substr(delim + 1);
ERROR: Some files do not conform to style guidelines
30cb548
to
65af9d1
Compare
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.
Code conforms to C++ style guidelines
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.
Code conforms to Python style guidelines
Description
Fixes an issue where different classes of delimiters would not properly be handled when deserializing TRT engines.
Fixes #930
Fixes #982
Type of change
Please delete options that are not relevant and/or add your own.
Checklist: