Galosys.Foundation.ML
26.10.29.1
dotnet add package Galosys.Foundation.ML --version 26.10.29.1
NuGet\Install-Package Galosys.Foundation.ML -Version 26.10.29.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Galosys.Foundation.ML" Version="26.10.29.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Galosys.Foundation.ML" Version="26.10.29.1" />
<PackageReference Include="Galosys.Foundation.ML" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Galosys.Foundation.ML --version 26.10.29.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Galosys.Foundation.ML, 26.10.29.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Galosys.Foundation.ML@26.10.29.1
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Galosys.Foundation.ML&version=26.10.29.1
#tool nuget:?package=Galosys.Foundation.ML&version=26.10.29.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Galosys.Foundation.ML
ML.NET 推理模块,提供统一的 DI 注册、可测试预测接口和模型生命周期管理。
快速开始
安装
在 appsettings.json 中配置模型路径:
{
"ML": {
"Models": [
{ "Name": "default", "Path": "Models/my-model.zip" }
]
}
}
注册
// Program.cs
builder.Services.AddML(builder.Configuration);
builder.Services.AddPredictor<SentimentInput, SentimentOutput>("Models/sentiment-model.zip");
或从配置读取路径:
builder.Services.AddPredictorFromConfig<SentimentInput, SentimentOutput>(builder.Configuration);
使用
public class SentimentController
{
private readonly IPredictor<SentimentInput, SentimentOutput> _predictor;
public SentimentController(IPredictor<SentimentInput, SentimentOutput> predictor)
{
_predictor = predictor;
}
public async Task<IActionResult> Predict(SentimentInput input)
{
var result = await _predictor.PredictAsync(input);
return Ok(result);
}
}
配置
| 配置项 | 默认值 | 说明 |
|---|---|---|
ML:Models |
- | 模型列表 |
Name |
"default" | 模型名称 |
Path |
"Models/default.zip" | 模型文件路径 (.zip / .onnx) |
WatchForChanges |
true | 是否监听文件变更自动重载 |
PoolSize |
1024 | PredictionEnginePool 对象池大小 |
接口
IPredictor<TInput, TOutput>— 通用预测接口,支持单条和批量预测
健康检查
模块自动注册 ml-models 健康检查,验证所有配置的模型文件是否存在。
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Galosys.Foundation.Core (>= 26.10.29.1)
- microsoft.extensions.ml (>= 4.0.2)
- microsoft.ml (>= 4.0.2)
- microsoft.ml.tokenizers (>= 1.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 26.10.29.1 | 106 | 10/29/2026 |
| 26.10.20.1 | 97 | 10/20/2026 |
| 26.10.16.2 | 97 | 10/16/2026 |
| 26.10.16.1 | 97 | 10/16/2026 |
| 26.10.9.1 | 101 | 10/9/2026 |
| 26.10.8.1 | 106 | 10/8/2026 |
| 26.9.23.1 | 119 | 9/23/2026 |
| 26.9.16.1 | 113 | 9/16/2026 |
| 26.9.15.1 | 113 | 9/15/2026 |
| 26.9.14.1 | 105 | 9/14/2026 |
| 26.9.10.1 | 129 | 9/10/2026 |
| 26.9.3.1 | 132 | 9/3/2026 |
| 26.8.29.1 | 127 | 8/31/2026 |
| 26.8.26.1 | 126 | 8/26/2026 |
| 26.8.23.1 | 120 | 8/23/2026 |
| 26.8.21.1 | 126 | 8/21/2026 |
| 26.8.20.1 | 116 | 8/20/2026 |
| 26.8.18.1 | 125 | 8/18/2026 |
| 26.8.17.1 | 124 | 8/17/2026 |
| 26.8.13.2 | 124 | 8/13/2026 |
Loading failed