-
Notifications
You must be signed in to change notification settings - Fork 240
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
[PT2] Introduce PT2OpLayerAttribute #3178
base: develop
Are you sure you want to change the base?
[PT2] Introduce PT2OpLayerAttribute #3178
Conversation
nncf/experimental/torch2/function_hook/nncf_graph/nncf_graph_builder.py
Outdated
Show resolved
Hide resolved
nncf/experimental/torch2/function_hook/nncf_graph/layer_attributes.py
Outdated
Show resolved
Hide resolved
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.
LGTM, only have a couple of questions:
""" | ||
if isinstance(meta, FunctionMeta): | ||
constant_port_ids = get_constant_port_ids(nx_graph, node) | ||
return PT2OpLayerAttributes(meta.func, meta.args, meta.kwargs, constant_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.
Why do we need both constant_port_ids
in PT2OpLayerAttributes
and weights_port_id
in the metatypes? https://github.com/openvinotoolkit/nncf/blob/develop/nncf/torch/graph/operator_metatypes.py#L207
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.
constant_port_ids
collects all constanat ports like weights and bias.
weights_port_id
needs to find only weight.
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.
Ok, there are models with constant subgraphs which contain linear layers (swin_v2), does you approach cover such cases? In torch FX such nodes have 3 constant inputs
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.
All 3 inputs marks as constants
Changes
PT2OpLayerAttribute
, to collect called function, attributes and constant portsFunctionMeta
stored function instead of function nameReason for changes
Needs to implement subgraph extractor for FBC
Related tickets
110974
Tests
tests/torch2/function_hook/nncf_graph/test_layer_attributes.py