-
Notifications
You must be signed in to change notification settings - Fork 2.3k
FP16 output wrong of TensorRT 8.6.1 when running GFPGAN on GPU 3070 #3257
Description
Description
I tried to convert GFPGAN onnx model to tensorrt. When using FP32, the output is correct. But when using FP16, the output is totally wrong. And I saw some warning may affect the accuracy.
[08/23/2023-11:38:45] [TRT] [W] TensorRT encountered issues when converting weights between types and that could affect accuracy.
[08/23/2023-11:38:45] [TRT] [W] If this is not the desired behavior, please modify the weights or retrain with regularization to adjust the magnitude of the weights.
[08/23/2023-11:38:45] [TRT] [W] Check verbose logs for the list of affected weights.
[08/23/2023-11:38:45]
Thus, I set thoese layer weights to FP32 explicitly. Most of those weights can work, but still some layer weights not working lbecause of ConstShuffleFusion. Thus, the FP16 engine still get the wrong output. Actually, I dont sure this is the real reason.
Running: ConstShuffleFusion on onnx::Add_738
ConstShuffleFusion: Fusing onnx::Add_738 with (Unnamed Layer* 602) [Shuffle]
Environment
TensorRT Version: 8.6.1
NVIDIA GPU: 3070
NVIDIA Driver Version: 525.125.06
CUDA Version: 11.3
CUDNN Version: 8
Operating System: ubuntu 20.04
Relevant Files
Model link:
https://drive.google.com/file/d/1a80j94FVcHjVBkVQ6jvdRucjvTFi3JYy/view?usp=sharing
Log before Set layer FP32:
https://drive.google.com/file/d/1qXPLsxs2LNJO0CsnRNEOweY4-My4bdfd/view?usp=sharing
Log After Set layer FP32:
https://drive.google.com/file/d/1csq6NyNuTcE7vhAkiTuH9F-SCHsqQ1k9/view?usp=sharing
Steps To Reproduce
Commands or scripts: ./trtexec --onnx=GFPGANv1.3.onnx --saveEngine=GFPGANv1.3.trt --workspace=10000 --fp16 --verbose
Have you tried the latest release?: yes
Can this model run on other frameworks? For example run ONNX model with ONNXRuntime (polygraphy run <model.onnx> --onnxrt): yes