Galosys.Foundation.ML 26.9.10.1

dotnet add package Galosys.Foundation.ML --version 26.9.10.1
                    
NuGet\Install-Package Galosys.Foundation.ML -Version 26.9.10.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.9.10.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.9.10.1" />
                    
Directory.Packages.props
<PackageReference Include="Galosys.Foundation.ML" />
                    
Project file
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.9.10.1
                    
#r "nuget: Galosys.Foundation.ML, 26.9.10.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.9.10.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.9.10.1
                    
Install as a Cake Addin
#tool nuget:?package=Galosys.Foundation.ML&version=26.9.10.1
                    
Install as a Cake Tool

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 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.

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.9.10.1 0 9/10/2026
26.9.3.1 86 9/3/2026
26.8.29.1 85 8/31/2026
26.8.26.1 86 8/26/2026
26.8.23.1 85 8/23/2026
26.8.21.1 94 8/21/2026
26.8.20.1 85 8/20/2026
26.8.18.1 91 8/18/2026
26.8.17.1 94 8/17/2026
26.8.13.2 98 8/13/2026
26.8.13.1 92 8/13/2026
26.8.12.2 92 8/12/2026
26.8.12.1 93 8/12/2026
26.8.10.1 95 8/10/2026
26.8.5.1 101 8/5/2026
26.8.4.1 98 8/4/2026
26.8.3.1 102 8/3/2026
26.7.31.1 109 7/31/2026
26.7.30.1 102 7/30/2026
26.7.29.1 100 7/29/2026
Loading failed