Thank you for your question.
This appears to be the same topic as your previous thread. I have already provided guidance there on loading the model, generating embeddings, and integrating all-MiniLM-L6-v2 into a .NET MAUI Android application. With that in mind, I would like to add the following comments based on the code shared here.
Regarding the error at _session.Run(inputs), based on the code you shared, one possible cause is that the ONNX model expects additional input tensors that are not being provided. Many BERT-based models, including all-MiniLM-L6-v2 variants, commonly require inputs such as attention_mask and, in some cases, token_type_ids in addition to input_ids.
For example:
var inputs = new List
{
NamedOnnxValue.CreateFromTensor("input_ids", idTensor),
NamedOnnxValue.CreateFromTensor("attention_mask", attentionMaskTensor),
NamedOnnxValue.CreateFromTensor("token_type_ids", tokenTypeIdsTensor)
};
using var results = _session.Run(inputs);
The exact input names and required tensors depend on the ONNX model you are using. You may want to inspect the model inputs (for example, through _session.InputMetadata) and compare them against the tensors being supplied before calling _session.Run().
Please continue in the original thread and share the complete exception message together with the model input metadata if the issue persists.
If you found my response helpful or informative, I would greatly appreciate it if you could follow this guide for your confirmation.
Thank you.