能力标签
TensorSharp
🛠
AI工具

TensorSharp

基于 C# · 开源免费,本地部署,数据完全自主可控
⭐ 100 Stars 🍴 5 Forks 💻 C# 📄 BSD-3-Clause 🏷 AI 8.0分
8.0AI 综合评分
LLMC#GGUinference
✦ AI Skill Hub 推荐

经 AI Skill Hub 精选评估,TensorSharp 获评「强烈推荐」。这款AI工具在功能完整性、社区活跃度和易用性方面表现出色,AI 评分 8.0 分,适合有一定技术背景的用户使用。

📚 深度解析

TensorSharp 是一款基于 C# 的开源工具,在 GitHub 上收获 0k+ Star,是LLM、C#、GGU、inference领域中的优质开源项目。开源工具的最大优势在于代码完全透明,你可以审计每一行代码的安全性,也可以根据自身需求进行二次开发和定制。

**为什么要使用开源工具而非商业 SaaS?**
对于个人开发者和有隐私需求的用户,本地部署的开源工具意味着数据不离本机,不受第三方服务商的数据政策约束。同时,开源工具通常没有使用次数限制和月度费用,一次安装即可长期使用,对于高频使用场景的总拥有成本(TCO)远低于订阅制商业工具。

**安装与环境准备**
TensorSharp 依赖 C# 运行环境。建议通过 pyenv(Python)或 nvm(Node.js)管理 C# 版本,避免全局环境污染。对于新手用户,推荐先创建虚拟环境(python -m venv venv && source venv/bin/activate),再安装依赖,这样即使出现问题也可以随时删除虚拟环境重新开始,不影响系统稳定性。

**社区与维护**
GitHub Issue 和 Discussion 是获取帮助的最快渠道。在提问前建议先检查 Closed Issues(已关闭的问题),大多数常见问题都已有解答。遇到 Bug 时,提供 pip list 的输出、完整错误堆栈和最小可复现示例,能显著提高开发者响应速度。AI Skill Hub 将持续追踪 TensorSharp 的版本更新,及时通知重要功能变化。

📋 工具概览

TensorSharp 是一款基于 C# 开发的开源工具,专注于 LLM、C#、GGU 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。

GitHub Stars
⭐ 100
开发语言
C#
支持平台
Windows / macOS / Linux
维护状态
轻量级项目,按需更新
开源协议
BSD-3-Clause
AI 综合评分
8.0 分
工具类型
AI工具
Forks
5

📖 中文文档

以下内容由 AI Skill Hub 根据项目信息自动整理,如需查看完整原始文档请访问底部「原始来源」。

TensorSharp 是一款基于 C# 开发的开源工具,专注于 LLM、C#、GGU 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。

📌 核心特色
  • 开源免费,支持本地部署,数据完全自主可控
  • 活跃的 GitHub 开源社区,持续迭代更新
  • 提供详细文档和使用示例,新手友好
  • 支持自定义配置,灵活适配不同使用环境
  • 可作为基础组件集成进现有技术栈或进行二次开发
🎯 主要使用场景
  • 本地部署运行,保护数据隐私,满足合规要求
  • 自定义集成到现有系统,扩展技术栈能力
  • 作为开源基础组件进行商业化二次开发
以下安装命令基于项目开发语言和类型自动生成,实际以官方 README 为准。
安装命令
# 克隆仓库
git clone https://github.com/zhongkaifu/TensorSharp
cd TensorSharp

# 查看安装说明
cat README.md

# 按 README 完成环境依赖安装后即可使用
📋 安装步骤说明
  1. 访问 GitHub 仓库页面
  2. 按照 README 文档完成依赖安装
  3. 根据系统环境完成初始化配置
  4. 参考官方示例或文档开始使用
  5. 遇到问题可在 GitHub Issues 中查找解答
以下用法示例由 AI Skill Hub 整理,涵盖最常见的使用场景。
常用命令 / 代码示例
# 查看帮助
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"
📑 README 深度解析 真实文档 完整度 56/100 查看 GitHub 原文 →
以下内容由系统直接从 GitHub README 解析整理,保留代码块、表格与列表结构。

TensorSharp

<p align="center"> <img src="imgs/banner_1.png" alt="TensorSharp logo" width="320"> </p>

English | 中文

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>

Highlights

  • Local models, several interfaces. One engine for CLI use, browser chat and Ollama/OpenAI-compatible APIs, across managed CPU and native accelerator backends.
  • Text and multimodal models. Dense and MoE GGUF models, reasoning, image/audio input and document questions. See Supported models for each family's capabilities.
  • Embeddings and media generation. EmbeddingGemma 2 provides text/code embeddings and optional image, audio and video inputs. Generate and edit images with Qwen-Image-2.1 and Turbo, or generate video with stereo audio using LTX 2.5 Distilled (48 kHz) and MiniMax-H3 (32 kHz).
  • Editable video projects. Video Studio in WebUX Chat and TensorAgent shares a persistent multitrack editor, native generation jobs, reviewed agent proposals, undo/redo and local FFmpeg export. Long videos are made as chains of takes, each starting on the previous segment's last frame; reference photos keep a character in new shots. See the validation matrix for tested models and platform limits.
  • Efficient serving. Continuous batching and a paged, Radix prefix-shared KV cache are on by default. Speculative decoding and multi-GPU placement are available for supported models. See Features.
  • Agent Skills and code tools. 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.
  • Personal knowledge collections. Upload files or nested folders, and import saved chats with their attachments and artifacts. Select collections per chat, retrieve cited excerpts with page/row/time locations, preview originals, or let code agents open full datasets. Local BM25 works by default; optional GGUF embeddings add semantic search, and compatible media models index images, audio and sampled video. Extraction status and warnings show coverage limits.
  • Steer an active response. Submit a new instruction while the CLI, server Web UI or TensorAgent is reasoning or answering. The next response uses the conversation, partial output and your guidance; Stop remains available.
  • Latest recorded comparisons. DeepSeek V4.1 Flash 1017 on five A40 GPUs and Muse Spark on ten have workload-specific comparisons against llama.cpp. In the matched ~1.8K DeepSeek prompt, exact TP5 prefill was 3.23× the reference rate; default approximate YOCO was 5.50× with a measured quality trade-off. See Benchmarks for the exact settings, slower cells and limitations.
  • TensorAgent apps. Local chat, attachments, skills and saved work on phones and desktops. See the Mac/Windows installation guide and app coverage notes.

TensorAgent Desktop: download, install, chat

Download the latest release and expand Assets. Choose a file beginning with tensoragent-desktop-:

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

Quick Start

TensorSharp CLI and server

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):

  • macOS (Apple Silicon): drop the CUDA environment variable and use --backend ggml_metal.
  • Linux + NVIDIA: prefix the dotnet run with TENSORSHARP_GGML_NATIVE_ENABLE_CUDA=ON and use --backend ggml_cuda.
  • AMD / Intel / NVIDIA Vulkan: set 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.
🇨🇳 中文文档镜像 AI 翻译 2026-06-18
英文原文章节由系统翻译为中文摘要,便于快速理解。完整原文见上方 "📑 README 深度解析"。
📌 简介

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 源码,因此需要稳定的网络访问权限。

🛠 安装步骤(Docker/pip/源码)

您可以直接通过源码构建整个解决方案。首先克隆仓库,然后在终端执行 `dotnet build TensorSharp.slnx` 进行完整编译。如果仅需构建特定的应用程序,可以进入对应的项目目录进行编译。构建完成后,CLI 二进制文件将位于 `TensorSharp.Cli/bin/...`,而 Server 端程序则位于 `TensorSharp.Server/bin/...`。

🚀 使用教程

TensorSharp 提供了极速的上手体验,从模型下载到实现流式回复仅需约 30 ��。首先请确保已准备好 .NET 10 SDK 和必要的 GPU 工具链(如 CUDA 或 Metal)。完成源码克隆与编译后,即可通过命令行工具启动模型。对于需要 Web 界面的用户,可以直接运行 Server 端程序,通过浏览器进行交互式对话。

⚙️ 配置说明(含 MCP / env)

您可以根据需求对 Server 端进行全局配置。通过调整采样参数(Sampling parameters),开发者可以精细化控制模型输出的随机性与创造力。所有的服务器级默认参数均可在配置文件中进行统一管理,确保在不同的推理场景下都能获得预期的生成效果。

🔌 API 说明

TensorSharp 内置了高性能的 HTTP 服务,启动后可通过 http://localhost:5000 进行访问。该服务不仅提供 Web 界面,还完全兼容 Ollama 和 OpenAI 的 API 标准,这意味着您可以无缝地将 TensorSharp 替换到现有的 AI 应用生态中,实现低成本的本地化部署与迁移。

🔄 工作流/模块

为了提高模块化程度,TensorSharp 采用了基于 NuGet Package 的分层架构设计。开发者可以根据实际需求,仅依赖所需的特定层,而无需引入整个项目。核心层 `TensorSharp.Core` 负责处理 Tensor 原语、算子(Ops)、分配器(Allocators)及存储(Storage)等底层逻辑,确保了高性能与轻量化并存。

🎯 aiskill88 AI 点评 A 级 2026-06-17

高性能的C#推理引擎,支持本地运行LLM

📚 实用指南(长尾问题)
适合谁
  • 需要 TensorSharp 解决具体问题的开发者与运营人员
最佳实践
  • 先在测试环境跑通最小用例,再接入生产数据
常见错误
  • API key 直接提交到 git 仓库(请用 .env 并加入 .gitignore)
部署方案
  • 云端托管:可放在 Vercel / Railway / Fly.io 等 PaaS 平台
相关搜索
TensorSharp 中文教程TensorSharp 安装报错怎么办TensorSharp 与同类工具对比TensorSharp 最佳实践TensorSharp 适合谁用

⚡ 核心功能

👥 适合谁
  • 需要 TensorSharp 解决具体问题的开发者与运营人员
⭐ 最佳实践
  • 先在测试环境跑通最小用例,再接入生产数据
⚠️ 常见错误
  • API key 直接提交到 git 仓库(请用 .env 并加入 .gitignore)

👥 适合人群

AI 技术爱好者研究人员和学生开发者和工程师技术创业者

🎯 使用场景

  • 本地部署运行,保护数据隐私,满足合规要求
  • 自定义集成到现有系统,扩展技术栈能力
  • 作为开源基础组件进行商业化二次开发

⚖️ 优点与不足

✅ 优点
  • +BSD-3-Clause 协议,可免费商用
  • +完全开源免费,无授权费用
  • +本地部署,数据完全自主可控
  • +开发者社区支持,遇问题可查可问
⚠️ 不足
  • −安装和初始配置可能需要一定技术基础
  • −功能完整性通常不如成熟商业产品
  • −技术支持主要依赖开源社区,响应速度不稳定
⚠️ 使用须知

AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。

建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。

📄 License 说明

✅ BSD 3-Clause — 宽松协议,可商用修改分发,禁止使用原作者名称进行背书宣传。

🔗 相关工具推荐

📚 相关教程推荐
📰 相关 AI 新闻
🍿 AI 圈相关吃瓜
🗺️ 相关解决方案
🧩 你可能还需要
基于当前 Skill 的能力图谱,自动补全的工具组合

❓ 常见问题 FAQ

TensorSharp 是一款C#开发的AI辅助工具。开源AI工具:A C# inference engine for running large language models (LLMs) locally using GGU。⭐100 · C# 主要应用场景包括:本地部署大型语言模型。
💡 AI Skill Hub 点评

AI Skill Hub 点评:TensorSharp 的核心功能完整,质量优秀。对于AI 技术爱好者来说,这是一个值得纳入个人工具库的选择。建议先在非生产环境试用,再逐步推广。

📚 深入学习 TensorSharp
查看分步骤安装教程和完整使用指南,快速上手这款工具
🌐 原始信息
原始名称 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#
🔗 原始来源
🐙 GitHub 仓库  https://github.com/zhongkaifu/TensorSharp 🌐 官方网站  https://tensorsharp.ai

收录时间:2026-06-17 · 更新时间:2026-06-20 · License:BSD-3-Clause · AI Skill Hub 不对第三方内容的准确性作法律背书。

📺 订阅 AI Skill Hub Daily Telegram 频道
每天 8 条精选 AI Skill、MCP、Agent 与自动化工具推送
加入频道 →