Skip to content

[circle-resizer] Implementation a new tool for model resizing #14791

@mbencer

Description

@mbencer

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:

Image

TODO:

Test models (cut from dynamic LLama2):
dyn_llama2_query.zip
dyn_llama2_norm.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions