File tree Expand file tree Collapse file tree 2 files changed +1
-1
lines changed
modelopt/torch/quantization/plugins Expand file tree Collapse file tree 2 files changed +1
-1
lines changed Original file line number Diff line number Diff line change @@ -82,7 +82,6 @@ def forward_loop(model):
82
82
83
83
84
84
# Quantize the model in-place; The model should be unwrapped from any distributed wrapper
85
- # The model may be wrapped in a DataParallel or DistributedDataParallel after `mtq.quantize`
86
85
model = mtq.quantize(model, mtq.INT8_DEFAULT_CFG , forward_loop)
87
86
88
87
# Save the modelopt quantizer states
Original file line number Diff line number Diff line change @@ -195,6 +195,7 @@ def _restore_modelopt_state_with_weights(self):
195
195
def _quantize_model (self ):
196
196
"""Quantize the model. Restore the quantization state if it exists."""
197
197
dataset = self .train_dataset if self .train_dataset is not None else self .eval_dataset
198
+ assert dataset is not None , "Calibration requires either eval or train dataset."
198
199
num_samples = min (self .quant_args .calib_size , len (dataset )) # type: ignore [union-attr]
199
200
dataset = torch .utils .data .Subset (dataset , list (range (num_samples )))
200
201
data_loader = self .get_eval_dataloader (dataset )
You can’t perform that action at this time.
0 commit comments