Kyutai's Pocket-TTS in C

April 11, 2026 ยท View on GitHub

Port of Kyutai/Pocket-TTS originally written in python using pytorch to C# with TorchSharp. This allows direct inference of the model's safetensors without having to convert it to onnx and use onnx runtime. The project has been vibecoded using Gemini-CLI with manual code review in between for validating output.

Dependencies

  • TorchSharp.PyBridge: allows loading and saving of .safetensors made for the pytorch library in TorchSharp.
  • SentencePieceWrapper: A C# wrapper for google's SentencePiece library for tokenization.

Right now only works on windows as SentencePieceWrapper.dll is specifically built for windows.

Subfolders

  • python: python source code which acts as the reference for the port.
  • csharp: the actual dotnet console project which is the C# port.
  • torchsharp: reference for Gemini to use the TorchSharp API.
  • TorchSharp.PyBridge: reference for Gemini to use the TorchSharp.PyBridge API.

Usage

  1. Download the nuget package from releases.
  2. Add package source:
dotnet add source [folder_containing_nupkg_file] --name [package_source_name]
  1. Add the package to your project:
dotnet add package PocketTTS --version [version] // version = 1.0.0

Check the example project to see how to use PocketTTS inside your application.