awslabs / awslabs/raf

[Todo] Fix multi-input argument mapping

Open
#89 0 comments 0 reactions 0 assignees View on GitHub
bug help wanted
Dominant language
C++
Stars
145
Forks
21
PR merge metrics
No merged PRs in 30d

Description

For muliti-input model, when converting model to Relay graph, TVM may generate a different order of input arguments comapred to the original model.
For example, for the model below
```
class Q6Net(nn.Module):
def __init__(self) -> None:
super(Q6Net, self).__init__()

def forward(self, data_discount, data_quantity, data_shipdate, data_extendedprice):
...
```
TVM-generated Relay graph takes the input arguments in the order of
```
[
Var(data_extendedprice, ty=TensorType([10], float32)),
Var(data_discount, ty=TensorType([10], float32)),
Var(data_quantity, ty=TensorType([10], float32)),
Var(data_shipdate, ty=TensorType([10], float32))
]
```
This information can be extracted from:
https://github.com/apache/tvm/blob/2625878abef4bc78da65918a8a8c1db441638e8b/python/tvm/relay/frontend/pytorch.py#L4276

As a result, when executing the RAF model with the arguments in the original order
`data_discount, data_quantity, data_shipdate, data_extendedprice`
we will get the incorrect output due to the mismatch of arguments. This needs to be fixed.

Contributor guide

Open the contributing guide

Research direction

Start with the referenced python/tvm/relay/frontend/pytorch.py location around line 4276 and reproduce the Q6Net multi-input conversion. Trace how Relay input order is extracted and compare it with RAF execution using the original argument order. Done means the converted model maps each named input correctly and no longer produces incorrect output from reordered arguments.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.