machinelearning-samples
machinelearning-samples copied to clipboard
WIP: Migrate to newest ML.NET and AutoML versions
@briacht and I are working on migrating the samples to the newest NuGet package version. We have just begun the testing, and we'll update this PR with what apps we've already tested (so that we don't test the same ones).
If none of the apps break, the only change that should need to be made is updating Directory.Build.props.
Update: started testing "getting-started" folder. Tested through "DatabaseIntegration" (first 12 apps in folder), and all apps have worked so far.
Update: Ran into error in getting-started app DeepLearning_ImageClassification_Binary
.
Line 62: ITransformer trainedModel = trainingPipeline.Fit(trainSet);
Error:
System.ArgumentOutOfRangeException: 'Only one class found in the LabelAsKey column. To build a multiclass classification model, the number of classes needs to be 2 or greater Parameter name: labelCount'
Another update: Ran into error(s) in getting-started app DeepLearning_ImageClassification_Training
Multiple warnings about being unable to find input files, which then led to build failure. I've tried uploading the flower folders to the necessary input folder, but it hasn't worked properly.
Perhaps someone else can test who already has these input photo folders correctly loaded? Since this may just be an issue with getting the photo folders on my machine and not related to migrating to the new ML.NET version.
Another update: Error with getting-started app DeepLearning_ObjectDetection_Onnx
I followed the model download and config steps here
Error:
Read model Model location: C:\Users\brmurtau\Documents\GitHub\machinelearning-samples\samples\csharp\getting-started\DeepLearning_ObjectDetection_Onnx\ObjectDetectionConsoleApp\bin\Debug\netcoreapp2.2\assets\Model\TinyYolo2_model.onnx Default parameters: image size=(416,416) System.ArgumentException: Directory "" does not exist. at Microsoft.ML.Data.ImageLoadingTransformer..ctor(IHostEnvironment env, String imageFolder, Boolean type, ValueTuple
2[] columns)
at Microsoft.ML.ImageEstimatorsCatalog.LoadImages(TransformsCatalog catalog, String outputColumnName, String imageFolder, String inputColumnName)
at ObjectDetection.OnnxModelScorer.LoadModel(String modelLocation) in C:\Users\brmurtau\Documents\GitHub\machinelearning-samples\samples\csharp\getting-started\DeepLearning_ObjectDetection_Onnx\ObjectDetectionConsoleApp\OnnxModelScorer.cs:line 55
at ObjectDetection.OnnxModelScorer.Score(IDataView data) in C:\Users\brmurtau\Documents\GitHub\machinelearning-samples\samples\csharp\getting-started\DeepLearning_ObjectDetection_Onnx\ObjectDetectionConsoleApp\OnnxModelScorer.cs:line 82
at ObjectDetection.Program.Main() in C:\Users\brmurtau\Documents\GitHub\machinelearning-samples\samples\csharp\getting-started\DeepLearning_ObjectDetection_Onnx\ObjectDetectionConsoleApp\Program.cs:line 36`
DeepLearning_TensorFlowEstimator trains and predicts, but training does end with an Exception:
Save model to local file ########################
EXCEPTION ######### System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\brmurtau\Documents\GitHub\machinelearning-samples\samples\csharp\getting-started\DeepLearning_TensorFlowEstimator\ImageClassification.Train\assets\outputs\imageClassifier.zip'. at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle) at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options) at Microsoft.ML.ModelOperationsCatalog.Save(ITransformer model, DataViewSchema inputSchema, String filePath) at ImageClassification.Model.ModelBuilder.BuildAndTrain(IEnumerable`1 imageSet) in C:\Users\brmurtau\Documents\GitHub\machinelearning-samples\samples\csharp\getting-started\DeepLearning_TensorFlowEstimator\ImageClassification.Train\Model\ModelBuilder.cs:line 118 at ImageClassification.Train.Program.Main(String[] args) in C:\Users\brmurtau\Documents\GitHub\machinelearning-samples\samples\csharp\getting-started\DeepLearning_TensorFlowEstimator\ImageClassification.Train\Program.cs:line 41
LargeDatasets is also unable to find a path- perhaps someone who already has this setup on their machine could test.
Line 35:
var fullDataView = mlContext.Data.LoadFromTextFile<UrlData>(path: Path.Combine(preparedDataPath, "*"), hasHeader: false, allowSparse: true);
Error:
System.ArgumentOutOfRangeException: 'File does not exist at path: C:\Users\brmurtau\Documents\GitHub\machinelearning-samples\samples\csharp\getting-started\LargeDatasets\LargeDatasets\bin\Debug\netcoreapp2.2\Data/PreparedUrlData/url_svmlight\*
Update: concluded testing getting-started
folder.
To summarize comments above, ran into issues with the following (which may be path/setup/config related rather than related to new ML.NET version):
- DeepLearning_ImageClassification_Binary
- DeepLearning_ImageClassification_Training
- DeepLearning_ObjectDetection_Onnx
- DeepLearning_TensorFlowEstimator
- LargeDatasets
CC @briacht
Have now started end-to-end-apps
testing. Ran into error I haven't seen before when running AnomalyDetection-Sales
.
Training is successful, but the WinForms app/prediction is not. I'm able to launch the app, load and display the input csv, but when I select the SpikeDetection
option, I get the popup error:
Spike detection model does not exist. Please run model training console app first.
But I already did run the training app.
DeepLearning-ObjectDetection-Onnx
in e2e folder appears to just be a series of a couple of empty folders? I wasn't able to find any files or solution inside.
Forecasting-Sales
trains successfully and launches the web app successfully. But when I try to actually type anything in the text areas of the web app, nothing happens.
Not sure if this is just my machine not loading the app successfully?
Model-Explainability
is giving me issues as well. Even though I followed the step here to run with x64 in VS, I'm still getting an error:
This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..\..\..\packages\Microsoft.ML.CpuMath.1.4.0\build\netstandard2.0\Microsoft.ML.CpuMath.props. TaxiFarePrediction.Explainability C:\Users\brmurtau\Documents\GitHub\machinelearning-samples\samples\csharp\end-to-end-apps\Model-Explainability\TaxiFarePrediction.Explainability\TaxiFarePrediction.Explainability.csproj
ObjectDetection-Onnx
also gave an error:
Line 10: CreateHostBuilder(args).Build().Run();
Error:
System.TypeInitializationException: 'The type initializer for 'Microsoft.ML.OnnxRuntime.NativeMethods' threw an exception.'
Inner exception: DllNotFoundException: Unable to load DLL 'onnxruntime' or one of its dependencies: The specified module could not be found. (0x8007007E)
Same question for Regression-SalesForecast
and ScalableMLModelOnWebAPI
as one of the other samples above- each of these appears to just be a series of nested folders, and those folders do not contain any files or solution? At least for the latter sample, it seems like it's an addition that would be included in a project, rather than a project that should be run and tested on its own.
Additionally, ScalableMLModelOnWebAPI-Custom
launched a web page, but that page didn't load, instead stating: This localhost page can’t be found
I don't believe I have the necessary Blazor config setup on my machine for ScalableSentimentAnalysisBlazorWebApp
, so I am unable to verify if it works.
I have now concluded the csharp
end-to-end-apps
and getting-started
folders, with the issues and questions above.
CC @briacht
Update: Ran into error in getting-started app
DeepLearning_ImageClassification_Binary
.Line 62:
ITransformer trainedModel = trainingPipeline.Fit(trainSet);
Error:
System.ArgumentOutOfRangeException: 'Only one class found in the LabelAsKey column. To build a multiclass classification model, the number of classes needs to be 2 or greater Parameter name: labelCount'
I believe this was happening because you didn't unzip the assets folder first which has all the images (so it was taking that as there is only 1 label - which I guess was just empty)
After unzipping assets folder, this one ran successfully
We should add a comment to do this in every sample that requires unzipping the asset folder (right now I think it's only in the README)
Another update: Ran into error(s) in getting-started app
DeepLearning_ImageClassification_Training
Multiple warnings about being unable to find input files, which then led to build failure. I've tried uploading the flower folders to the necessary input folder, but it hasn't worked properly.
Perhaps someone else can test who already has these input photo folders correctly loaded? Since this may just be an issue with getting the photo folders on my machine and not related to migrating to the new ML.NET version.
I ran the ImageClassification.Train console app first, which downloaded the .zip file and extracted, and it ran successfully.
ImageClassification.Predict and ImageClassification.WebApp were also both successful
I ran the ImageClassification.Train console app first, which downloaded the .zip file and extracted, then the output console windows shows an error.