TensorStack.HuggingFace 0.14.2

Prefix Reserved
dotnet add package TensorStack.HuggingFace --version 0.14.2
                    
NuGet\Install-Package TensorStack.HuggingFace -Version 0.14.2
                    
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="TensorStack.HuggingFace" Version="0.14.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TensorStack.HuggingFace" Version="0.14.2" />
                    
Directory.Packages.props
<PackageReference Include="TensorStack.HuggingFace" />
                    
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 TensorStack.HuggingFace --version 0.14.2
                    
#r "nuget: TensorStack.HuggingFace, 0.14.2"
                    
#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 TensorStack.HuggingFace@0.14.2
                    
#: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=TensorStack.HuggingFace&version=0.14.2
                    
Install as a Cake Addin
#tool nuget:?package=TensorStack.HuggingFace&version=0.14.2
                    
Install as a Cake Tool

TensorStack.HuggingFace

Basic .NET Wrapper API for HuggingFace Diffusers & Transformers

Python Pipelines

Generate an image using Qwen-Image-Edit

using (var backend = new HuggingFaceBackend(VendorType.Nvidia))
{
    await backend.InitializeAsync();

    // Pipeline Config
    var pipelineConfig = new PipelineConfig
    {
        Path = "Qwen/Qwen-Image-Edit",
        Pipeline = "QwenImagePipeline",
        ProcessType = ProcessType.ImageEdit,
        DataType = DataType.Bfloat16,
        MemoryMode = MemoryModeType.OffloadCPU
    };

    // Create Pipeline Proxy
    using (var pythonPipeline = new PythonPipeline(pipelineConfig, PipelineProgress.ConsoleCallback))
    {
        // Download/Load Model
        await pythonPipeline.LoadAsync();

        // Generate Option
        var options = new PipelineOptions
        {
            Prompt = "Yarn art style",
            Steps = 30,
            Width = 1024,
            Height = 1024,
            GuidanceScale = 4f,
            Scheduler = SchedulerType.FlowMatchEulerDiscrete,
            ImageInput = new ImageInput("Image.png")
        };

        // Generate
        var response = await pythonPipeline.GenerateAsync(options);

        // Save Image
        await response
            .AsImageTensor()
            .SaveAsync("Result.png");
    }
}

HuggingFace Backends

The HuggingFaceBackend class to manage HuggingFace backend environments. You can initialize a backend using built-in vendor configurations or provide a custom configuration to control its version, installation directory, and requirements.

Basic Documentation
// Create a backend using built-in vendor defaults.
var backend = new HuggingFaceBackend(VendorType.Nvidia);

// Initialize the environment.
// Attempts to load an existing environment, update it if loading
// fails, or create a new environment if necessary.
bool initialized = await backend.InitializeAsync();

// Load the environment directly.
bool loaded = await backend.LoadAsync();

// Perform a specific setup operation.
bool updated = await backend.SetupAsync(BackendStatus.Update);

// Delete the backend environment.
bool deleted = await backend.DeleteAsync();

// Check whether the backend environment exists.
bool exists = backend.Exists();


// ============================================================
// Backend Setup Operations
// ============================================================
// Create   - Create a new environment.
// Load     - Load operation status.
// Update   - Update an existing environment.
// Rebuild  - Rebuild the environment.
// Reinstall - Reinstall the environment.

bool success = await backend.SetupAsync(BackendStatus.Create);


// ============================================================
// Custom Configuration
// ============================================================
// Name          - Backend name
// Version       - Python version (Supported: 3.12, 3.13, 3.14)
// Directory     - Backend directory
// Requirements  - List of python package requiremnets.

// Define a custom backend configuration.
var customConfiguration = new BackendConfig
{
    Name = "cuda",
    Version = "3.12",
    Directory = "HuggingFace",
    Requirements =
    [
        "your custom python requirements",

        // Include Default Requirements
        .. HuggingFaceBackend.DefaultRequirements
    ]
};

// Create a backend using the custom configuration.
var customBackend = new HuggingFaceBackend(customConfiguration);


// ============================================================
// Built-in Configuration Customization
// ============================================================

// Retrieve a built-in vendor configuration.
BackendConfig configuration = HuggingFaceBackend.GetConfig(VendorType.Nvidia);

// Create a modified copy of the configuration.
// BackendConfig is a record, so the original remains unchanged.
var modifiedConfiguration = configuration with
{
    Name = "cuda-test",
    Version = "3.14",
    Directory = "My Location"
};

// Create a backend using the modified configuration.
var modifiedBackend = new HuggingFaceBackend(modifiedConfiguration);
Product Compatible and additional computed target framework versions.
.NET net10.0-windows10.0.17763 is compatible. 
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
0.14.2 0 10/20/2026
0.14.1 103 10/16/2026
0.13.13 94 10/11/2026
0.13.12 92 10/10/2026
0.13.10 114 10/6/2026
0.13.9 87 10/5/2026
0.13.8 100 10/4/2026
0.13.7 96 10/4/2026
0.13.6 105 10/2/2026
0.13.5 104 9/30/2026
0.13.4 111 9/27/2026
0.13.3 101 9/25/2026
0.13.2 101 9/25/2026
0.13.1 116 9/21/2026
0.13.0 96 9/20/2026
0.12.11 142 9/12/2026
0.12.9 100 9/11/2026
0.12.7 121 9/7/2026