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

[PTQ][OV] Sequential models support for Engine by TensorCollectorAdapter #16

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

daniil-lyakhov
Copy link
Owner

@daniil-lyakhov daniil-lyakhov commented May 15, 2023

Changes

  • Sequential dataset with correspondent changes in engine in OV is presented: now user can specify two functions:
    ** get_tokens_from_sequence_func
    ** fill_sequential_inputs_fn
    to infer sequential a model

  • New TensorCollectorAdapters are presented: now TensorAggregator can alter logic of statistic collection by specifying rules for reduction and aggregation

Reason for changes

  • To allow quantization of sequential models
  • TensorReducersSequence is needed to reduce statistics of sequential model: first reducer applies for each element in sample, second reducer applies on reduced element of each element

Related tickets

110654

Tests

Not yet

@daniil-lyakhov daniil-lyakhov changed the title Dl/ov/engine sequential models support [PTQ][OV] Sequential models support for Engine May 15, 2023
@daniil-lyakhov daniil-lyakhov force-pushed the dl/ov/engine_sequential_models_support branch from 1c0426f to 54732d0 Compare May 16, 2023 11:43
@daniil-lyakhov daniil-lyakhov force-pushed the dl/ov/engine_sequential_models_support branch 10 times, most recently from 239474d to 43eb6bc Compare May 16, 2023 12:46
@daniil-lyakhov
Copy link
Owner Author

@alexsu52, @KodiaqQ, @l-bat, @kshpv, @andrey-churkin
please take a look

Comment on lines +209 to +214
if isinstance(aggregator, ShapeAggregator):
x = self._tensor_processor.unstack(x, axis=0)[0]
Copy link
Owner Author

Choose a reason for hiding this comment

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

This is needed for bias correction algo: it expects not stacked tensor shape for input creation

Comment on lines +201 to +207
new_params = {"reduction_shape": self._stack_axis, "keepdims": False}
if not all(k in kwargs for k in new_params):
return per_element_result
Copy link
Owner Author

Choose a reason for hiding this comment

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

Now special reducers are filtered by this ugly filter

TensorReducerSequence

Reducer adapter inside reducer

TensorCollectorAdapter
@daniil-lyakhov daniil-lyakhov force-pushed the dl/ov/engine_sequential_models_support branch from 43eb6bc to 0cce7af Compare May 17, 2023 16:05
@github-actions github-actions bot added documentation Improvements or additions to documentation NNCF TF labels May 17, 2023
@daniil-lyakhov daniil-lyakhov changed the base branch from dl/ov/fix_names_in_inplace_stats to develop May 17, 2023 16:06
@daniil-lyakhov daniil-lyakhov changed the title [PTQ][OV] Sequential models support for Engine [PTQ][OV] Sequential models support for Engine by TensorCollectorAdapter May 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant