dotnet / dotnet/machinelearning-samples
Is this a bug, or is Microsoft ML incompatible with Windows Forms
- Lingua principale
- PowerShell
- Stelle
- 4.7k
- Fork
- 2.7k
- Merge medio
- 2g 22h
- PR unite (30g)
- 1
Descrizione
Hello,
trying to integrate machine learnig into a Windows Forms app (even a very simple one that may only predict next value) is not successful. As soon as the ML modules are invoked, an error is thrown:

Details of the error message:
System.DllNotFoundException
HResult=0x80131524
Nachricht = Die DLL "CpuMathNative": Das angegebene Modul wurde nicht gefunden. (Ausnahme von HRESULT: 0x8007007E) kann nicht geladen werden.
Quelle =
Stapelüberwachung:
Obviously, a DLL named CpuMathNative is missing. Does it belong to original Windows code or to .NET Framework (Version???)
Error message 0x8007007E of course has a little strong flavour :-( - Windows Update Error or damaged component store etc.
Therefore I did the usual process:
1. Windows Update Error Processing - Windows can't identify the error
2. All known updates for the moment are successfully installed
3. sfc /scannow and the well known DISM procedure without errors...
Can anybody help? Is there an incompatibility between Microsoft ML and .NET framework (GUI)? For first test, I implemented ML using the model generator within VS.
The test program only tries to predict a new value for the trained model. Here's the code of the ConsumeModel class:
// This file was auto-generated by ML.NET Model Builder.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.ML;
using ModelTrainerML.Model;
namespace ModelTrainerML.Model
{
public class ConsumeModel
{
// For more info on consuming ML.NET models, visit https://aka.ms/model-builder-consume
// Method for consuming model in your app
public static ModelOutput Predict(ModelInput input)
{
// Create new MLContext
MLContext mlContext = new MLContext();
// Load model & create prediction engine
string modelPath = AppDomain.CurrentDomain.BaseDirectory + "MLModel.zip";
ITransformer mlModel = mlContext.Model.Load(modelPath, out var modelInputSchema);
var predEngine = mlContext.Model.CreatePredictionEngine(mlModel);
// Use model to make prediction on input data
ModelOutput result = predEngine.Predict(input);
return result;
}
}
}
If I call the predict method from the ConsoleApp, everything works fine...
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
La issue indica la classe ConsumeModel generata automaticamente e il relativo metodo Predict; inizia confrontando questa chiamata nella ConsoleApp funzionante con l’applicazione Windows Forms e verifica come viene caricato CpuMathNative. Il lavoro è completato quando la stessa predizione del modello viene eseguita da Windows Forms senza la System.DllNotFoundException segnalata.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- csharp, machine-learning
- Ambito
- desktop, machine-learning
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100