47
47
from .utils import print_ops_info
48
48
49
49
50
- # Note: this is not meant as a primary API since it can create inconsistencies
51
- # if the quantizer here is different from the quantizer used to convert. It is
52
- # however useful for unit tests to separate the converted model from the fused
53
- # model, to be able to get reference numerics.
54
- # If this does not apply, please use quantize_and_fuse_pt2 instead.
55
- def convert_pt2 (
50
+ def prepare_and_convert_pt2 (
56
51
model : torch .nn .Module ,
57
52
inputs : tuple [object , ...],
58
53
quantizer : CadenceQuantizer ,
@@ -150,7 +145,7 @@ def quantize_pt2(
150
145
dump_graphs : bool = False ,
151
146
) -> torch .fx .GraphModule :
152
147
"""
153
- Prepare , convert and fuse the model using the given quantizer.
148
+ Trace, prepare , convert and fuse the model using the given quantizer.
154
149
If calibration data is provided, it will be used to calibrate the model. If
155
150
not, the inputs will be used for calibration instead, which is useful for
156
151
unit tests but should not be used for end-to-end use cases.
@@ -164,7 +159,7 @@ def quantize_pt2(
164
159
quantizer = CadenceDefaultQuantizer ()
165
160
166
161
# Get converted graph module
167
- converted_gm = convert_pt2 (
162
+ converted_gm = prepare_and_convert_pt2 (
168
163
model , inputs , quantizer , calibration_data , dump_graphs = dump_graphs
169
164
)
170
165
0 commit comments