C
C#15mo ago
Eris

✅ Can't use Machine Learning Model

Heyo! So I wanted to try out using an AI model to sort some pictures into one of two categories, the app I'm trying to use it in is a Console App in .NET Framework 4.7.2 targeted for x64, I've added a Machine Learning Model (called Stone_Diff), trained it and it works great, but I can't figure out how to use it. I copied the sample code the setup gave me, but it comes up as "The type or namespace name 'Stone_Diff' could not be found" and "The name 'Stone_Diff' does not exist in the current context". Here's the code I'm using:
//Load sample data
var imageBytes = File.ReadAllBytes(@"path-to-file\0.png");
Stone_Diff.ModelInput sampleData = new Stone_Diff.ModelInput()
{
ImageSource = imageBytes,
};

//Load model and predict output
var result = Stone_Diff.Predict(sampleData);
//Load sample data
var imageBytes = File.ReadAllBytes(@"path-to-file\0.png");
Stone_Diff.ModelInput sampleData = new Stone_Diff.ModelInput()
{
ImageSource = imageBytes,
};

//Load model and predict output
var result = Stone_Diff.Predict(sampleData);
Why's it erroring out, do I need to manually add some references or something? If so, I couldn't find how to do it with the normal Add Referenced menu, nor could I find a way to get using Stone_Diff; to work. Thank you for reading!
74 Replies
Pobiega
Pobiega15mo ago
Where exactly did you find that model? Google gives me nothing. Also, any particular reason you're on .NET Framework and not modern .NET?
Eris
ErisOP15mo ago
made it
No description
Eris
ErisOP15mo ago
this is just a testing app for a winforms app that is my actual main project, didn't wanna add anything into that before knowing whether this would be a viable solution
Pobiega
Pobiega15mo ago
The type or namespace name 'Stone_Diff' could not be found
that usually means you forgot a using statement or a project reference
Eris
ErisOP15mo ago
tried both of those, same issue
Pobiega
Pobiega15mo ago
¯\_(ツ)_/¯
Eris
ErisOP15mo ago
No description
Eris
ErisOP15mo ago
also as a reference I can't find it in any of the lists
Pobiega
Pobiega15mo ago
if you open up the generated consumption file, what does that look like?
Eris
ErisOP15mo ago
// This file was auto-generated by ML.NET Model Builder.
using Microsoft.ML;
using Microsoft.ML.Data;
using System;
using System.Linq;
using System.IO;
using System.Collections.Generic;
namespace Sand_Castle
{
public partial class Stone_Diff
{
/// <summary>
/// model input class for Stone_Diff.
/// </summary>
#region model input class
public class ModelInput
{
[ColumnName(@"Label")]
public string Label { get; set; }

[ColumnName(@"ImageSource")]
public byte[] ImageSource { get; set; }

}

#endregion

/// <summary>
/// model output class for Stone_Diff.
/// </summary>
#region model output class
public class ModelOutput
{
[ColumnName(@"Label")]
public uint Label { get; set; }

[ColumnName(@"ImageSource")]
public byte[] ImageSource { get; set; }

[ColumnName(@"PredictedLabel")]
public string PredictedLabel { get; set; }

[ColumnName(@"Score")]
public float[] Score { get; set; }

}

#endregion

private static string MLNetModelPath = Path.GetFullPath("Stone Diff.zip");

public static readonly Lazy<PredictionEngine<ModelInput, ModelOutput>> PredictEngine = new Lazy<PredictionEngine<ModelInput, ModelOutput>>(() => CreatePredictEngine(), true);

/// <summary>
/// Use this method to predict on <see cref="ModelInput"/>.
/// </summary>
/// <param name="input">model input.</param>
/// <returns><seealso cref=" ModelOutput"/></returns>
public static ModelOutput Predict(ModelInput input)
{
var predEngine = PredictEngine.Value;
return predEngine.Predict(input);
}

private static PredictionEngine<ModelInput, ModelOutput> CreatePredictEngine()
{
var mlContext = new MLContext();
ITransformer mlModel = mlContext.Model.Load(MLNetModelPath, out var _);
return mlContext.Model.CreatePredictionEngine<ModelInput, ModelOutput>(mlModel);
}
}
}
// This file was auto-generated by ML.NET Model Builder.
using Microsoft.ML;
using Microsoft.ML.Data;
using System;
using System.Linq;
using System.IO;
using System.Collections.Generic;
namespace Sand_Castle
{
public partial class Stone_Diff
{
/// <summary>
/// model input class for Stone_Diff.
/// </summary>
#region model input class
public class ModelInput
{
[ColumnName(@"Label")]
public string Label { get; set; }

[ColumnName(@"ImageSource")]
public byte[] ImageSource { get; set; }

}

#endregion

/// <summary>
/// model output class for Stone_Diff.
/// </summary>
#region model output class
public class ModelOutput
{
[ColumnName(@"Label")]
public uint Label { get; set; }

[ColumnName(@"ImageSource")]
public byte[] ImageSource { get; set; }

[ColumnName(@"PredictedLabel")]
public string PredictedLabel { get; set; }

[ColumnName(@"Score")]
public float[] Score { get; set; }

}

#endregion

private static string MLNetModelPath = Path.GetFullPath("Stone Diff.zip");

public static readonly Lazy<PredictionEngine<ModelInput, ModelOutput>> PredictEngine = new Lazy<PredictionEngine<ModelInput, ModelOutput>>(() => CreatePredictEngine(), true);

/// <summary>
/// Use this method to predict on <see cref="ModelInput"/>.
/// </summary>
/// <param name="input">model input.</param>
/// <returns><seealso cref=" ModelOutput"/></returns>
public static ModelOutput Predict(ModelInput input)
{
var predEngine = PredictEngine.Value;
return predEngine.Predict(input);
}

private static PredictionEngine<ModelInput, ModelOutput> CreatePredictEngine()
{
var mlContext = new MLContext();
ITransformer mlModel = mlContext.Model.Load(MLNetModelPath, out var _);
return mlContext.Model.CreatePredictionEngine<ModelInput, ModelOutput>(mlModel);
}
}
}
Pobiega
Pobiega15mo ago
ok there we go so the class is called Stone_Diff and is in the Sand_Castle namespace so where you are trying to use it, you need a using Sand_Castle unless you're already in that namespace
Eris
ErisOP15mo ago
already am here's the main program
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
using System.Windows.Forms;
using System.IO;
using System.Drawing.Imaging;
using Microsoft.ML.Data;
using Microsoft.ML;

namespace Sand_Castle
{
internal class Program
{
static void Main(string[] args)
{
//Load sample data
var imageBytes = File.ReadAllBytes(@"path-to-files\0.png");
Stone_Diff.ModelInput sampleData = new Stone_Diff.ModelInput()
{
ImageSource = imageBytes,
};

//Load model and predict output
var result = Stone_Diff.Predict(sampleData);
Console.WriteLine(Convert.ToString(result));
Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
using System.Windows.Forms;
using System.IO;
using System.Drawing.Imaging;
using Microsoft.ML.Data;
using Microsoft.ML;

namespace Sand_Castle
{
internal class Program
{
static void Main(string[] args)
{
//Load sample data
var imageBytes = File.ReadAllBytes(@"path-to-files\0.png");
Stone_Diff.ModelInput sampleData = new Stone_Diff.ModelInput()
{
ImageSource = imageBytes,
};

//Load model and predict output
var result = Stone_Diff.Predict(sampleData);
Console.WriteLine(Convert.ToString(result));
Console.ReadKey();
}
}
}
Pobiega
Pobiega15mo ago
ok idk then, my only remaining guess is that this isn't compatible with framework
Eris
ErisOP15mo ago
the few resources I found on this said it should work for framework idk :(
Pobiega
Pobiega15mo ago
can you reach this page?
No description
Pobiega
Pobiega15mo ago
if so, what happens if you click "add to solution" for console app
Eris
ErisOP15mo ago
it added a new project, this is the Program.cs
// This file was auto-generated by ML.NET Model Builder.

using Stone_Diff_ConsoleApp;
using System.IO;

// Create single instance of sample data from first line of dataset for model input
var imageBytes = File.ReadAllBytes(@"C:\Users\rares\Downloads\Black Stones Data\Black Stones Armor\0.png");
Stone_Diff.ModelInput sampleData = new Stone_Diff.ModelInput()
{
ImageSource = imageBytes,
};

// Make a single prediction on the sample data and print results.
var predictionResult = Stone_Diff.Predict(sampleData);
Console.WriteLine($"\n\nPredicted Label value: {predictionResult.PredictedLabel} \nPredicted Label scores: [{String.Join(",", predictionResult.Score)}]\n\n");
// This file was auto-generated by ML.NET Model Builder.

using Stone_Diff_ConsoleApp;
using System.IO;

// Create single instance of sample data from first line of dataset for model input
var imageBytes = File.ReadAllBytes(@"C:\Users\rares\Downloads\Black Stones Data\Black Stones Armor\0.png");
Stone_Diff.ModelInput sampleData = new Stone_Diff.ModelInput()
{
ImageSource = imageBytes,
};

// Make a single prediction on the sample data and print results.
var predictionResult = Stone_Diff.Predict(sampleData);
Console.WriteLine($"\n\nPredicted Label value: {predictionResult.PredictedLabel} \nPredicted Label scores: [{String.Join(",", predictionResult.Score)}]\n\n");
Pobiega
Pobiega15mo ago
and the csproj for that project?
Eris
ErisOP15mo ago
got 23 warnings as well lol
Pobiega
Pobiega15mo ago
warnings are warnings, not errors
Eris
ErisOP15mo ago
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ML" Version="1.7.1" />
<PackageReference Include="Microsoft.ML.Vision" Version="1.7.1" />
<PackageReference Include="SciSharp.TensorFlow.Redist" Version="2.3.1" />
</ItemGroup>
<ItemGroup Label="Stone Diff">
<None Include="Stone Diff.consumption.cs">
<DependentUpon>Stone Diff.mbconfig</DependentUpon>
</None>
<None Include="Stone Diff.training.cs">
<DependentUpon>Stone Diff.mbconfig</DependentUpon>
</None>
<None Include="Stone Diff.zip">
<DependentUpon>Stone Diff.mbconfig</DependentUpon>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ML" Version="1.7.1" />
<PackageReference Include="Microsoft.ML.Vision" Version="1.7.1" />
<PackageReference Include="SciSharp.TensorFlow.Redist" Version="2.3.1" />
</ItemGroup>
<ItemGroup Label="Stone Diff">
<None Include="Stone Diff.consumption.cs">
<DependentUpon>Stone Diff.mbconfig</DependentUpon>
</None>
<None Include="Stone Diff.training.cs">
<DependentUpon>Stone Diff.mbconfig</DependentUpon>
</None>
<None Include="Stone Diff.zip">
<DependentUpon>Stone Diff.mbconfig</DependentUpon>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
Pobiega
Pobiega15mo ago
mhm, so thats .net 6 Microsoft.ML targets .netstandard 2.0 so it should work on framework, at least that package
Eris
ErisOP15mo ago
also got this long ass warning
Pobiega
Pobiega15mo ago
yeah because you are using version 4 and version 6 of that package
Eris
ErisOP15mo ago
ah fair enough
Pobiega
Pobiega15mo ago
not a good idea to mix modern .net with framework 😄
Eris
ErisOP15mo ago
fair, but still, there must be a way to use the ML model with .NET framework
Pobiega
Pobiega15mo ago
sure, but at the same time its no suprise the tooling (which was all made AFTER framework as discontinued) doesnt support it
Eris
ErisOP15mo ago
Especially since it should theoretically work
Pobiega
Pobiega15mo ago
Impossible to find resources on it thou, since again the entire thing was made after framework was already discontinued, so all guides/tutorials/articles all assume modern .net
Eris
ErisOP15mo ago
"ML.NET runs on Windows, Linux, and macOS using .NET Core, or Windows using .NET Framework. 64 bit is supported on all platforms." From Microsoft's Learn website https://learn.microsoft.com/en-us/dotnet/machine-learning/how-does-mldotnet-work
What is ML.NET and how does it work? - ML.NET
ML.NET gives you the ability to add machine learning to .NET applications, in either online or offline scenarios. With this capability, you can make automatic predictions using the data available to your application without having to be connected to a network to use ML.NET. This article explains the basics of machine learning in ML.NET.
Pobiega
Pobiega15mo ago
yup and the package does indeed target .netstandard 2.0 but I googled for a good 10 minutes and found not a single example for .net framework 😛 especially not for those .mbconfig models
Eris
ErisOP15mo ago
Well I needed a custom model, this seemed like the only realistic way for me to get that
Pobiega
Pobiega15mo ago
I'm not saying you did anything wrong, I'm just saying the tooling might not support what you are trying to do
Eris
ErisOP15mo ago
damn, I always get myself in these situations
Pobiega
Pobiega15mo ago
the consumption file should give you access to the Stone_Diff class, but perhaps its not being compiled
Eris
ErisOP15mo ago
so then is there a way to integrate a standard .net project into a framework project?
Pobiega
Pobiega15mo ago
wdym? .netstandard 2.0, yes .net6, no
Eris
ErisOP15mo ago
if I were to use the model in a separate project, could I send an input to that project, have it run and use the output in my framework program?
Pobiega
Pobiega15mo ago
Why are you still using framework 7 years after its "death" thou? thats my primary question, tbh
Eris
ErisOP15mo ago
winforms, I adore winforms and it's what I learnt in university, nothing easier to work with for me than winforms, apart from finding myself in situations like these :D
Pobiega
Pobiega15mo ago
and winforms works fine in modern .net so uh.. again, why are you on framework?
Eris
ErisOP15mo ago
also what I learned in uni
Pobiega
Pobiega15mo ago
Thats a pretty bad excuse tbh "I refuse to learn new things" is what it boils down to
Eris
ErisOP15mo ago
more like I have a big project already in framework, I wouldn't even know where to start with migrating it and I sure as hell ain't rewriting all of it lol
Eris
ErisOP15mo ago
also, if I were to set this to build as well, could it help?
No description
Pobiega
Pobiega15mo ago
check what build action is on another .cs file
Eris
ErisOP15mo ago
on the Pogram.cs files it's on Compile
Pobiega
Pobiega15mo ago
ok, try setting it to compile
Eris
ErisOP15mo ago
it built now, the unknown errors are gone, but when running it it throws this
System.Reflection.TargetInvocationException
HResult=0x80131604
Message=Exception has been thrown by the target of an invocation.
Source=mscorlib
StackTrace:
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.ML.Runtime.ComponentCatalog.LoadableClassInfo.CreateInstanceCore(Object[] ctorArgs)
at Microsoft.ML.Runtime.ComponentCatalog.TryCreateInstance[TRes](IHostEnvironment env, Type signatureType, TRes& result, String name, String options, Object[] extra)
at Microsoft.ML.Runtime.ComponentCatalog.TryCreateInstance[TRes,TSig](IHostEnvironment env, TRes& result, String name, String options, Object[] extra)
at Microsoft.ML.ModelLoadContext.TryLoadModelCore[TRes,TSig](IHostEnvironment env, TRes& result, Object[] extra)
at Microsoft.ML.ModelLoadContext.TryLoadModel[TRes,TSig](IHostEnvironment env, TRes& result, RepositoryReader rep, Entry ent, String dir, Object[] extra)
at Microsoft.ML.ModelLoadContext.LoadModel[TRes,TSig](IHostEnvironment env, TRes& result, RepositoryReader rep, Entry ent, String dir, Object[] extra)
at Microsoft.ML.ModelLoadContext.LoadModelOrNull[TRes,TSig](IHostEnvironment env, TRes& result, RepositoryReader rep, String dir, Object[] extra)
at Microsoft.ML.ModelLoadContext.LoadModel[TRes,TSig](IHostEnvironment env, TRes& result, RepositoryReader rep, String dir, Object[] extra)
at Microsoft.ML.ModelOperationsCatalog.Load(Stream stream, DataViewSchema& inputSchema)
at Microsoft.ML.ModelOperationsCatalog.Load(String filePath, DataViewSchema& inputSchema)
at Sand_Castle.Stone_Diff.CreatePredictEngine() in C:\Users\rares\Documents\Misc Programs\Sand Castle\Stone Diff.consumption.cs:line 68
at Sand_Castle.Stone_Diff.<>c.<.cctor>b__9_0() in C:\Users\rares\Documents\Misc Programs\Sand Castle\Stone Diff.consumption.cs:line 52
at System.Lazy`1.CreateValue()

Inner Exception 1:
TargetInvocationException: Exception has been thrown by the target of an invocation.

Inner Exception 2:
FileLoadException: Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Inner Exception 3:
FileLoadException: Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
System.Reflection.TargetInvocationException
HResult=0x80131604
Message=Exception has been thrown by the target of an invocation.
Source=mscorlib
StackTrace:
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.ML.Runtime.ComponentCatalog.LoadableClassInfo.CreateInstanceCore(Object[] ctorArgs)
at Microsoft.ML.Runtime.ComponentCatalog.TryCreateInstance[TRes](IHostEnvironment env, Type signatureType, TRes& result, String name, String options, Object[] extra)
at Microsoft.ML.Runtime.ComponentCatalog.TryCreateInstance[TRes,TSig](IHostEnvironment env, TRes& result, String name, String options, Object[] extra)
at Microsoft.ML.ModelLoadContext.TryLoadModelCore[TRes,TSig](IHostEnvironment env, TRes& result, Object[] extra)
at Microsoft.ML.ModelLoadContext.TryLoadModel[TRes,TSig](IHostEnvironment env, TRes& result, RepositoryReader rep, Entry ent, String dir, Object[] extra)
at Microsoft.ML.ModelLoadContext.LoadModel[TRes,TSig](IHostEnvironment env, TRes& result, RepositoryReader rep, Entry ent, String dir, Object[] extra)
at Microsoft.ML.ModelLoadContext.LoadModelOrNull[TRes,TSig](IHostEnvironment env, TRes& result, RepositoryReader rep, String dir, Object[] extra)
at Microsoft.ML.ModelLoadContext.LoadModel[TRes,TSig](IHostEnvironment env, TRes& result, RepositoryReader rep, String dir, Object[] extra)
at Microsoft.ML.ModelOperationsCatalog.Load(Stream stream, DataViewSchema& inputSchema)
at Microsoft.ML.ModelOperationsCatalog.Load(String filePath, DataViewSchema& inputSchema)
at Sand_Castle.Stone_Diff.CreatePredictEngine() in C:\Users\rares\Documents\Misc Programs\Sand Castle\Stone Diff.consumption.cs:line 68
at Sand_Castle.Stone_Diff.<>c.<.cctor>b__9_0() in C:\Users\rares\Documents\Misc Programs\Sand Castle\Stone Diff.consumption.cs:line 52
at System.Lazy`1.CreateValue()

Inner Exception 1:
TargetInvocationException: Exception has been thrown by the target of an invocation.

Inner Exception 2:
FileLoadException: Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Inner Exception 3:
FileLoadException: Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
in the consumption.cs
Pobiega
Pobiega15mo ago
hm, did you remove the generated project? the one for .net 6 if not, do that, and clean solution
Eris
ErisOP15mo ago
done that, same issue
Pobiega
Pobiega15mo ago
well, you'll need to track down why its trying to import a .net 6 version of System.Runtime.CompilerServices.Unsafe
Eris
ErisOP15mo ago
exquisite question
Pobiega
Pobiega15mo ago
removing the .vs folder in the project might help
Eris
ErisOP15mo ago
did that, cleaned and rebuilt, got this thonk if I just make a new project, retrain a model, never add a sample console app and try again lol
Pobiega
Pobiega15mo ago
worth a try 🙂 might even be able to just copy the trained model over
Eris
ErisOP15mo ago
hmm how would I import it into the new project
Pobiega
Pobiega15mo ago
just copy the file and add it to the project declaration but eh, if it wasnt too bad retraining works too
Eris
ErisOP15mo ago
it's just a couple hours using CPU training on ~40k images
Pobiega
Pobiega15mo ago
I mean, copying the file and fixing the csproj should be... 2-3 minutes ? 😄
Eris
ErisOP15mo ago
I copied the .mbconfig and all its .cs files, as well as the model .zip itself
Pobiega
Pobiega15mo ago
yep, then look in your original csproj and copy the related entries
Eris
ErisOP15mo ago
hoookay, added all the needed NuGet packages, fixed a couple file path issues, same error as before
Pobiega
Pobiega15mo ago
try looking inside the zip file i have no idea whats in there but maybe there is some .net 6 stuff
Eris
ErisOP15mo ago
a few .key files, a few files with no extension, a TXT with my two categories it's supposed to sort stuff in, and a TXT called Version with the text 2.0.0-preview.22314.3+f99825a1bfdbf45463fff994735caee6eacdce78 no clue as to what any of them do ooh okay, so I've updated all the nuget packages, there was missing a dll that I copied from the previous project, now I'm getting this output in the console
2023-09-23 11:39:56.675871: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN)to use the following CPU instructions in performance-critical operations: AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2023-09-23 11:39:56.684204: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x2d5694577a0 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2023-09-23 11:39:56.684270: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version
Sand_Castle.Stone_Diff+ModelOutput
2023-09-23 11:39:56.675871: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN)to use the following CPU instructions in performance-critical operations: AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2023-09-23 11:39:56.684204: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x2d5694577a0 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2023-09-23 11:39:56.684270: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version
Sand_Castle.Stone_Diff+ModelOutput
Pobiega
Pobiega15mo ago
cool, so it actually runs
Eris
ErisOP15mo ago
yup, now it runs no idea what that output is though different from what it showed in the sample output of the .mbconfig
Pobiega
Pobiega15mo ago
Sand_Castle.Stone_Diff+ModelOutput looks like what happens if someone does Console.WriteLine(x) on an object that doesnt override tostring
Eris
ErisOP15mo ago
Hmm So then how do I use the output lmao
Pobiega
Pobiega15mo ago
¯\_(ツ)_/¯ Can you show your program.cs code?
Eris
ErisOP15mo ago
Just this again
Pobiega
Pobiega15mo ago
Console.WriteLine(Convert.ToString(result)); kekw thats the source of your problem you need to access the properties on result, and/or implement ToString on it
Eris
ErisOP15mo ago
Well I didn't know how exactly it would output lol Okay, will figure this out somehow, thank you for your help though <3 just in case you're wondering, I got it to work fully and it does exactly what I wanted it to, wrote it in as Console.WriteLine(result.PredictedLabel + " with " + result.Score[1] + "confidence."); I was able to remove the .mbconfig file and its associated .cs files altogether, I just copy-pasted the class from consumption into the Program.cs and all is well, thank you again for your help ^-^
Want results from more Discord servers?
Add your server