经 AI Skill Hub 精选评估,TensorSharp 获评「强烈推荐」。这款AI工具在功能完整性、社区活跃度和易用性方面表现出色,AI 评分 8.0 分,适合有一定技术背景的用户使用。
TensorSharp 是一款基于 C# 开发的开源工具,专注于 LLM、C#、GGU 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
TensorSharp 是一款基于 C# 开发的开源工具,专注于 LLM、C#、GGU 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
# 克隆仓库 git clone https://github.com/zhongkaifu/TensorSharp cd TensorSharp # 查看安装说明 cat README.md # 按 README 完成环境依赖安装后即可使用
# 查看帮助 tensorsharp --help # 基本运行 tensorsharp [options] <input> # 详细使用说明请查阅文档 # https://github.com/zhongkaifu/TensorSharp
# tensorsharp 配置说明 # 查看配置选项 tensorsharp --config-example > config.yml # 常见配置项 # output_dir: ./output # log_level: info # workers: 4 # 环境变量(覆盖配置文件) export TENSORSHARP_CONFIG="/path/to/config.yml"
<p align="center"> <img src="imgs/banner_1.png" alt="TensorSharp logo" width="320"> </p>
TensorSharp is a .NET 10 inference engine for local GGUF models. Run it on Windows, macOS or Linux through the CLI, browser chat, or Ollama/OpenAI-compatible APIs, or embed it in your own .NET application. Use managed C# CPU kernels or native CUDA, Metal and Vulkan backends, with support that varies by model.
Current source covers text and reasoning, multimodal input, embeddings, image generation/editing, video with audio, personal knowledge collections, and Agent Skills with code tools. TensorSharp also powers TensorAgent, the local app for iPhone, iPad, Mac and Windows. Start below, or check the project status for capabilities and validation limits.
<p align="center"> <a href="https://trendshift.io/repositories/51351#achievements"><img src="https://trendshift.io/api/badge/repositories/51351" alt="TensorSharp on GitHub Trending: #2 Repository Of The Day" width="250" height="55"></a> <a href="https://trendshift.io/repositories/51351#achievements"><img src="https://trendshift.io/api/badge/trendshift/repositories/51351/daily?language=C%23" alt="TensorSharp on Trendshift: #5 C# Repository Of The Day" width="250" height="55"></a> </p>
TensorSharp.AgentHost adds file, shell and document workflows. The 17 bundled skills include research, documents, TDD, design interviews and handoff; find-skills searches, inspects and installs additional skills when network access is enabled. Server and TensorAgent chats also support bounded sub-agent delegation with private workspaces and read-only defaults.Download the latest release and expand Assets. Choose a file beginning with tensoragent-desktop-:
| Platform | Download and install |
|---|---|
| **macOS 14+ on Apple Silicon** | tensoragent-desktop-<version>-osx-arm64.dmg: open and drag TensorAgent to Applications. A PKG installer and ZIP are also available. |
| **Windows x64** | tensoragent-desktop-<version>-win-x64-cpu.msi, or win-x64-cuda.msi for a compatible NVIDIA GPU/driver: install and open TensorAgent from Start. ZIPs are also available. |
The app includes its .NET runtime and native engine. Windows needs WebView2 Evergreen Runtime if missing; Python/Node are optional tools for skills. The current built-in catalog needs at least 12 GB system RAM, and model weights download separately. Open ☰ → Models → Download → Use, then type a message. The Desktop user guide covers package verification, unsigned-app prompts, first-run setup, attachments, skills, updates and troubleshooting. Historical releases may have no Desktop assets until a release runs the updated workflow; iPhone/iPad remain source builds.
The Releases page provides self-contained CLI and Server archives for Windows x64 (CPU/CUDA), Linux x64 (CPU/CUDA), and macOS arm64.
To build from source you need the full .NET 10 SDK (how to install it), git, curl, CMake 3.20+, and the toolchain for your GPU. Then run the verified Gemma 4 E4B model (7.48 GiB). On Windows with an NVIDIA GPU (PowerShell):
git clone https://github.com/zhongkaifu/TensorSharp.git; Set-Location TensorSharp
New-Item -ItemType Directory -Force models | Out-Null
curl.exe -L --fail "https://huggingface.co/ggml-org/gemma-4-E4B-it-GGUF/resolve/main/gemma-4-E4B-it-Q8_0.gguf?download=true" -o models\gemma-4-E4B-it-Q8_0.gguf
'Answer in one short sentence: what is TensorSharp?' | Set-Content prompt.txt
$env:TENSORSHARP_GGML_NATIVE_ENABLE_CUDA = 'ON'
dotnet run --project TensorSharp.Cli -c Release -p:TensorSharpSkipMlxNative=true -- --model models\gemma-4-E4B-it-Q8_0.gguf --input prompt.txt --max-tokens 128 --backend ggml_cuda
On other machines, change the backend (see Pick a backend):
--backend ggml_metal.dotnet run with TENSORSHARP_GGML_NATIVE_ENABLE_CUDA=ON and use --backend ggml_cuda.TENSORSHARP_GGML_NATIVE_ENABLE_VULKAN=ON and use --backend ggml_vulkan.Host the same model as a server: a browser chat at <http://localhost:5000> plus Ollama- and OpenAI-compatible APIs.
dotnet run --project TensorSharp.Server.Host -c Release -p:TensorSharpSkipMlxNative=true -- --model models/gemma-4-E4B-it-Q8_0.gguf --backend ggml_cuda --max-tokens 512
The server listens on 0.0.0.0:5000 with no built-in authentication or TLS; keep it behind a firewall or an authenticated HTTPS reverse proxy.
TensorSharp 是一个专为 C# 开发设计的本地推理引擎,旨在高效运行 GGUF 格式的语言模型。它不仅支持自回归 LLM,还涵盖了 DiffusionGemma 风格的文本扩散模型。项目提供了功能丰富的控制台应用程序(Console App)和基于 Web 的聊天机器人界面,并内置了兼容 Ollama 和 OpenAI 标准的 HTTP API,方便开发者快速集成到现有工作流中。
TensorSharp 具备顶级的推理性能��架构支持。它实现了类似 vLLM 的 Continuous batching 与 paged KV cache 技术,通过迭代级调度器显著提升吞吐量;支持 MTP / NextN 推测解码技术,加速 Qwen 3.6 和 Gemma 4 的单次解码速度。此外,它原生支持 Gemma 4、Qwen 3 系列等多种架构,并具备强大的多模态推理能力(支持图像、视频、音频输入)以及结构化的 Thinking / reasoning 模式。
在使用 TensorSharp 之前,请确保您的开发环境已安装 .NET 10 SDK 以及 git。为了获得最佳的硬件加速性能,建议配置相应的 GPU 工具链:NVIDIA 用户需安装 CUDA Toolkit 12.x;Apple Silicon 用户需安装 Xcode command-line tools 以启用 Metal 加速。此外,构建过程会自动从 GitHub 克隆 ggml 源码,因此需要稳定的网络访问权限。
您可以直接通过源码构建整个解决方案。首先克隆仓库,然后在终端执行 `dotnet build TensorSharp.slnx` 进行完整编译。如果仅需构建特定的应用程序,可以进入对应的项目目录进行编译。构建完成后,CLI 二进制文件将位于 `TensorSharp.Cli/bin/...`,而 Server 端程序则位于 `TensorSharp.Server/bin/...`。
TensorSharp 提供了极速的上手体验,从模型下载到实现流式回复仅需约 30 ��。首先请确保已准备好 .NET 10 SDK 和必要的 GPU 工具链(如 CUDA 或 Metal)。完成源码克隆与编译后,即可通过命令行工具启动模型。对于需要 Web 界面的用户,可以直接运行 Server 端程序,通过浏览器进行交互式对话。
您可以根据需求对 Server 端进行全局配置。通过调整采样参数(Sampling parameters),开发者可以精细化控制模型输出的随机性与创造力。所有的服务器级默认参数均可在配置文件中进行统一管理,确保在不同的推理场景下都能获得预期的生成效果。
TensorSharp 内置了高性能的 HTTP 服务,启动后可通过 http://localhost:5000 进行访问。该服务不仅提供 Web 界面,还完全兼容 Ollama 和 OpenAI 的 API 标准,这意味着您可以无缝地将 TensorSharp 替换到现有的 AI 应用生态中,实现低成本的本地化部署与迁移。
为了提高模块化程度,TensorSharp 采用了基于 NuGet Package 的分层架构设计。开发者可以根据实际需求,仅依赖所需的特定层,而无需引入整个项目。核心层 `TensorSharp.Core` 负责处理 Tensor 原语、算子(Ops)、分配器(Allocators)及存储(Storage)等底层逻辑,确保了高性能与轻量化并存。
高性能的C#推理引擎,支持本地运行LLM
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ BSD 3-Clause — 宽松协议,可商用修改分发,禁止使用原作者名称进行背书宣传。
AI Skill Hub 点评:TensorSharp 的核心功能完整,质量优秀。对于AI 技术爱好者来说,这是一个值得纳入个人工具库的选择。建议先在非生产环境试用,再逐步推广。
| 原始名称 | TensorSharp |
| 原始描述 | 开源AI工具:A C# inference engine for running large language models (LLMs) locally using GGU。⭐100 · C# |
| Topics | LLMC#GGUinference |
| GitHub | https://github.com/zhongkaifu/TensorSharp |
| License | BSD-3-Clause |
| 语言 | C# |
收录时间:2026-06-17 · 更新时间:2026-06-20 · License:BSD-3-Clause · AI Skill Hub 不对第三方内容的准确性作法律背书。