File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- __version__ = "3.22.28 "
1+ __version__ = "3.22.29 "
22
33__all__ = [
44 "Backend" , "BackendV2" ,
@@ -2387,11 +2387,15 @@ def tensorrt_rtx(
23872387 fp16_network_path = f"{ os .path .join (dirname , basename )} _{ checksum } _fp16{ '_io' if fp16_io else '' } .onnx"
23882388 if not os .access (fp16_network_path , mode = os .R_OK ):
23892389 import onnx
2390- from onnxconverter_common .float16 import convert_float_to_float16
2391- model = onnx .load (network_path )
2392- with warnings .catch_warnings ():
2393- warnings .simplefilter ("ignore" )
2394- model = convert_float_to_float16 (model , keep_io_types = not fp16_io )
2390+ try :
2391+ from modelopt .onnx .autocast import convert_to_mixed_precision
2392+ model = convert_to_mixed_precision (network_path , keep_io_types = not fp16_io )
2393+ except Exception :
2394+ from onnxconverter_common .float16 import convert_float_to_float16
2395+ model = onnx .load (network_path )
2396+ with warnings .catch_warnings ():
2397+ warnings .simplefilter ("ignore" )
2398+ model = convert_float_to_float16 (model , keep_io_types = not fp16_io )
23952399 onnx .save (model , fp16_network_path )
23962400 network_path = fp16_network_path
23972401 elif fp16_io :
You can’t perform that action at this time.
0 commit comments