-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Onnx input and output data type #6469
Comments
Related to this, I have created a repository documenting what I was trying to do. Unfortunately there is an error that stop me from running the model.
I'm still unsure whether this is an issue caused by my lack of understanding or it is actually a bug. Here's my current Input and Output model type OnnxInput() =
[< ColumnName("input_ids") >]
member val InputIds: int64 seq seq = [[]] with get, set
[< ColumnName("attention_mask")>]
member val AttentionMask: int64 seq seq = [[]] with get, set
type OnnxOutput() =
[< ColumnName("last_hidden_state") >]
member val LastHiddenState: float32 seq seq = [[]] with get, set I have also tried the OnnxSequenceType attribute just to receive the same error message. type OnnxInput() =
[< ColumnName("input_ids"); OnnxSequenceType(typedefof<int64 seq>) >]
member val InputIds: int64 seq seq = [[]] with get, set
[< ColumnName("attention_mask"); OnnxSequenceType(typedefof<int64 seq>)>]
member val AttentionMask: int64 seq seq = [[]] with get, set
type OnnxOutput() =
[< ColumnName("last_hidden_state"); OnnxSequenceType(typedefof<float32 seq>) >]
member val LastHiddenState: float32 seq seq = [[]] with get, set
|
@luisquintanilla I know we have already discussed making this whole process more intuitive. Any quick pointers to help here though? You are much more familiar with F# than I am. |
Hi @triandco Thanks for your question. There's a few issues at hand here:
Hope this helps. Another unsolicited tip, you can use Records with F#. [<CLIMutable>]
type OnnxInput
{
[<ColumnName("input_ids")>] InputIds : int64 seq
//...
} |
I am facing the same issue here. My data type is: type: int64[batch,sequence], and I still don't have any clue on how to make it work. Does anyone figure it out? Thanks in advance for any help! |
@yli223 I had some luck with the tips from @luisquintanilla 🙇♂️, it is actually very helpful in term of understanding the type. Thank you @luisquintanilla. However, I gave up in the end because I kept getting block by some other issue. In the end, I decided to use an InferenceSession to run the model. You can see my code here It doesn't have all the type safety of the above implementation, but it works. 😅 |
@triandco Thank you! |
Is your feature request related to a problem? Please describe.
I was trying to follow a guide on how to use Onnx model with dotnet. I find it difficult to understand how to translate the data type of input and output into C#. The type as display on Netron seems to be python but not quite. From the example I understand that something like
int32[n,1]
would be a single int32 value, however, in one of my model, I found the typefloat32[batch, sequence,768]
which is harder to translate.Describe the solution you'd like
Is there any further documentation on what these types are?
Describe alternatives you've considered
I opened an issue on Netron's repo asking if there is any documentation on the type and he suggested that I post an issue on MS side.
I appreciate that there is already an opening issue about improving on this documentation. However, is there any quick pointer on this particular issue?
Context
![image](https://user-images.githubusercontent.com/61586052/203718812-d65e717c-7363-4897-be12-8332d40112bf.png)
The current model was trying to run is an onnx export of msmarco-distilbert-base-tas-b from huggingface.
Much appreciated
The text was updated successfully, but these errors were encountered: