File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -236,11 +236,12 @@ def quantize_activations(
236
236
cleanup_memory ()
237
237
238
238
# Pass through calibration data to measure activation scales
239
- with tqdm .tqdm (total = calibration_tokens .shape [0 ], desc = "Calibrating activation scales" ) as pbar :
240
- for row_idx in range (calibration_tokens .shape [0 ]):
241
- model (calibration_tokens [row_idx ].reshape (1 , - 1 ))
242
- cleanup_memory ()
243
- pbar .update (1 )
239
+ with torch .inference_mode ():
240
+ with tqdm .tqdm (total = calibration_tokens .shape [0 ], desc = "Calibrating activation scales" ) as pbar :
241
+ for row_idx in range (calibration_tokens .shape [0 ]):
242
+ model (calibration_tokens [row_idx ].reshape (1 , - 1 ))
243
+ cleanup_memory ()
244
+ pbar .update (1 )
244
245
245
246
# Replace dynamic quantizer observer with StaticLinear for export
246
247
for name , quantizer in model .named_modules ():
You can’t perform that action at this time.
0 commit comments