NVIDIA / NVIDIA/TensorRT

What is recommended way to convert into fp16 from fp32

Open
#4,656 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

I have a modernbert model in fp32 and I want to convert it into fp16 while keeping embedding layer and classifier layer in fp32. What are the recommended way to do it?
It seems to be layerOutputTypes function but I could not find Python API and it is gone in 10.12?

tensorrt.BuilderFlag.FP16 is said to be Deprecated in TensorRT 10.12. https://docs.nvidia.com/deeplearning/tensorrt/latest/_static/python-api/infer/Core/BuilderConfig.html#tensorrt.BuilderFlag
What is the alternative? It said strong typing superseded. Do you have example?

  • I am in 10.13, actually it still works.

Thanks so much!

Environment

TensorRT Version:

NVIDIA GPU: L40S

NVIDIA Driver Version:

CUDA Version:

CUDNN Version:

Operating System:

Python Version (if applicable):

Tensorflow Version (if applicable):

PyTorch Version (if applicable):

Baremetal or Container (if so, version):

Relevant Files

Model link:

Steps To Reproduce

Commands or scripts:

Have you tried the latest release?:

Attach the captured .json and .bin files from TensorRT's API Capture tool if you're on an x86_64 Unix system

Can this model run on other frameworks? For example run ONNX model with ONNXRuntime (polygraphy run <model.onnx> --onnxrt):

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 reviewing the TensorRT Python API around layerOutputTypes, BuilderFlag.FP16, and strong typing, using the linked BuilderConfig documentation as the entry point. Clarify how TensorRT 10.13 handles FP32-to-FP16 conversion while retaining FP32 embedding and classifier layers; done means a documented recommendation and runnable example.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.