Skip to content

Provide More Utilities for Circle Model Workflow (Inference, etc) #251

@dayo09

Description

@dayo09

What?

Let's provide more utilities for TICO users, which makes getting model 'signature' easy and circle model structure easy (with multiple subgraphs), inference.

It doesn't take much effort because most of work is to revise the code and export api in proper form.

EXAMPLE

import tico   

m = tico.load_circle('mymodel.circle')
sig = m.signature # help us to provide inputs
sample_args = (torch.randn(1,3,3,4),)
result = tico.infer(m, sample_args, backend="onert")
print(result)

Background

So far, our tico package has focused mainly on the convert APIs:

from tico.config import CompileConfigV1, get_default_config
from tico.utils.convert import convert, convert_from_exported_program, convert_from_pt2

__all__ = [
    "CompileConfigV1",
    "get_default_config",
    "convert",
    "convert_from_exported_program",
    "convert_from_pt2",
]

While these cover model conversion essentials, the functionality around Circle models has been quite limited.

What we want to achieve

We want to extend our utilities to cover a more complete flow involving Circle models, including but not limited to:

  • Loading Circle models easily
  • Integrating with onecc for optimization and quantization workflows (advanced steps)
  • Running inference conveniently

In particular, the inference step is currently cumbersome. We want a utility that:

  • Parses the input signature shape 👍
  • Automatically accepts inputs as torch.Tensor or numpy.ndarray
  • Provides a smooth, user-friendly API for feeding inputs to the model

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