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 find duplicates in qconfig #1155

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

eladc-git
Copy link
Collaborator

@eladc-git eladc-git commented Aug 7, 2024

Pull Request Description:

Use names in is_match method only in tensorflow operations.

Checklist before requesting a review:

  • I set the appropriate labels on the pull request.
  • I have added/updated the release note draft (if necessary).
  • I have updated the documentation to reflect my changes (if necessary).
  • All function and files are well documented.
  • All function and classes have type hints.
  • There is a licenses in all file.
  • The function and variable names are informative.
  • I have checked for code duplications.
  • I have added new unittest (if necessary).

@eladc-git eladc-git requested a review from elad-c August 7, 2024 13:27
@eladc-git eladc-git added bug Something isn't working and removed auto:core labels Aug 7, 2024
@@ -553,7 +553,7 @@ 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:
if len(matching_qcos) > 1 and matching_qcos[0] != tpc.tp_model.default_qco:
Copy link
Collaborator

Choose a reason for hiding this comment

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

  1. Must the deafult be at index 0?
  2. Add a test to simulate it.

@@ -553,7 +553,7 @@ 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:
if len(matching_qcos) > 1 and matching_qcos[0] != tpc.tp_model.default_qco:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think that this solves the issue correctly.
I suspect that the case generating this issue is when there is a pytorch function that has two aliases, and that one of them appears in a TPC operation set and the other is not, thus returning the default qco.

Please try to reproduce the issue, identify the pytorch layer that has duplicate configs and let's think of a more robust solution.

Copy link

Stale pull request message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto:core bug Something isn't working no-pr-activity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

During PTQ, an error message "Found duplicate qco types!" occurs (quantization is successful)
3 participants