-
Notifications
You must be signed in to change notification settings - Fork 170
Description
In the current moment we have no a capabilities for model resizing and dynamic input specialization.
The best place in the whole tool-chain seems to be operating on circle representation (common solution for all front-ends).
What types of API should be exposed?
We need both C++ and Python API. Python API is especially needed for Python-based frontends, like Pytorch->Circle converter.
There are also some C++ tools run from Python as sub-processes but I am against such approach (very hard to debug, need to determine paths for every usage, no versioning control, each step requires saving the whole model to file).
Why a separate tool instead of extending existing API:
I am just following convention from https://github.com/Samsung/ONE/tree/master/compiler where an each step is realized as a separate app/service. What's more the tool should be easy accessible for front-ends.
Initial use-cases:
In the beginning I am focused on LLM Pytoch models. My first candidate to provide e2e support LLama2.
cmd app
The tool should be accessible also as command line app with args:
--input_path--output_path--input_shapes
Supported format of new inputs shapes: comma separated. An example for model with 2 inputs: [1,2],[3,4].
Way of tests:
- unit tests (c++ and python parts)
- e2e for the models, like: Pytorch->Circle conversion to dynamic version, resizing/shape specialization using
circle-resizer, numerical results testing on circle-interpreter
Proposition of implementation:
TODO:
-
adjust/expand current shape inference capabilities (
luci/Pass/CircleShapeInferencePass) to support LLama2 dynamic shapes -
[luci] Handle dynamic dimensions in Squeeze shape inference #14857
-
[luci] Add additional check of unknown dimension for Reshape #14858
-
[res] Add TFLiteRecipe for Squeeze with dynamic shape #14865
-
[circle2circle-dredd-recipe-test] Add Inf_Squeeze_000 test #14866
-
adjust
luci-interpreterto enable inference model with specialized shape (like LLama2) -
[luci-interpreter] Relax StrideSlice rank limitations #14507
-
Implementation
circle-resizertool with cmd interface -
[circle-resizer] Resolve warning of operator<< for Shape #15225
-
Integration the tool with ONE toolchain
-
one-cmdsintegration -
one-buildintegration -
infra/debianintegration -
separate
circle-resizer-dredd-recipe-testtarget to runres/TensorFlowLiteRecipestests
Test models (cut from dynamic LLama2):
dyn_llama2_query.zip
dyn_llama2_norm.zip
