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

How to use adaround when the model requires multiple inputs #2797

Open
unique-null opened this issue Mar 2, 2024 · 1 comment
Open

How to use adaround when the model requires multiple inputs #2797

unique-null opened this issue Mar 2, 2024 · 1 comment

Comments

@unique-null
Copy link

when I use adaround as below:
image

the error appeares as follows:
image

the env shows:
image

how can I fix the error. thx.

@quic-hitameht
Copy link
Contributor

quic-hitameht commented Mar 4, 2024

When configuring Adaround parameters, along with data_loader, forward_fn is required which is simply an adapter function that performs forward pass given a model and model inputs yielded from the provided data loader. API doc for Adaround: https://quic.github.io/aimet-pages/releases/latest/api_docs/torch_adaround.html#api-torch-adaround

By default, the assumption is that the provided data loader is labeled and it only passes the first element to the model if data loader yields the tuple and this restriction is I guess not very well documented and needs to be fixed. Here is the definition of default forward function: https://github.com/quic/aimet/blob/develop/TrainingExtensions/torch/src/python/aimet_torch/utils.py#L170

All you need to do is define your own custom forward_fn and pass it when creating AdaroundParameters object:

def forward_fn(model, inputs):
    model(*inputs)

Let us know if you have any other questions.

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

2 participants