[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-microsoft--Llama-2-Onnx":3,"tool-microsoft--Llama-2-Onnx":61},[4,18,26,36,44,52],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":17},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[13,14,15,16],"Agent","开发框架","图像","数据工具","ready",{"id":19,"name":20,"github_repo":21,"description_zh":22,"stars":23,"difficulty_score":10,"last_commit_at":24,"category_tags":25,"status":17},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,"2026-04-05T11:01:52",[14,15,13],{"id":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":32,"last_commit_at":33,"category_tags":34,"status":17},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",141543,2,"2026-04-06T11:32:54",[14,13,35],"语言模型",{"id":37,"name":38,"github_repo":39,"description_zh":40,"stars":41,"difficulty_score":32,"last_commit_at":42,"category_tags":43,"status":17},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",107888,"2026-04-06T11:32:50",[14,15,13],{"id":45,"name":46,"github_repo":47,"description_zh":48,"stars":49,"difficulty_score":10,"last_commit_at":50,"category_tags":51,"status":17},4487,"LLMs-from-scratch","rasbt\u002FLLMs-from-scratch","LLMs-from-scratch 是一个基于 PyTorch 的开源教育项目，旨在引导用户从零开始一步步构建一个类似 ChatGPT 的大型语言模型（LLM）。它不仅是同名技术著作的官方代码库，更提供了一套完整的实践方案，涵盖模型开发、预训练及微调的全过程。\n\n该项目主要解决了大模型领域“黑盒化”的学习痛点。许多开发者虽能调用现成模型，却难以深入理解其内部架构与训练机制。通过亲手编写每一行核心代码，用户能够透彻掌握 Transformer 架构、注意力机制等关键原理，从而真正理解大模型是如何“思考”的。此外，项目还包含了加载大型预训练权重进行微调的代码，帮助用户将理论知识延伸至实际应用。\n\nLLMs-from-scratch 特别适合希望深入底层原理的 AI 开发者、研究人员以及计算机专业的学生。对于不满足于仅使用 API，而是渴望探究模型构建细节的技术人员而言，这是极佳的学习资源。其独特的技术亮点在于“循序渐进”的教学设计：将复杂的系统工程拆解为清晰的步骤，配合详细的图表与示例，让构建一个虽小但功能完备的大模型变得触手可及。无论你是想夯实理论基础，还是为未来研发更大规模的模型做准备",90106,"2026-04-06T11:19:32",[35,15,13,14],{"id":53,"name":54,"github_repo":55,"description_zh":56,"stars":57,"difficulty_score":10,"last_commit_at":58,"category_tags":59,"status":17},4292,"Deep-Live-Cam","hacksider\u002FDeep-Live-Cam","Deep-Live-Cam 是一款专注于实时换脸与视频生成的开源工具，用户仅需一张静态照片，即可通过“一键操作”实现摄像头画面的即时变脸或制作深度伪造视频。它有效解决了传统换脸技术流程繁琐、对硬件配置要求极高以及难以实时预览的痛点，让高质量的数字内容创作变得触手可及。\n\n这款工具不仅适合开发者和技术研究人员探索算法边界，更因其极简的操作逻辑（仅需三步：选脸、选摄像头、启动），广泛适用于普通用户、内容创作者、设计师及直播主播。无论是为了动画角色定制、服装展示模特替换，还是制作趣味短视频和直播互动，Deep-Live-Cam 都能提供流畅的支持。\n\n其核心技术亮点在于强大的实时处理能力，支持口型遮罩（Mouth Mask）以保留使用者原始的嘴部动作，确保表情自然精准；同时具备“人脸映射”功能，可同时对画面中的多个主体应用不同面孔。此外，项目内置了严格的内容安全过滤机制，自动拦截涉及裸露、暴力等不当素材，并倡导用户在获得授权及明确标注的前提下合规使用，体现了技术发展与伦理责任的平衡。",88924,"2026-04-06T03:28:53",[14,15,13,60],"视频",{"id":62,"github_repo":63,"name":64,"description_en":65,"description_zh":66,"ai_summary_zh":66,"readme_en":67,"readme_zh":68,"quickstart_zh":69,"use_case_zh":70,"hero_image_url":71,"owner_login":72,"owner_name":73,"owner_avatar_url":74,"owner_bio":75,"owner_company":65,"owner_location":65,"owner_email":76,"owner_twitter":77,"owner_website":78,"owner_url":79,"languages":80,"stars":93,"forks":94,"last_commit_at":95,"license":96,"difficulty_score":10,"env_os":97,"env_gpu":98,"env_ram":99,"env_deps":100,"category_tags":105,"github_topics":65,"view_count":32,"oss_zip_url":65,"oss_zip_packed_at":65,"status":17,"created_at":106,"updated_at":107,"faqs":108,"releases":109},4410,"microsoft\u002FLlama-2-Onnx","Llama-2-Onnx",null,"Llama-2-Onnx 是微软推出的 Llama 2 大语言模型优化版本，旨在通过 ONNX（开放神经网络交换）格式提升模型在本地设备上的运行效率。它解决了原始大模型部署困难、推理速度慢以及对硬件资源要求过高的问题，让开发者能够更轻松地将强大的生成式 AI 集成到各类应用中。\n\n该项目主要面向开发者和研究人员，提供了从 70 亿到 130 亿参数的多种精度版本（如 Float16\u002FFloat32），既包含预训练模型也包含针对对话场景微调的版本。其核心技术亮点在于采用了分组查询注意力机制（GQA）来优化架构，并利用 ONNX 运行时进行加速，显著降低了内存占用并提升了推理性能。\n\n为了方便上手，Llama-2-Onnx 不仅提供了最小化的命令行示例用于文本续写，还附带了基于 Gradio 的完整聊天机器人界面代码，用户只需简单配置即可体验流畅的对话交互。无论是希望探索大模型底层原理的研究者，还是致力于构建高效本地 AI 应用的工程师，都能从中获得便捷的开发支持。需要注意的是，使用前需遵循 Meta 的社区许可协议并完成相应的访问权限申请。","# **Llama 2 Powered By ONNX**\n\n**This is an optimized version of the Llama 2 model, available from Meta under the Llama Community License Agreement found on this repository. Microsoft permits you to use, modify, redistribute and create derivatives of Microsoft's contributions to the optimized version subject to the restrictions and disclaimers of warranty and liability in the Llama Community License agreement.**\n\n# **Before You Start**\nThe sub-modules that contain the ONNX files in this repository are access controlled.\nTo get access permissions to the Llama 2 model, please fill out the [Llama 2 ONNX sign up page](https:\u002F\u002Fgithub.com\u002Fllama2-onnx\u002Fsignup). If allowable, you will receive GitHub access in the next 48 hours, but usually much sooner.\n\n## **Cloning This Repository And The Submodules**\nBefore you begin, ensure you have Git LFS installed. Git LFS (Large File Storage) is used to handle large files efficiently. You can find out how to install Git LFS for your operating system at [https:\u002F\u002Fgit-lfs.com\u002F](https:\u002F\u002Fgit-lfs.com\u002F). \n\nNext, you can choose which version of the Llama 2 model you would like to use by selecting the appropriate submodule.\n\nChose from the following sub-modules:\n* 7B_FT_float16\n* 7B_FT_float32\n* 7B_float16\n* 7B_float32\n* 13B_FT_float16\n* 13B_FT_float32\n* 13B_float16\n* 13B_float32\n``` bash\ngit clone https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FLlama-2-Onnx.git\ncd Llama-2-Onnx\ngit submodule init \u003Cchosen_submodule> \ngit submodule update\n```\nYou can repeate the init command with a different submodule name to initialize multiple submodules. Be careful, the contained files are very large! (7B Float16 models are about 10GB)\n\n# **What is Llama 2?**\nLlama 2 is a collection of pretrained and fine-tuned generative text models. To learn more about Llama 2, review the [Llama 2 model card](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FLlama-2-Onnx\u002Fblob\u002Fmain\u002FMODEL-CARD-META-LLAMA-2.md).\n\n## **What Is The Structure Of Llama 2?**\nLlama 2 model consists of a stack of decoder layers. Each decoder layer (or transformer block) is constructed from one self-attention layer and one feed-forward multi-layer perceptron. Llama models use different projection sizes compared with classic transformers in the feed-forward layer, for instance, both Llama 1 and Llama 2 projection use 2.7x hidden size rather than the standard 4x hidden size. A key difference between Llama 1 and Llama 2 is the architectural change of attention layer, in which Llama 2 takes advantage of Grouped Query Attention (GQA) mechanism to improve efficiency.\n\n![Llama 2 Model](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmicrosoft_Llama-2-Onnx_readme_f0fd9744befb.png)\n\n\n# **FAQ**\n## **Is There A Simple Code Example Running Llama 2 With ONNX?**\nThere are two examples provided in this repository. There is a minimum working example shown in [Llama-2-Onnx\u002FMinimumExample](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FLlama-2-Onnx\u002Fblob\u002Fmain\u002FMinimumExample\u002FExample.md). This is simply a command line program that will complete some text with the chosen version of Llama 2.\n\nGiven the following input:\n\n\u003C!-- Section of bash code -->\n```bash\npython MinimumExample\u002FExample_ONNX_LlamaV2.py --onnx_file 7B_FT_float16\u002FONNX\u002FLlamaV2_7B_FT_float16.onnx --embedding_file 7B_FT_float16\u002Fembeddings.pth --tokenizer_path tokenizer.model --prompt \"What is the lightest element?\"\n```\nOutput:\n```bash\nThe lightest element is hydrogen. Hydrogen is the lightest element on the periodic table, with an atomic mass of 1.00794 u (unified atomic mass units).\n```\n\n## **Is There A More Complete Code Example Running Llama 2 With ONNX?**\nThere is a more complete chat bot interface that is available in [Llama-2-Onnx\u002FChatApp](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FLlama-2-Onnx\u002Fblob\u002Fmain\u002FChatApp\u002FChatApp.md). This is a python program based on the popular Gradio web interface. It will allow you to interact with the chosen version of Llama 2 in a chat bot interface. \n\nAn example interaction can be seen here:\n\n![Chat App](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmicrosoft_Llama-2-Onnx_readme_267f07f4b961.png)\n\n## **How Do I Use The Fine-tuned Models?**\nThe fine-tuned models were trained for dialogue applications.\n\nTo get the expected features and performance for them, a specific formatting needs to be followed, including the `INST` tag, `BOS` and `EOS` tokens, and the whitespaces and breaklines in between (we recommend calling `strip()` on inputs to avoid double-spaces).\n\nThis enables models in chat mode as well as additional safeguards  to reduce potentially undesirable output.\n \n\n## **Why Is The First Inference Session Slow?** \nONNX runtime execution provider might need to generate JIT binaries for the underlying hardware, typically the binary is cache and will be loaded directly in the subsequent runs to reduce the overhead. \n\n \n\n## **Why Is FP16 ONNX Slower Than ONNX FP32 On My Device?** \nIt is possible that your device does not support native FP16 math, therefore weights will be cast to FP32 at runtime. Using the FP32 version of the model will avoid the cast overhead.\n\n \n\n## **How Do I Get Better Inference Speed?** \nIt is recommended that inputs\u002Foutputs are put on target device to avoid expensive data copies, please refer to the following document for details.  \n\n[I\u002FO Binding | onnxruntime](https:\u002F\u002Fonnxruntime.ai\u002Fdocs\u002Fperformance\u002Ftune-performance\u002Fiobinding.html) \n\n\n## **What Parameters Should I Test With?** \nUsers can perform temperature and top-p sampling using the model’s output logits. Please refer to Meta’s guidance for the best parameters combination; an example is located [here.](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fllama\u002F)\n\n\n## **How Can I Develop With Llama 2 Responsibly?**\nIn order to help developers innovate responsibly, Meta encourages you to review the [Responsible Use Guide](https:\u002F\u002Fai.meta.com\u002Fllama\u002Fresponsible-use-guide\u002F) for the Llama 2 models.\n\nMicrosoft encourages you to learn more about its [Responsible AI approach](https:\u002F\u002Faka.ms\u002Frai), including many publicly available resources and tools for developers.\n","# **由 ONNX 提供支持的 Llama 2**\n\n**这是一个经过优化的 Llama 2 模型版本，由 Meta 根据本仓库中的 Llama 社区许可协议提供。微软允许您使用、修改、重新分发并基于微软对优化版本的贡献创建衍生作品，但须遵守 Llama 社区许可协议中关于限制、保证免责及责任免除的相关条款。**\n\n# **开始之前**\n本仓库中包含 ONNX 文件的子模块受到访问控制。\n如需获取 Llama 2 模型的访问权限，请填写 [Llama 2 ONNX 注册页面](https:\u002F\u002Fgithub.com\u002Fllama2-onnx\u002Fsignup)。若申请获批，您将在接下来的 48 小时内获得 GitHub 访问权限，通常会更快。\n\n## **克隆本仓库及子模块**\n在开始之前，请确保已安装 Git LFS。Git LFS（大文件存储）用于高效处理大型文件。您可以在 [https:\u002F\u002Fgit-lfs.com\u002F](https:\u002F\u002Fgit-lfs.com\u002F) 找到适用于您操作系统的 Git LFS 安装方法。\n\n接下来，您可以选择要使用的 Llama 2 模型版本，只需检出相应的子模块即可。\n可供选择的子模块如下：\n* 7B_FT_float16\n* 7B_FT_float32\n* 7B_float16\n* 7B_float32\n* 13B_FT_float16\n* 13B_FT_float32\n* 13B_float16\n* 13B_float32\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FLlama-2-Onnx.git\ncd Llama-2-Onnx\ngit submodule init \u003Cchosen_submodule> \ngit submodule update\n```\n\n您可以通过指定不同的子模块名称来初始化多个子模块。请注意，这些文件体积非常大！（7B Float16 模型约为 10GB）\n\n# **什么是 Llama 2？**\nLlama 2 是一系列预训练和微调过的生成式文本模型。如需了解更多关于 Llama 2 的信息，请参阅 [Llama 2 模型卡片](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FLlama-2-Onnx\u002Fblob\u002Fmain\u002FMODEL-CARD-META-LLAMA-2.md)。\n\n## **Llama 2 的结构是怎样的？**\nLlama 2 模型由多层解码器堆叠而成。每个解码器层（或 Transformer 块）由一个自注意力层和一个前馈多层感知机组成。与经典 Transformer 相比，Llama 模型在前馈层中使用了不同的投影尺寸；例如，Llama 1 和 Llama 2 的投影尺寸均为隐藏层大小的 2.7 倍，而非标准的 4 倍。Llama 1 和 Llama 2 之间的一个关键区别在于注意力层的架构变化：Llama 2 采用了分组查询注意力（GQA）机制，以提升效率。\n\n![Llama 2 模型](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmicrosoft_Llama-2-Onnx_readme_f0fd9744befb.png)\n\n# **常见问题解答**\n## **是否有使用 ONNX 运行 Llama 2 的简单代码示例？**\n本仓库提供了两个示例。最小可运行示例位于 [Llama-2-Onnx\u002FMinimumExample](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FLlama-2-Onnx\u002Fblob\u002Fmain\u002FMinimumExample\u002FExample.md)。这是一个简单的命令行程序，可利用所选版本的 Llama 2 完成一段文本。\n\n输入如下：\n\n\u003C!-- Bash 代码段 -->\n```bash\npython MinimumExample\u002FExample_ONNX_LlamaV2.py --onnx_file 7B_FT_float16\u002FONNX\u002FLlamaV2_7B_FT_float16.onnx --embedding_file 7B_FT_float16\u002Fembeddings.pth --tokenizer_path tokenizer.model --prompt \"What is the lightest element?\"\n```\n\n输出：\n```bash\nThe lightest element is hydrogen. Hydrogen is the lightest element on the periodic table, with an atomic mass of 1.00794 u (unified atomic mass units).\n```\n\n## **是否有更完整的使用 ONNX 运行 Llama 2 的代码示例？**\n更完整的聊天机器人界面可在 [Llama-2-Onnx\u002FChatApp](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FLlama-2-Onnx\u002Fblob\u002Fmain\u002FChatApp\u002FChatApp.md) 中找到。这是一个基于流行 Gradio Web 界面的 Python 程序，允许您通过聊天机器人界面与所选版本的 Llama 2 互动。\n\n示例如下：\n\n![聊天应用](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmicrosoft_Llama-2-Onnx_readme_267f07f4b961.png)\n\n## **如何使用微调后的模型？**\n微调后的模型专为对话应用而训练。\n为了获得预期的功能和性能，需要遵循特定的格式要求，包括 `INST` 标签、`BOS` 和 `EOS` 标记，以及中间的空格和换行符（建议对输入调用 `strip()` 方法以避免出现双空格）。这不仅使模型能够以聊天模式运行，还能提供额外的安全保障，以减少潜在的不良输出。\n\n## **为什么首次推理会很慢？**\nONNX Runtime 的执行提供者可能需要为底层硬件生成 JIT 二进制文件。通常情况下，这些二进制文件会被缓存，并在后续运行中直接加载，从而减少开销。\n\n## **为什么在我的设备上，FP16 版本的 ONNX 比 FP32 版本慢？**\n这可能是由于您的设备不支持原生 FP16 运算，因此权重会在运行时被转换为 FP32。使用 FP32 版本的模型可以避免这种转换带来的额外开销。\n\n## **如何提高推理速度？**\n建议将输入和输出数据放置在目标设备上，以避免昂贵的数据拷贝操作。有关详细信息，请参阅以下文档：\n\n[I\u002FO 绑定 | ONNX Runtime](https:\u002F\u002Fonnxruntime.ai\u002Fdocs\u002Fperformance\u002Ftune-performance\u002Fiobinding.html)\n\n## **应该测试哪些参数？**\n用户可以使用模型的输出 logits 进行温度采样和 top-p 采样。请参考 Meta 提供的指导，以确定最佳参数组合；示例可在此处找到：[这里](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fllama\u002F)。\n\n## **如何负责任地开发 Llama 2 应用？**\n为帮助开发者以负责任的方式进行创新，Meta 鼓励您查阅 Llama 2 模型的 [负责任使用指南](https:\u002F\u002Fai.meta.com\u002Fllama\u002Fresponsible-use-guide\u002F)。\n微软则鼓励您了解其 [负责任的人工智能方法](https:\u002F\u002Faka.ms\u002Frai)，其中包括许多面向开发者的公开资源和工具。","# Llama-2-Onnx 快速上手指南\n\n本指南帮助中国开发者快速在本地部署并运行基于 ONNX 优化的 Llama 2 模型。\n\n## 1. 环境准备\n\n在开始之前，请确保满足以下系统要求和前置依赖：\n\n*   **操作系统**：支持 Windows、Linux 或 macOS。\n*   **Git 与 Git LFS**：必须安装 Git Large File Storage (LFS) 以高效处理大模型文件。\n    *   安装指南：[https:\u002F\u002Fgit-lfs.com\u002F](https:\u002F\u002Fgit-lfs.com\u002F)\n    *   验证安装：运行 `git lfs install`。\n*   **Python 环境**：建议使用 Python 3.8 或更高版本，并安装 `onnxruntime` 及相关依赖（具体依赖请参考项目中的 `requirements.txt`）。\n*   **访问权限**：由于模型子模块受访问控制，使用前需填写 [Llama 2 ONNX 注册页面](https:\u002F\u002Fgithub.com\u002Fllama2-onnx\u002Fsignup) 申请权限。通常在 48 小时内（往往更快）会收到 GitHub 访问授权。\n\n## 2. 安装步骤\n\n### 第一步：克隆仓库\n首先克隆主仓库：\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FLlama-2-Onnx.git\ncd Llama-2-Onnx\n```\n\n### 第二步：选择并初始化模型子模块\n根据硬件显存和需求选择合适的模型版本。可选子模块包括：\n*   **7B 系列**：`7B_FT_float16`, `7B_FT_float32`, `7B_float16`, `7B_float32`\n*   **13B 系列**：`13B_FT_float16`, `13B_FT_float32`, `13B_float16`, `13B_float32`\n\n> **注意**：模型文件非常大（例如 7B Float16 版本约 10GB），请确保磁盘空间充足。国内用户若遇到拉取缓慢，可配置 Git 代理或使用国内 Git 镜像加速。\n\n以下以初始化 **7B 微调版 Float16** 模型为例：\n```bash\ngit submodule init 7B_FT_float16\ngit submodule update\n```\n*如需同时使用多个模型，可重复执行 `init` 命令指定不同子模块名称。*\n\n## 3. 基本使用\n\n项目提供了一个最小化命令行示例，用于测试文本补全功能。\n\n### 运行示例\n确保已下载对应的 `.onnx` 模型文件、`.pth` 嵌入文件和 `tokenizer.model`。执行以下命令：\n\n```bash\npython MinimumExample\u002FExample_ONNX_LlamaV2.py --onnx_file 7B_FT_float16\u002FONNX\u002FLlamaV2_7B_FT_float16.onnx --embedding_file 7B_FT_float16\u002Fembeddings.pth --tokenizer_path tokenizer.model --prompt \"What is the lightest element?\"\n```\n\n### 预期输出\n程序将输出模型生成的补全内容：\n```text\nThe lightest element is hydrogen. Hydrogen is the lightest element on the periodic table, with an atomic mass of 1.00794 u (unified atomic mass units).\n```\n\n### 进阶使用（聊天机器人）\n如果需要更完整的交互体验，项目还提供了基于 Gradio 的聊天界面。请参考 `ChatApp` 目录下的文档启动 Web 服务：\n```bash\n# 进入 ChatApp 目录并运行（具体命令参考 ChatApp\u002FChatApp.md）\npython ChatApp\u002Fapp.py \n```","某初创团队希望在本地部署一个低延迟的中文客服对话机器人，以保护用户隐私并降低云端 API 调用成本。\n\n### 没有 Llama-2-Onnx 时\n- **推理速度缓慢**：直接运行原始 PyTorch 版本的 Llama 2 模型，在消费级显卡上生成回复的延迟高达数秒，无法满足实时对话需求。\n- **资源占用过高**：未优化的模型显存占用巨大，导致团队无法在边缘设备或低成本服务器上同时运行多个实例。\n- **部署环境复杂**：需要配置庞大的深度学习框架依赖（如完整的 PyTorch 环境），在不同操作系统间迁移时经常遇到兼容性问题。\n- **缺乏端到端优化**：原始模型未针对特定硬件指令集进行加速，计算效率低下，电池供电设备难以长时间维持服务。\n\n### 使用 Llama-2-Onnx 后\n- **推理性能显著提升**：借助 ONNX 运行时的高效执行引擎，文本生成延迟降低至毫秒级，实现了流畅的即时对话体验。\n- **内存效率大幅优化**：通过量化版本（如 float16）和图优化技术，模型体积缩小且显存占用减半，轻松在单张中端显卡上并发处理多路请求。\n- **跨平台部署简便**：仅需轻量级的 ONNX Runtime 即可运行，摆脱了对重型训练框架的依赖，可快速移植到 Windows、Linux 甚至移动端。\n- **硬件适配性更强**：利用 Llama 2 特有的分组查询注意力（GQA）机制与 ONNX 的深度结合，最大化利用了 CPU 和 GPU 的计算算力。\n\nLlama-2-Onnx 通过将大模型转化为高效的标准格式，让高性能本地化 AI 应用从“实验室原型”真正变成了“可落地的产品”。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmicrosoft_Llama-2-Onnx_267f07f4.png","microsoft","Microsoft","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fmicrosoft_4900709c.png","Open source projects and samples from Microsoft","opensource@microsoft.com","OpenAtMicrosoft","https:\u002F\u002Fopensource.microsoft.com","https:\u002F\u002Fgithub.com\u002Fmicrosoft",[81,85,89],{"name":82,"color":83,"percentage":84},"Python","#3572A5",82.3,{"name":86,"color":87,"percentage":88},"CSS","#663399",17.6,{"name":90,"color":91,"percentage":92},"JavaScript","#f1e05a",0.1,1027,96,"2026-03-20T11:45:22","NOASSERTION","未说明","非绝对必需，但建议使用支持原生 FP16 计算的 GPU 以获得最佳性能；若设备不支持原生 FP16，FP16 模型将自动转换为 FP32 运行（会导致额外开销）。具体显存需求取决于模型大小（7B Float16 模型文件约 10GB），未明确指定最低显存大小或 CUDA 版本。","未说明（注：7B Float16 模型文件本身约 10GB，实际运行所需内存通常需大于模型文件大小）",{"notes":101,"python":97,"dependencies":102},"1. 必须安装 Git LFS 以克隆包含大型模型文件的子模块。\n2. 模型访问受控，需先填写申请表单获取 GitHub 访问权限。\n3. 提供多种模型规格（7B\u002F13B，Float16\u002FFloat32，微调版\u002F基础版），其中 7B Float16 模型文件约为 10GB。\n4. 首次推理会话可能较慢，因为 ONNX Runtime 需要为底层硬件生成 JIT 二进制文件（后续运行会缓存）。\n5. 使用微调模型进行对话时，需遵循特定的格式要求（包括 INST 标签、BOS\u002FEOS token 及空格换行处理）。",[103,104],"onnxruntime","Git LFS",[35,14],"2026-03-27T02:49:30.150509","2026-04-06T21:12:54.054405",[],[]]