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

[Good First Issue][NNCF]: [TorchFX] Test MinMax algorithm #2872

Closed
daniil-lyakhov opened this issue Aug 6, 2024 · 10 comments
Closed

[Good First Issue][NNCF]: [TorchFX] Test MinMax algorithm #2872

daniil-lyakhov opened this issue Aug 6, 2024 · 10 comments
Assignees
Labels
good first issue Good for newcomers

Comments

@daniil-lyakhov
Copy link
Collaborator

daniil-lyakhov commented Aug 6, 2024

Greetings🐱! As a part of #2766 TorchFX PTQ backend support, we are gladly presenting to you following issue:

Implement TemplateTestMinMaxAlgorithm as it done for other backends(example: https://github.com/openvinotoolkit/nncf/blob/develop/tests/torch/ptq/test_min_max.py)

Example Pull Requests

#2856

Resources

Contact points

@daniil-lyakhov

Ticket

#2766

@daniil-lyakhov daniil-lyakhov added the good first issue Good for newcomers label Aug 6, 2024
@daniil-lyakhov daniil-lyakhov changed the title [Good First Issue][NNCF]: [Good First Issue][NNCF]: [TorchFX] Test MinMax algorithm Aug 6, 2024
@github-project-automation github-project-automation bot moved this to Contributors Needed in Good first issues Aug 6, 2024
@Patsnoop
Copy link

Patsnoop commented Aug 6, 2024

I'd like to work on this

@alexsu52 alexsu52 moved this from Contributors Needed to Assigned in Good first issues Aug 7, 2024
@daniil-lyakhov
Copy link
Collaborator Author

daniil-lyakhov commented Aug 22, 2024

Hi, @Patsnoop, do you still plan to contribute?

@Patsnoop
Copy link

Good Afternoon. Yes I do plan on working on this tomorrow and submitting this weekend.

@mlukasze
Copy link

hey @Patsnoop do you need any support here?

@rk119
Copy link
Contributor

rk119 commented Sep 29, 2024

Hi, is this issue being worked on? If not, I'd like to attempt this as well :)

Thank you.

@mlukasze
Copy link

@daniil-lyakhov please reassign

@daniil-lyakhov daniil-lyakhov assigned rk119 and unassigned Patsnoop Sep 30, 2024
@rk119
Copy link
Contributor

rk119 commented Sep 30, 2024

Hi @daniil-lyakhov,

I hope this isn't too basic of a question, but I wanted to clarify something. In the test_get_channel_axes_matmul_torch test in TemplateTestMinMaxAlgorithm, the doc string specifies that it is to "check MatMul quantization axes in MinMax for Torch". The test assigns layer attributes for the matmul node but I'm not sure why, when I inspected the torch and torch_fx MinMax algo code, the layer_attributes aren't really used, I even commented out the line of code and the tests still pass for both backends, is it safe to say that matmul layer attributes aren't necessary to be defined for Torch and Torch FX and that line of code can be removed from the template since only the node metatype is utilized or what exactly would you suggest?

Edit: Can get_conv_node_attrs, get_depthwiseconv_node_attrs and get_matmul_node_attrs be passed instead of returning Convolution and Linear layer attributes since they aren't necessary for Torch FX backend?

@daniil-lyakhov
Copy link
Collaborator Author

Hi @rk119,

Thank you for your observations! Please remove all the unused code and structures from the torch and torchFX test Min Max. And don't hesitate to open PRs and discuss ideas explicitly in the code

@rk119
Copy link
Contributor

rk119 commented Oct 1, 2024

@daniil-lyakhov Alright, will do so! :) I will open a PR soon for this issue.

@alexsu52 alexsu52 moved this from Assigned to In Review in Good first issues Oct 7, 2024
alexsu52 pushed a commit that referenced this issue Oct 7, 2024
### Changes

1. Added a new test file in tests/torch/fx. Implemented
`TemplateTestMinMaxAlgorithm` for Torch Fx backend.

2. Fixed a doc string mistake in
`tests/cross_fw/test_templates/test_min_max.py`. Removed the line of
code in the test `test_get_channel_axes_matmul_torch` that assigns the
matmul node's layer attributes.

3. Made changes to `tests/torch/ptq/test_min_max.py` to pass the
functions that handle backend-specific layer attributes.

### Reason for changes

For changes 2 and 3, only the node metatypes are required to test target
point shape and weight quantization channel axes.

### Related tickets

#2872
@alexsu52
Copy link
Contributor

alexsu52 commented Oct 7, 2024

Thanks for the contribution!

@alexsu52 alexsu52 closed this as completed Oct 7, 2024
@github-project-automation github-project-automation bot moved this from In Review to Closed in Good first issues Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
Archived in project
Development

No branches or pull requests

5 participants