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

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

Open
7 tasks
mbencer opened this issue Mar 7, 2025 · 1 comment
Open
7 tasks

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

mbencer opened this issue Mar 7, 2025 · 1 comment

Comments

@mbencer
Copy link
Contributor

mbencer commented Mar 7, 2025

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_model
  • --output_model
  • --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:

  • changing shapes of inputs on circle::Model flatbuffer representation
  • shape inference on model with changed shapes using luci/Pass capabilities
  • parsing new shapes passed by a user
  • adjust/expand current shape inference capabilities (luci/Pass/CircleShapeInferencePass) to support requires cases
  • API to exported changed model to stream/file
  • exposing resizer API using pybind11
  • setup.py and python wheel packing/distribution
@mbencer
Copy link
Contributor Author

mbencer commented Mar 7, 2025

DRAFT: #14727

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant