-
Notifications
You must be signed in to change notification settings - Fork 249
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
[MinMax] Embedding nodes as input nodes for inference graph #3320
base: develop
Are you sure you want to change the base?
[MinMax] Embedding nodes as input nodes for inference graph #3320
Conversation
9689dca
to
0a2f240
Compare
@@ -50,6 +51,7 @@ | |||
from nncf.torch.quantization.layers import BaseQuantizer | |||
from nncf.torch.quantization.layers import PTQuantizerSpec | |||
from nncf.torch.quantization.layers import get_scale_shape | |||
from nncf.torch.utils import get_weight_nodes_in_inference_grpah |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from nncf.torch.utils import get_weight_nodes_in_inference_grpah | |
from nncf.torch.utils import get_weight_nodes_in_inference_graph |
nncf/torch/utils.py
Outdated
@@ -467,3 +470,46 @@ def get_model_dtype(model: torch.nn.Module) -> torch.dtype: | |||
# The model had no parameters at all, assume FP32 | |||
dtype = torch.float32 | |||
return dtype | |||
|
|||
|
|||
def get_weight_nodes_in_inference_grpah( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def get_weight_nodes_in_inference_grpah( | |
def get_weight_nodes_in_inference_graph( |
@@ -86,7 +86,6 @@ def quantize_impl( | |||
advanced_parameters=advanced_parameters, | |||
) | |||
|
|||
# To make it easier for bias correction algorithms. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this comment removed?
nncf/torch/utils.py
Outdated
|
||
# Inference graph does not containt constans, so | ||
# any missed input edge means it is a constant branch. | ||
return node.metatype in [om.PTMatMulMetatype, om.PTAddmmMetatype] and len( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use variables to make it more readable
nncf/torch/utils.py
Outdated
# any missed input edge means it is a constant branch. | ||
return node.metatype in [om.PTMatMulMetatype, om.PTAddmmMetatype] and len( | ||
inference_nncf_graph.get_input_edges(node) | ||
) < len(node.metatype.weight_port_ids) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it work for possible missed inputs, that determinate in get_nodes_with_missed_input_edges?
nncf/torch/utils.py
Outdated
|
||
|
||
def get_weight_nodes_in_inference_grpah( | ||
inference_nncf_graph: NNCFGraph, mat_mul_metatypes: List[om.PTOperatorMetatype] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like mat_mul_metatypes expected always same value, mat_mul_metatypes should not be used as argument instead use reusable constant variable
Co-authored-by: Alexander Dokuchaev <alexander.dokuchaev@intel.com>
Reopen of the #2862
Changes
get_weight_nodes
method is updated to work with the inference graphOpenVINOQuantizer
and FXnncf.quantize
implementationReason for changes
Related tickets
163025
Tests