System.AccessViolationException at newing LearningModelSession (using GPU mode)

143 Views Asked by At

everyone!

I am trying to make an inferencing app based of SnapCandy Sample of Windows-Machine-Learning github.

My ONNX Model file is exported at pytorch 1.10. Onnx format : v4, opset v9

Windows version : Win10 21H2 (Build# 19044.1466)

Graphics : NDVIA 2060 (Driver verion : 8.1.961.0, VRAM 6GB)

Code : m_inferenceDeviceSelected = _useGPU ? LearningModelDeviceKind.DirectXHighPerformance : LearningModelDeviceKind.Cpu; m_session = new LearningModelSession(m_model, new LearningModelDevice(m_inferenceDeviceSelected));

If _useGPU is true(Gpu mode), then System.AccessViolationException is occured.

But if _useGPU is false(Cpu mode), then it is inferencing good.

How can I solve this exception?

Thanks in advance!

1

There are 1 best solutions below

1
Oliver Meyer On

I had a similar problem and create an issue on github (https://github.com/microsoft/Windows-Machine-Learning/issues/464), that is now answered: The problem is fixed for me, when using the DirectML.DLL from \Windows\System32\ and not the DLL, that comes with the nuget packet "Microsoft.AI.DirectML". best regards, Oliver