DCHECK(kind_ == value_kind_symbolic_) failed
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 13.4k
- Forks
- 2.4k
- Avg merge
- 5d 3h
- Merged PRs (30d)
- 2
Description
Description
onnx to trt conversion fails for model with dynamic batch
Environment
TensorRT Version: 8.5.2.2
NVIDIA GPU: xavier nx
CUDA Version:12.2
Operating System: ubuntu 20.04
Python Version (if applicable): 3.12.4
Relevant Files
Model link: https://drive.google.com/file/d/13l9CUXUJOiHfth-ryRFtxuq7vlpm1Kur/view?usp=sharing
Steps To Reproduce
import numpy as np
from polygraphy.backend.trt import (
CreateConfig,
EngineFromNetwork,
NetworkFromOnnxPath,
SaveEngine,
TrtRunner,
Profile
)
onnx_model = "parseq_recognizer_fix_dynamicbatch.onnx"
profiles = [
Profile().add("input", min=(1, 3, 32, 128), opt=(1, 3, 32, 128), max=(1, 3, 32, 128)),
Profile().add("input", min=(1, 3, 32, 128), opt=(4, 3, 32, 128), max=(10, 3, 32, 128)),
Profile().add(
"input", min=(10, 3, 32, 128), opt=(10, 3, 32, 128), max=(10, 3, 32, 128)
),
]
def main():
inp_data = np.ones(shape=(1, 3, 32, 128), dtype=np.float32)
rsess = InferenceSession(onnx_model,
providers=["CUDAExecutionProvider"])
pred = rsess.run(None, {"input": inp_data})
print(pred)
build_engine = EngineFromNetwork(
NetworkFromOnnxPath(onnx_model), config=CreateConfig(fp16=False, profiles=profiles)
)
build_engine = SaveEngine(build_engine, path="parseq_test.engine")
with TrtRunner(build_engine) as runner:
outputs = runner.infer(feed_dict={"input": inp_data})
print(outputs)
if __name__ == "__main__":
main()
error:
[W] onnx2trt_utils.cpp:375: Your ONNX model has been generated with INT64 weights, while TensorRT does not natively support INT64. Attempting to cast down to INT32.
[W] onnx2trt_utils.cpp:403: One or more weights outside the range of INT32 was clamped
[W] Tensor DataType is determined at build time for tensors not marked as input or output.
[I] Configuring with profiles:[
Profile 0:
{input [min=(1, 3, 32, 128), opt=(1, 3, 32, 128), max=(1, 3, 32, 128)]},
Profile 1:
{input [min=(1, 3, 32, 128), opt=(4, 3, 32, 128), max=(10, 3, 32, 128)]},
Profile 2:
{input [min=(10, 3, 32, 128), opt=(10, 3, 32, 128), max=(10, 3, 32, 128)]}
]
[I] Building engine with configuration:
Flags | []
Engine Capability | EngineCapability.DEFAULT
Memory Pools | [WORKSPACE: 6854.28 MiB]
Tactic Sources | [CUBLAS, CUBLAS_LT, CUDNN, EDGE_MASK_CONVOLUTIONS, JIT_CONVOLUTIONS]
Profiling Verbosity | ProfilingVerbosity.DETAILED
Optimization Profiles | 3 profile(s)
[W] DLA requests all profiles have same min, max, and opt value. All dla layers are falling back to GPU
[W] Using PreviewFeature::kFASTER_DYNAMIC_SHAPES_0805 can help improve performance and resolve potential functional issues.
value.h:413: DCHECK(kind_ == value_kind_symbolic_) failed.
Aborted (core dumped)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by rerunning the provided Python reproduction with TensorRT 8.5.2.2, focusing on NetworkFromOnnxPath, Profile, CreateConfig, and EngineFromNetwork with the three dynamic-shape profiles. Trace the engine-build path around the value.h assertion and compare behavior with the supplied ONNX model. Done means the model builds without aborting under the reported profile configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100