onnx / onnx/models

Bidaf model includes CategoryMapper op with rank-4 input, although the input must be a tensor of strings or integers, either [N,C] or [C].

Open
#601 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Jupyter Notebook
Stars
9.8k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

Bug Report

Which model does this pertain to?

Bidaf https://github.com/onnx/models/tree/main/text/machine_comprehension/bidirectional_attention_flow

Describe the bug

The model includes CategoryMapper op with rank-4 input, although the input rank should be one or two.

image

According to the onnx.ml.CategoryMapper definition at https://github.com/onnx/onnx/blob/main/docs/Operators-ml.md#ai.onnx.ml.CategoryMapper, The input must be a tensor of strings or integers, either [N,C] or [C].

As you know, onnx.CategoryMapper op is a simple string-to-integer (or integer-to-string) mapper, any input shape can be supported naturally, but the operation definition and the bidaf model are not consistent.

I am not sure if the operation definition is too strict or the model is illegal, but I am happy if the official bidaf model will be fixed.

CategoryMapper op definition

ai.onnx.ml.CategoryMapper
Converts strings to integers and vice versa.
...
Inputs
X : T1
    Input data
Outputs
Y : T2
    Output data. If strings are input, the output values are integers, and vice versa.

Type Constraints
T1 : tensor(string), tensor(int64)
    The input must be a tensor of strings or integers, either [N,C] or [C].
T2 : tensor(string), tensor(int64)
    The output is a tensor of strings or integers. Its shape will be the same as the input shape.  
Reproduction instructions

N/A

Notes

N/A

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Bidaf model in the linked model directory, then compare its CategoryMapper input shape with the referenced onnx.ml.CategoryMapper definition. Determine whether the model or the operator definition is inconsistent; done means the official model and the documented permitted input shapes agree.

Written by the indexing model from the issue text.

Assessment

Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.