Windows-Machine-Learning icon indicating copy to clipboard operation
Windows-Machine-Learning copied to clipboard

Failed to load model with error: Unknown model file format version

Open Regenhardt opened this issue 3 years ago • 0 comments

I'm submitting a Bug report like #386

It seems 386 was closed due to inactivity, not because it is solved. Internet search sent me there so that's bad.

The sample code is directly from the (non-compilable☹) MS Docs sample

//  o11 here means exported for opset 11
var modelFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/mob_50k_B16_o11.onnx"));
model = await LearningModel.LoadFromStorageFileAsync(modelFile);
var device = new LearningModelDevice(LearningModelDeviceKind.Cpu);
session = new LearningModelSession(model, device); // Exception here, message is in the title

Current behavior

Model created with opset 11 can't be used to create session even though the NuGet Package is installed.

Expected behavior

The documentation says opset 11 is supported, so a LearningSession should be created.

Minimal reproduction of the problem with instructions

  • Train tensorflow model (in this case on top of mobilenet)
  • export to saved model
  • Convert to onnx format using tf2onnx according to MS Docs
  • New UWP app targeting 2004, install Microsoft.AI.MachineLearning
  • Try to load model according to above code sample

...or use the code from the MS Docs guide I followed.

Environment

Windows Build Number: 21H2 build 19044.1706

App min and target version: 2004

OS Version (Server, IoT Core, Desktop, etc): Win 10 Pro

Graphics Driver version: 27.21.14.5266

DxDiag:

WinMLTools specific: - Source training framework: TensorFlow - WinMLTools version

Visual Studio

  • [x] 2022 (version: 17.2.2)

Btw your template is out of date it still has VS 2017 in it.

Regenhardt avatar May 29 '22 18:05 Regenhardt