You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was once working on a small project a year ago. I wanted to convert a model to tensorrt in python and run inference in c++, I was successful. Now with TensorRT 10 out I am facing problems. I am still successfully able to convert onnx to tensorrt and run inference in python api, but I am unsuccessful in loading the engine in TensorRT.
The code is left untouched, last time it worked, and as far as I know from TensorRT 8.6 to 10 the same code should work.
Perhaps it could be that now I am using Visual Studio 2022? Last time I was using windows/linux cmake and everything worked.
output: IRuntime::deserializeCudaEngine: Error Code 1: Internal Error (Unexpected call to stub loadRunner for ShuffleRunner.)
And also I tried to create the engine from the c++ api:
`
class Logger : public ILogger
{
void log(Severity severity, const char* msg) noexcept override
{
// suppress info-level messages
if (severity <= Severity::kWARNING)
std::cout << msg << std::endl;
}
} logger;
If config->setMemoryPoolLimit(MemoryPoolType::kWORKSPACE, 1U << 20) is uncommented then I also get outputs both for buildSerializedNetwork and buildEngineWithConfig: UNSUPPORTED_STATE: Skipping tactic 0 due to insufficient memory on requested size of 10616832 detected for tactic 0x0000000000000000.
Keep in mind that using python api I am successful in converting and running inference, but c++ api fails.
Could this be due to Visual Studio?
P. S. trtexec is also able to convert and run inference; The most important thing for me is to be able to run inference in c++, I can convert the engine in python
Thank you
Environment
TensorRT Version: 10.7
NVIDIA GPU: GTX 1660 Ti
NVIDIA Driver Version: 561.19
CUDA Version: 12.4
CUDNN Version: 8.9.7
Operating System: Windows 10
Visual Studio 2022
Python Version (if applicable): 3.10
PyTorch Version (if applicable): latest with cuda 12.4
The API usage looks fine to me, the errors suggest some environment issue:
[virtualMemoryBuffer.cpp::nvinfer1::StdVirtualMemoryBufferImpl::~StdVirtualMemoryBufferImpl::123] Error Code 1: Cuda Driver (TensorRT internal error)
UNSUPPORTED_STATE: Skipping tactic 0 due to insufficient memory on requested size of 10616832 detected for tactic 0x0000000000000000
Can you double check that your program in Visual Studio is linking properly to all the TensorRT and CUDA libraries?
Thank you for your answer. You see, there is not a lot of information on visual studio. Mostly everything is in CMake.
Here is how my imports look like, please tell me if you notice, that something should be changed:
Of course I should probably switch to cmake, but this is a very strange error, I am able to import libraries, create nvinfer1::IRuntime, but creating an engine fails.
As well as building from onnx a serialized tensorrt network is successful, but loading it fails.
Both times creating ICudaEngine fails
Description
I was once working on a small project a year ago. I wanted to convert a model to tensorrt in python and run inference in c++, I was successful. Now with TensorRT 10 out I am facing problems. I am still successfully able to convert onnx to tensorrt and run inference in python api, but I am unsuccessful in loading the engine in TensorRT.
The code is left untouched, last time it worked, and as far as I know from TensorRT 8.6 to 10 the same code should work.
Perhaps it could be that now I am using Visual Studio 2022? Last time I was using windows/linux cmake and everything worked.
`
std::tuple<nvinfer1::ICudaEngine*, nvinfer1::IExecutionContext*> load_feature_extractor(std::string engine_file_name)
{
std::cout << engine_file_name << std::endl;
std::ifstream file(engine_file_name, std::ios::binary | std::ios::ate);
if (!file) {
std::cout << "failed to load engine" << std::endl;
throw std::runtime_error("failed to load engine");
}
`
output:
IRuntime::deserializeCudaEngine: Error Code 1: Internal Error (Unexpected call to stub loadRunner for ShuffleRunner.)
And also I tried to create the engine from the c++ api:
`
class Logger : public ILogger
{
void log(Severity severity, const char* msg) noexcept override
{
// suppress info-level messages
if (severity <= Severity::kWARNING)
std::cout << msg << std::endl;
}
} logger;
IBuilder* builder = createInferBuilder(logger);
auto strt = 1U << static_cast<uint32_t>(NetworkDefinitionCreationFlag::kEXPLICIT_BATCH);
INetworkDefinition* network = builder->createNetworkV2(strt);
IParser* parser = createParser(*network, logger);
parser->parseFromFile("feature_extractor_tompnet_50.onnx",
static_cast<int32_t>(ILogger::Severity::kWARNING));
for (int32_t i = 0; i < parser->getNbErrors(); ++i)
{
std::cout << parser->getError(i)->desc() << std::endl;
}
`
The engine is successfully serialized, but loading still fails.
buildEngineWithConfig outputs:
Unexpected Internal Error: [virtualMemoryBuffer.cpp::nvinfer1::StdVirtualMemoryBufferImpl::~StdVirtualMemoryBufferImpl::123] Error Code 1: Cuda Driver (TensorRT internal error)
if I print all logs, I get:
If
config->setMemoryPoolLimit(MemoryPoolType::kWORKSPACE, 1U << 20)
is uncommented then I also get outputs both for buildSerializedNetwork and buildEngineWithConfig:UNSUPPORTED_STATE: Skipping tactic 0 due to insufficient memory on requested size of 10616832 detected for tactic 0x0000000000000000.
Keep in mind that using python api I am successful in converting and running inference, but c++ api fails.
Could this be due to Visual Studio?
P. S. trtexec is also able to convert and run inference; The most important thing for me is to be able to run inference in c++, I can convert the engine in python
Thank you
Environment
TensorRT Version: 10.7
NVIDIA GPU: GTX 1660 Ti
NVIDIA Driver Version: 561.19
CUDA Version: 12.4
CUDNN Version: 8.9.7
Operating System: Windows 10
Visual Studio 2022
Python Version (if applicable): 3.10
PyTorch Version (if applicable): latest with cuda 12.4
ONNX Model link:
https://drive.google.com/file/d/1S2O6FAm5tbzkbFUUIcuZiAmdSUcSSosa/view?usp=sharing
The text was updated successfully, but these errors were encountered: