Closed JoelShen123 closed 4 years ago
It's okay I've found a workaround. Instead of trying to run the machine learning with the .NET Framework, I created a standalone console application in .NET Core and export that as .exe, then run the .exe from the .NET Framework, and it works. :)
Versions Microsoft.ML - Version="1.5.0-preview2". Visual Studio 2019 Target Framework: Class Library ( .NET Framework 4.7)
Bug description "Could not load file" error thrown from "ModelOperationsCatalog.Load()".
Steps to Reproduce
string resourceName = "IfcPluginML.Model.MLModel.zip";
Stream modelFile = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName)
ITransformer mlModel = mlContext.Model.Load(modelFile , out var modelInputSchema);
Expected Experience File is read successfully.
Actual Experience Could not read file:
I have checked that the
Stream modelFile = GetEmbeddedResourceStream(resourceName); // returns "System.IO.UnmanagedMemoryStream"
so it is definitely not null.Putting the full file path produces the same error too:
string modelPath = @"C:\Users\User\AppData\Local\Temp\MLVSTools\IfcPluginML\IfcPluginML.Model\MLModel.zip";
ITransformer mlModel = mlContext.Model.Load(modelPath, out var modelInputSchema);
Additional Context I have referenced this post: https://github.com/dotnet/machinelearning-modelbuilder/issues/274 However, even after changing the target framework of ProjectNameML.Model.csproj to an sdk style: The error persists.
How my software works:
ConsumeModel.Predict(input);
It works when:
ConsumeModel.Predict(input);
Thanks for your help 💯