fp8
执行ONNX模型的FP8 GEMM仅量化,并返回ONNX ModelProto。
函数
将INT8量化模型转换为FP8量化模型。 |
|
仅对ONNX文件应用FP8 GEMM量化。 |
- int8_to_fp8(onnx_path, verbose=False)
将INT8量化模型转换为FP8量化模型。
注意。此转换仅适用于最大校准的INT8模型。
- Parameters:
onnx_path (str) – INT8量化ONNX模型的路径。
verbose (bool) – 是否打印详细日志。
- Returns:
FP8量化的ONNX模型。
- Return type:
ModelProto
- quantize(onnx_path, calibration_method='max', calibration_data_reader=None, calibration_cache_path=None, calibration_shapes=None, calibration_eps=['cuda:0', 'cpu', 'trt'], op_types_to_quantize=None, op_types_to_exclude=None, nodes_to_quantize=None, nodes_to_exclude=None, use_external_data_format=True, intermediate_generated_files=[], verbose=False, trt_extra_plugin_lib_paths=None, high_precision_dtype='fp16', mha_accumulation_dtype='fp32')
仅对ONNX文件应用FP8 GEMM量化。
目前,支持 [‘Conv’, ‘Gemm’, ‘MatMul’] 量化。
- Parameters:
onnx_path (str) –
calibration_method (str) –
calibration_data_reader (CalibrationDataReader) –
calibration_cache_path (str) –
calibration_shapes (str) –
calibration_eps (List[str]) –
op_types_to_quantize (List[str]) –
op_types_to_exclude (List[str]) –
nodes_to_quantize (List[str]) –
nodes_to_exclude (List[str]) –
use_external_data_format (bool) –
intermediate_generated_files (List[str]) –
verbose (bool) –
trt_extra_plugin_lib_paths (str) –
high_precision_dtype (str) –
mha_accumulation_dtype (str) –
- Return type:
ModelProto