NVIDIA / NVIDIA/TensorRT

Is there any why to make safe trt fp16 conversion according the torch AMP training process

Open
#4,662 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Module:Quantization
Dominant language
C++
Stars
13.4k
Forks
2.4k
Avg merge
5d 3h
Merged PRs (30d)
2

Description

After converting the ONNX fp32 model to a TensorRT fp16 model, numerical overflow occurred during inference. The model was trained using the PyTorch framework with automatic mixed precision, and the ONNX fp32 model inference works normally. Therefore, it may be necessary to manually specify certain model layers to maintain fp32 precision. Is it possible to determine whether the TensorRT operations related to this operator are full precision based on the parameter types used in the mixed precision training process of the PyTorch model? How can this be carried out?

We had tried keep some classical layers fp32, like Softmax, LayerNorm, Sigmoid, .... with no luck.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the numerical overflow during TensorRT FP16 inference and compare it with the working ONNX FP32 inference from the PyTorch AMP-trained model. Investigate whether the affected TensorRT operators can be identified from the model’s mixed-precision parameter types and verify any proposed precision assignments against the listed Softmax, LayerNorm, and Sigmoid cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.