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 duplicate QCOs issue #1282

Merged
merged 1 commit into from
Dec 1, 2024
Merged
Show file tree
Hide file tree
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
7 changes: 4 additions & 3 deletions model_compression_toolkit/core/common/graph/base_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,9 +556,10 @@ def get_qco(self, tpc: TargetPlatformCapabilities) -> QuantizationConfigOptions:
# Extract qco with is_match_type to overcome mismatch of function types in TF 2.15
matching_qcos = [_qco for _type, _qco in tpc.layer2qco.items() if self.is_match_type(_type)]
if matching_qcos:
if len(matching_qcos) > 1:
Logger.error('Found duplicate qco types!')
return matching_qcos[0]
if all([_qco == matching_qcos[0] for _qco in matching_qcos]):
return matching_qcos[0]
else:
Logger.critical(f"Found duplicate qco types for node '{self.name}' of type '{self.type}'!") # pragma: no cover
return tpc.tp_model.default_qco

def filter_node_qco_by_graph(self, tpc: TargetPlatformCapabilities,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,5 @@ def is_match_type(self, _type: Type) -> bool:
Whether _type matches the self node type

"""
names_match = _type.__name__ == self.type.__name__ if FOUND_TF else False
names_match = _type.__name__ == self.type.__name__
return super().is_match_type(_type) or names_match