Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions backends/qualcomm/export_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ def build_executorch_binary(
model: torch.nn.Module, # noqa: B006
qnn_config: QnnConfig,
file_name: str,
dataset: List[torch.Tensor] | Callable[[torch.fx.GraphModule], None],
dataset: List[Tuple[torch.Tensor, ...]],
quant_dtype: Optional[QuantDtype] = None,
custom_quantizer: Optional[QnnQuantizer] = None,
metadata=None,
Expand All @@ -520,7 +520,7 @@ def build_executorch_binary(
model (torch.nn.Module): The model to be converted into an ExecuTorch binary.
qnn_config: (QnnConfig): A config class that saves qnn lowering and execution configuration.
file_name (str): Name for the output binary file (.pte).
dataset (List[torch.Tensor] | Callable): A dataset for quantization calibration.
dataset (List[Tuple[torch.Tensor, ...]]): A dataset for quantization calibration.
quant_dtype (QuantDtype, optional): Data type for quantization.
custom_quantizer (Callable, optional): Custom quantizer.
metadata (dict, optional): An optional dictionary that maps each method name to a constant value in eager mode.
Expand Down Expand Up @@ -961,9 +961,6 @@ def _ptq_calibrate(captured_model, quantizer, dataset):
annotated_model = prepare_pt2e(captured_model, quantizer)
print("Quantizing(PTQ) the model...")
# calibration
if callable(dataset):
dataset(annotated_model)
else:
for data in dataset:
annotated_model(*data)
for data in dataset:
annotated_model(*data)
return annotated_model
Loading