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

[Experimental] TorchFX PTQ backend #2764

Merged

Conversation

daniil-lyakhov
Copy link
Collaborator

@daniil-lyakhov daniil-lyakhov commented Jun 26, 2024

Changes

  • Torch FX experimental PTQ backend is presented (MinMax, FBC)
  • Torch metatypes are updated with new namespace: ATEN
  • Some Torch metatypes are updated by new operations names

Reason for changes

To begin the Torch FX backend development

Related tickets

141640
#2766

Tests

  • Resnet18 imagnette sanity test

@daniil-lyakhov daniil-lyakhov requested a review from alexsu52 June 26, 2024 09:00
@github-actions github-actions bot added NNCF PT Pull requests that updates NNCF PyTorch NNCF Common Pull request that updates NNCF Common experimental NNCF PTQ Pull requests that updates NNCF PTQ labels Jun 26, 2024
@daniil-lyakhov daniil-lyakhov force-pushed the dl/torch_fx_quantization_init branch 2 times, most recently from fbd0fd5 to cea1693 Compare June 26, 2024 09:31
@daniil-lyakhov daniil-lyakhov changed the title Torch FQ PTQ backend initialization TorchFX PTQ backend initialization Jun 26, 2024
@daniil-lyakhov daniil-lyakhov force-pushed the dl/torch_fx_quantization_init branch 4 times, most recently from 3fb62df to c818a93 Compare June 26, 2024 15:50
@daniil-lyakhov daniil-lyakhov marked this pull request as ready for review June 26, 2024 15:57
@daniil-lyakhov daniil-lyakhov requested a review from a team as a code owner June 26, 2024 15:57
@alexsu52 alexsu52 changed the title TorchFX PTQ backend initialization TorchFX PTQ backend Jun 27, 2024
Copy link
Contributor

@alexsu52 alexsu52 left a comment

Choose a reason for hiding this comment

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

It is curious that the developer does not quantize any operations in the torch.fx.GraphModule, but at the same time does not report errors that the torch backend does not support Torch FX.

Taking account that torch.fx is a part of torch and requires specific processing, I would like to make the following proposal:

  1. I agree to introduce TORCH_FX = "TorchFX" backend to simplify the factory code, but to simplify this PR you can skip adding support in nncf.quantize(). If you are going to do it you must warn the user that experimental code will be used.
  2. Make torch_fx as part of torch module. I mean nncf/experimental/torch_fx/ -> nncf/experimental/torch/fx/
  3. I suggest to use Torch GAs for TorchFX because requirements are the same and the backend is a part of Torch. In the future we may separate them, but only if we have problems with test completion times.

tests/torch_fx/helpers.py Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
nncf/common/graph/patterns/manager.py Outdated Show resolved Hide resolved
nncf/common/utils/backend.py Show resolved Hide resolved
nncf/experimental/torch/fx/engine.py Outdated Show resolved Hide resolved
nncf/experimental/torch/fx/model_transformer.py Outdated Show resolved Hide resolved
nncf/experimental/torch/fx/model_transformer.py Outdated Show resolved Hide resolved
nncf/experimental/torch/fx/model_transformer.py Outdated Show resolved Hide resolved
nncf/experimental/torch/fx/model_transformer.py Outdated Show resolved Hide resolved
@daniil-lyakhov daniil-lyakhov force-pushed the dl/torch_fx_quantization_init branch from 444cb64 to 20a4eda Compare July 23, 2024 10:18
@daniil-lyakhov daniil-lyakhov force-pushed the dl/torch_fx_quantization_init branch 2 times, most recently from c166088 to 1eabd17 Compare July 23, 2024 12:39
@daniil-lyakhov daniil-lyakhov changed the title TorchFX PTQ backend [Experimental] TorchFX PTQ backend Jul 24, 2024
Copy link
Contributor

@alexsu52 alexsu52 left a comment

Choose a reason for hiding this comment

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

LGTM

@daniil-lyakhov daniil-lyakhov force-pushed the dl/torch_fx_quantization_init branch from b6bd3fc to 3064753 Compare July 24, 2024 15:09
@daniil-lyakhov daniil-lyakhov force-pushed the dl/torch_fx_quantization_init branch from 3064753 to 826fed9 Compare July 25, 2024 12:50
@daniil-lyakhov daniil-lyakhov force-pushed the dl/torch_fx_quantization_init branch from 99b4344 to 3b4a992 Compare July 25, 2024 16:50
@alexsu52 alexsu52 merged commit d94b93b into openvinotoolkit:develop Jul 26, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
experimental NNCF Common Pull request that updates NNCF Common NNCF PT Pull requests that updates NNCF PyTorch NNCF PTQ Pull requests that updates NNCF PTQ
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants