This repository was archived by the owner on Nov 17, 2023. It is now read-only.
[Dummy] nan output by tensorrt #19746
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is used to reproduce the
nanoutput issue when running inference of mxnet's bert onnx export on tensor rt in fp 16 mode #19747Steps to export bert to onnx:
pip install -e python/onnx==1.6.0 onnx-simplifier onnxruntime==1.6.0 gluonnlpcd export_bertexport_bert.pyto togglepretrained=True/Falseand specifybatchandseq_lengthpython export_bert.py --layer=3to export the model.bert_modelfolder and use the*_sim.onnxonnx export file. This is the final output graph which has been optimized byonnx-simplifierSteps to build trt engine from onnx file and run inference
pip install onnxruntimebuild_trt.pyandinfer_trt.pyand the onnx files into the containerbuild_trt.pyto specify onnx input and trt output path and dopython build_trt_pyinfer_trt.pyto specify onnx and trt path and batch and seq_length and dopython infer_trt_pyProvided trt files
I have also included two trt files that I generated by following the above steps so you can cut to step 5 above.
mx_bert_layer3_simp_1_16_pre.trtmeans BS 1 SeqLen 16 pretrained=Truemx_bert_layer3_simp_1_17_pre.trtmeans BS 1 SeqLen 17 pretrained=True