dotnet / machinelearning

ML.NET is an open source and cross-platform machine learning framework for .NET.
https://dot.net/ml
MIT License
9.05k stars 1.89k forks source link

Load/save in Microsoft.ML from 1.3.1 #4103

Closed nfnpmc closed 4 years ago

nfnpmc commented 5 years ago

System information

dotnet --info .NET Core SDK (reflecting any global.json): Version: 2.1.508 Commit: 9ba8583e91

Runtime Environment: OS Name: Windows OS Version: 10.0.17763 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\2.1.508\

Host (useful for support): Version: 2.1.12 Commit: ccea2e606d

.NET Core SDKs installed: 1.0.0-preview2-003131 [C:\Program Files\dotnet\sdk] 2.1.202 [C:\Program Files\dotnet\sdk] 2.1.505 [C:\Program Files\dotnet\sdk] 2.1.507 [C:\Program Files\dotnet\sdk] 2.1.508 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 1.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

Issue

In a different class model = context.Model.Load(modelLocation, out DataViewSchema schema);

Replace 1.3.1 by 1.1.0

Retest - all worked Changed them back to try to get the exact exception again. All worked!

In a separate program, Loading the model originally saved before I changed the csproj file in the training program NodeDef mentions attr 'explicit_paddings' not in Op<name=Conv2D; signature=input:T, filter:T -> output:T; attr=T:type,allowed=[DT_HALF, DT_BFLOAT16, DT_FLOAT, DT_DOUBLE]; attr=strides:list(int); attr=use_cudnn_on_gpu:bool,default=true; attr=padding:string,allowed=["SAME", "VALID"]; attr=data_format:string,default="NHWC",allowed=["NHWC", "NCHW"]; attr=dilations:list(int),default=[1, 1, 1, 1]>; NodeDef: {{node conv2d0_pre_relu/conv}}. (Check whether your GraphDef-interpreting binary is up to date with your GraphDef-generating binary.). Error during class instantiation Exception has been thrown by the target of an invocation.

Loading the new model works fine. So I could not reproduce the issue I have been tring to solve for ages. Oh, be joyful!

Please paste or attach the code or logs or traces that would be helpful to diagnose the issue you are reporting.

najeeb-kazmi commented 4 years ago

@nfnpmc what are the contents of the model pipeline / transformer chain you saved? Can you share the training code? From the exception, it looks like there are some DNNs involved in the pipeline so a generic pipeline that I could write probably won't be enough to try to reproduce.

Also, what other ML.NET nugets (and their versions) are installed in your project, other than Microsoft.ML? E.g. Microsoft.ML.TensorFlow or Microsoft.ML.ImageAnalytics.

nfnpmc commented 4 years ago

Blimey, that was over 6 months ago. Anyway it looks like getting all the ducks in line (versions compatible) e.g. Exe netcoreapp2.1 7.1, Replace 1.3.1 by 1.1.0, it all worked. It looks like it was a problem with NuGet not fetching the correct version. I never tried to break it again for you, sorry. You can close this off now.