Closed airforcefirer closed 3 months ago
This appears to be a GenAi issue. Please, file there for visibility.
This happens when the number of image tags in your prompt <|image_1|>
does not match the number of images provided to the processor.
Could you please paste your prompt and mention whether image is null or not?
Will close this issue now. Please let me know if the above information was not helpful or if you believe this needs further investigation.
Describe the issue
Has anyone ever used Microsoft.ML.OnnxRuntimeGenAI in a C# .NET 6 WebAPI environment?
In the following code snippet, executing processor.ProcessImages(prompt, images); in the WebAPI environment throws an error (the same component configuration works without this error when executed in a WinForm application):
**An error occurred: Number of unique image tags does not match the number of images.
at Microsoft.ML.OnnxRuntimeGenAI.MultiModalProcessor.ProcessImages(String prompt, Images images) at Phi3MultimodalProcess.Controllers.Phi3RecognitionController.PostRecognitionWithCPU(GPTParameter parameter) in D:\WebApplication\WebService\Phi3MultimodalProcess\Controllers\Phi3RecognitionController.cs:line 131**
To reproduce
[Code snippet:] public string onnxPathCPU = "D:\Phi-3-vision-128k-instruct-onnx-cpu\cpu-int4-rtn-block-32-acc-level-4"; using var model = new Model(onnxPathCPU); using MultiModalProcessor processor = new MultiModalProcessor(model);
Images? images = hasImage ? Images.Load(parameter.imagePath) : null;
string prompt = parameter.prompt; using var inputs = processor.ProcessImages(prompt, images);
[My .csproj setting:]
Urgency
No response
Platform
Windows
OS Version
.NET 6 WebAPI
ONNX Runtime Installation
Built from Source
ONNX Runtime Version or Commit ID
Microsoft.ML.OnnxRuntimeGenAI (0.3.0-rc2)
ONNX Runtime API
C#
Architecture
X64
Execution Provider
Default CPU
Execution Provider Library Version
No response