sdcb / OpenVINO.NET

High quality .NET wrapper for OpenVINO™ toolkit.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RunAsync got corruption,异步运行模型发生访问冲突

taotaow opened this issue · comments

commented

1.download openvino model:
openvino_model.xml
openvino_model.bin
2.download img.txt data
img.txt
3.run code below
static async Task Main(string[] args)
{
var _modelFile = "D:\taesd-openvino\vae_decoder\openvino_model.xml";
var lines = File.ReadAllLines("D:\img.txt");
var latents = new List();
foreach (var line in lines)
{
if (float.TryParse(line, out float fl))
latents.Add(fl);
}
using OVCore c = new();
using CompiledModel cm = c.CompileModel(_modelFile);
using InferRequest r = cm.CreateInferRequest();
using Tensor input = Tensor.FromArray(latents.ToArray(), new Shape(1, 4, 64, 64));
r.Inputs.Primary = input;
await r.RunAsync();//got corruption 程序崩溃退出
//0x0000000000000000 处引发的异常: 0xC0000005: 执行位置 0x0000000000000000 时发生访问冲突
}

Sdcb.OpenVINO 0.6.1
Sdcb.OpenVINO.runtime.win-x64 2023.2.0

r.Run() will be good,but r.RunAsync() went wrong
please help

Don't use RunAsync, it's buggy now

You can try StartRun, and then Wait, it should be good