Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Unable to find data type for weight_name='/encoder/layer.0/attention/output/dense/MatMul_output_0' #1959

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
3 changes: 3 additions & 0 deletions optimum/onnxruntime/quantization.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from collections import defaultdict
from pathlib import Path
from typing import TYPE_CHECKING, Callable, Dict, List, Optional, Tuple, Union
from typing import Any

import onnx
from datasets import Dataset, load_dataset
Expand Down Expand Up @@ -286,6 +287,7 @@ def quantize(
calibration_tensors_range: Optional[Dict[str, Tuple[float, float]]] = None,
use_external_data_format: bool = False,
preprocessor: Optional[QuantizationPreprocessor] = None,
extra_options: Optional[Dict[str, Any]] = {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you set the default to None and then create an empty dict in the method please?
Dict as default value is not good because they are mutable.

) -> Path:
"""
Quantizes a model given the optimization specifications defined in `quantization_config`.
Expand Down Expand Up @@ -382,6 +384,7 @@ def quantize(
"AddQDQPairToWeight": quantization_config.qdq_add_pair_to_weight,
"DedicatedQDQPair": quantization_config.qdq_dedicated_pair,
"QDQOpTypePerChannelSupportToAxis": quantization_config.qdq_op_type_per_channel_support_to_axis,
**extra_options,
},
}

Expand Down