StanzaSharp.Cuda 1.5.0

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

StanzaSharp.Cuda

The TorchSharp (libtorch) backend for StanzaSharp, Stanza's English NLP pipeline in .NET: it runs the same models on an NVIDIA GPU, or on libtorch's CPU kernels. StanzaSharp alone runs them on its managed backend, with no native dependencies; add this package only for a GPU (or to compare with libtorch).

Install

dotnet add package StanzaSharp.Cuda
dotnet add package TorchSharp-cuda-windows   # or TorchSharp-cuda-linux; TorchSharp-cpu for the CPU

The native package's version must match the TorchSharp version this package depends on (0.107.0); otherwise the build warns with STANZA001 (<NoWarn>STANZA001</NoWarn> silences it). On macOS (Apple Silicon, CPU only), also run brew install libomp.

Use

using StanzaSharp;

using var nlp = Pipeline.Load("models/stanza/en", new PipelineOptions { Backend = CudaBackend.Create(disableTf32: true) });
var doc = nlp.Process("Barack Obama was born in Hawaii.");
  • CudaBackend.Create(deviceIndex = 0, disableTf32 = false): the GPU. disableTf32: true gives output identical to the CPU (and so to Python Stanza) by turning TF32 off process-wide; with TF32 on, libtorch's default, a few near-tie decisions can differ.
  • CudaBackend.Cpu: libtorch on the CPU, with TorchSharp-cpu (or one platform's libtorch-cpu-<rid> 2.10.0).
  • <StanzaSharpTrimNative>true</StanzaSharpTrimNative> leaves out the CPU libtorch files StanzaSharp never loads (35 MB on Linux x64, 29 MB on macOS).

Everything else (downloading the models, the document model, CoNLL-U, options) is StanzaSharp's; see its readme and the repository's docs/gpu.md for GPU measurements.

License

Apache 2.0, like Stanza, whose code StanzaSharp ports; see NOTICE. The models have their own licenses, which vary with their training data.

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
1.5.0 0 10/13/2026
1.4.0 25 10/13/2026
1.3.0 41 10/12/2026
1.2.0 45 10/12/2026
1.1.0 48 10/12/2026
1.0.0 53 10/10/2026