nncf icon indicating copy to clipboard operation
nncf copied to clipboard

set ignored scope widely

Open sooahleex opened this issue 2 years ago • 6 comments

Changes

set ignored_scope as op_addresses_to_skip too

Reason for changes

pruning consistently tried to apply to ignored scope

Related tickets

Tests

sooahleex avatar Jun 13 '22 06:06 sooahleex

Guys, looks like we were removed from nncf developers group. Please add me as an reviewer and don't merge this without our review!

Please run precommit tests before merge

cc: @negvet

daniil-lyakhov avatar Jun 13 '22 12:06 daniil-lyakhov

Guys, looks like we were removed from nncf developers group. Please add me as an reviewer and don't merge this without our review!

cc: @negved

Please request to join at this link: https://github.com/orgs/openvinotoolkit/teams/nncf_pytorch-maintainers/members

vinnamkim avatar Jun 13 '22 12:06 vinnamkim

Guys, looks like we were removed from nncf developers group. Please add me as an reviewer and don't merge this without our review! cc: @negved

Please request to join at this link: https://github.com/orgs/openvinotoolkit/teams/nncf_pytorch-maintainers/members

cc: @negvet

vinnamkim avatar Jun 13 '22 12:06 vinnamkim

@sooahleex, please provide an example of network with concat layer as a leaf. Looks like a problem in graph building part.

daniil-lyakhov avatar Jun 15 '22 15:06 daniil-lyakhov

@sooahleex, we already have mechanism for ignoring layers, it's implemented here: https://github.com/openvinotoolkit/nncf/blob/160990cba0473452955c494b2087c4f4160241c7/nncf/common/pruning/node_selector.py#L279-L305

it used at the last step of node selection here: https://github.com/openvinotoolkit/nncf/blob/160990cba0473452955c494b2087c4f4160241c7/nncf/common/pruning/node_selector.py#L218

It's essential to generate masks for each target node even if it's in a ignored scope because of the algorithm implementation. Ignoring layers during mask propagation could lead to inconsistent pruning layout!

daniil-lyakhov avatar Jun 15 '22 16:06 daniil-lyakhov

@sooahleex, we already have mechanism for ignoring layers, it's implemented here:

https://github.com/openvinotoolkit/nncf/blob/160990cba0473452955c494b2087c4f4160241c7/nncf/common/pruning/node_selector.py#L279-L305

it used at the last step of node selection here:

https://github.com/openvinotoolkit/nncf/blob/160990cba0473452955c494b2087c4f4160241c7/nncf/common/pruning/node_selector.py#L218

It's essential to generate masks for each target node even if it's in a ignored scope because of the algorithm implementation. Ignoring layers during mask propagation could lead to inconsistent pruning layout!

I knew that part and I checked that works out for mask propagation. When I tried to do pruning, the error is occurred in count_flops_and_weights_per_node for the layer which I added in ignored scopes. For the function count_flops_and_weights_per_node, There is no part to check whether it is prunable. So I added op_addresses_to_skip to check whether the layer is prunable or not.

sooahleex avatar Jun 16 '22 08:06 sooahleex