[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-facebookincubator--AITemplate":3,"tool-facebookincubator--AITemplate":61},[4,18,26,36,44,53],{"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 真正成长为懂上",155373,2,"2026-04-14T11:34:08",[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 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",108322,"2026-04-10T11:39:34",[14,15,13],{"id":45,"name":46,"github_repo":47,"description_zh":48,"stars":49,"difficulty_score":32,"last_commit_at":50,"category_tags":51,"status":17},6121,"gemini-cli","google-gemini\u002Fgemini-cli","gemini-cli 是一款由谷歌推出的开源 AI 命令行工具，它将强大的 Gemini 大模型能力直接集成到用户的终端环境中。对于习惯在命令行工作的开发者而言，它提供了一条从输入提示词到获取模型响应的最短路径，无需切换窗口即可享受智能辅助。\n\n这款工具主要解决了开发过程中频繁上下文切换的痛点，让用户能在熟悉的终端界面内直接完成代码理解、生成、调试以及自动化运维任务。无论是查询大型代码库、根据草图生成应用，还是执行复杂的 Git 操作，gemini-cli 都能通过自然语言指令高效处理。\n\n它特别适合广大软件工程师、DevOps 人员及技术研究人员使用。其核心亮点包括支持高达 100 万 token 的超长上下文窗口，具备出色的逻辑推理能力；内置 Google 搜索、文件操作及 Shell 命令执行等实用工具；更独特的是，它支持 MCP（模型上下文协议），允许用户灵活扩展自定义集成，连接如图像生成等外部能力。此外，个人谷歌账号即可享受免费的额度支持，且项目基于 Apache 2.0 协议完全开源，是提升终端工作效率的理想助手。",100752,"2026-04-10T01:20:03",[52,13,15,14],"插件",{"id":54,"name":55,"github_repo":56,"description_zh":57,"stars":58,"difficulty_score":32,"last_commit_at":59,"category_tags":60,"status":17},4721,"markitdown","microsoft\u002Fmarkitdown","MarkItDown 是一款由微软 AutoGen 团队打造的轻量级 Python 工具，专为将各类文件高效转换为 Markdown 格式而设计。它支持 PDF、Word、Excel、PPT、图片（含 OCR）、音频（含语音转录）、HTML 乃至 YouTube 链接等多种格式的解析，能够精准提取文档中的标题、列表、表格和链接等关键结构信息。\n\n在人工智能应用日益普及的今天，大语言模型（LLM）虽擅长处理文本，却难以直接读取复杂的二进制办公文档。MarkItDown 恰好解决了这一痛点，它将非结构化或半结构化的文件转化为模型“原生理解”且 Token 效率极高的 Markdown 格式，成为连接本地文件与 AI 分析 pipeline 的理想桥梁。此外，它还提供了 MCP（模型上下文协议）服务器，可无缝集成到 Claude Desktop 等 LLM 应用中。\n\n这款工具特别适合开发者、数据科学家及 AI 研究人员使用，尤其是那些需要构建文档检索增强生成（RAG）系统、进行批量文本分析或希望让 AI 助手直接“阅读”本地文件的用户。虽然生成的内容也具备一定可读性，但其核心优势在于为机器",93400,"2026-04-06T19:52:38",[52,14],{"id":62,"github_repo":63,"name":64,"description_en":65,"description_zh":66,"ai_summary_zh":67,"readme_en":68,"readme_zh":69,"quickstart_zh":70,"use_case_zh":71,"hero_image_url":72,"owner_login":73,"owner_name":74,"owner_avatar_url":75,"owner_bio":76,"owner_company":77,"owner_location":77,"owner_email":77,"owner_twitter":77,"owner_website":78,"owner_url":79,"languages":80,"stars":107,"forks":108,"last_commit_at":109,"license":110,"difficulty_score":111,"env_os":112,"env_gpu":113,"env_ram":114,"env_deps":115,"category_tags":121,"github_topics":77,"view_count":32,"oss_zip_url":77,"oss_zip_packed_at":77,"status":17,"created_at":122,"updated_at":123,"faqs":124,"releases":154},7575,"facebookincubator\u002FAITemplate","AITemplate","AITemplate is a Python framework which renders neural network into high performance CUDA\u002FHIP C++ code. Specialized for FP16 TensorCore (NVIDIA GPU) and MatrixCore (AMD GPU) inference.","AITemplate 是一个由 Meta 开源的 Python 框架，专为将深度神经网络转化为高性能的 CUDA（NVIDIA）或 HIP（AMD）C++ 代码而设计，旨在实现极速的模型推理服务。它主要解决了传统推理方案依赖庞大第三方库、跨硬件平台兼容性差以及算子融合能力有限等痛点，让开发者无需绑定 cuDNN 或 TensorRT 等运行时，即可生成独立便携的二进制文件。\n\n这款工具非常适合追求极致性能的 AI 工程师、系统架构师及研究人员，特别是那些需要在 NVIDIA Ampere 及以上架构或 AMD GPU 上部署 ResNet、BERT、Stable Diffusion 等大模型的用户。AITemplate 的核心亮点在于其强大的“三维融合”技术：不仅能进行常规的垂直融合，还独创了水平融合与内存融合机制，能将不同形状的并行计算、归一化操作乃至内存读写合并为单个 GPU 内核，从而充分释放 TensorCore 和 MatrixCore 的算力，逼近硬件理论性能极限。此外，它支持与 PyTorch 无缝协作，直接复用张量而无须额外拷贝，同时也允许开发者通过简单的 Python","AITemplate 是一个由 Meta 开源的 Python 框架，专为将深度神经网络转化为高性能的 CUDA（NVIDIA）或 HIP（AMD）C++ 代码而设计，旨在实现极速的模型推理服务。它主要解决了传统推理方案依赖庞大第三方库、跨硬件平台兼容性差以及算子融合能力有限等痛点，让开发者无需绑定 cuDNN 或 TensorRT 等运行时，即可生成独立便携的二进制文件。\n\n这款工具非常适合追求极致性能的 AI 工程师、系统架构师及研究人员，特别是那些需要在 NVIDIA Ampere 及以上架构或 AMD GPU 上部署 ResNet、BERT、Stable Diffusion 等大模型的用户。AITemplate 的核心亮点在于其强大的“三维融合”技术：不仅能进行常规的垂直融合，还独创了水平融合与内存融合机制，能将不同形状的并行计算、归一化操作乃至内存读写合并为单个 GPU 内核，从而充分释放 TensorCore 和 MatrixCore 的算力，逼近硬件理论性能极限。此外，它支持与 PyTorch 无缝协作，直接复用张量而无须额外拷贝，同时也允许开发者通过简单的 Python 文件扩展新算子，极大地降低了定制高性能推理引擎的门槛。","# AITemplate\n\n[![License](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-Apache_2.0-brightgreen.svg)](https:\u002F\u002Fgithub.com\u002Ffacebookincubator\u002FAITemplate\u002Fblob\u002Fmain\u002FLICENSE) |\n[![Documentation](https:\u002F\u002Fgithub.com\u002Ffacebookincubator\u002FAITemplate\u002Factions\u002Fworkflows\u002Fdocs.yaml\u002Fbadge.svg)](https:\u002F\u002Ffacebookincubator.github.io\u002FAITemplate) |\n[![CircleCI](https:\u002F\u002Fcircleci.com\u002Fgh\u002Ffacebookincubator\u002FAITemplate.svg?style=svg)](https:\u002F\u002Fapp.circleci.com\u002Fpipelines\u002Fgithub\u002Ffacebookincubator\u002FAITemplate)\n[![Deploy docs to Pages](https:\u002F\u002Fgithub.com\u002Ffacebookincubator\u002FAITemplate\u002Factions\u002Fworkflows\u002Fpages.yaml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Ffacebookincubator\u002FAITemplate\u002Factions\u002Fworkflows\u002Fpages.yaml)\n\n\nAITemplate (AIT) is a Python framework that transforms deep neural networks into CUDA (NVIDIA GPU) \u002F HIP (AMD GPU) C++ code for lightning-fast inference serving. AITemplate highlights include:\n\n- High performance: close to roofline fp16 TensorCore (NVIDIA GPU) \u002F MatrixCore (AMD GPU) performance on major models, including ResNet, MaskRCNN, BERT, VisionTransformer, Stable Diffusion, etc.\n\n- Unified, open, and flexible. Seamless fp16 deep neural network models for NVIDIA GPU or AMD GPU. Fully open source, Lego-style easily extendable high-performance primitives for new model support. Supports a significantly more comprehensive range of fusions than existing solutions for both GPU platforms.\n\n\n## More about AITemplate\n\n### Excellent Backward Capability\n\nAITemplate doesn't depend on third-party libraries or runtimes, such as cuBLAS, cuDNN, rocBLAS, MIOpen, TensorRT, MIGraphX, etc. Each model is compiled into a self-contained portable binary, which can be used on any software environment with the same hardware.\n\n### Horizontal Fusion\n\nAITemplate provides unique advanced horizontal fusion. AITemplate can fuse parallel GEMM, LayerNorm, and other operators with different input shapes into a single GPU kernel.\n\n### Vertical Fusion\n\nAITemplate provides strong vertical fusion. AITemplate can fuse a large range of operations into TensorCore\u002FMatrixCore operations, such as elementwise operations, reductions, and layout permutations. AITemplate also provides back-to-back style TensorCore \u002F MatrixCore operation fusion.\n\n### Memory Fusion\n\nAITemplate provides innovative memory fusions. AITemplate can fuse GEMM, LayerNorm, and other operators, followed by memory operations such as concatenation, split, and slice into a single operator.\n\n### Working w\u002Fwo PyTorch\n\nThe AITemplate-generated Python runtime can take PyTorch tensors as inputs and outputs without an extra copy. For environments without PyTorch, the AITemplate Python\u002FC++ runtime is self-contained.\n\n### Extensions without suffering\n\nAITemplate provides a straightforward approach for making an extension in codegen. To add a new operator or a new fused kernel into AITemplate, most of the time one only needs to add two Python files: one for a graph node definition and another for the backend codegen. The CUDA\u002FHIP kernel in a text header file can be directly utilized in the codegen.\n\n\n## FX2AIT\n\nFX2AIT is a Python-based tool that converts PyTorch models into AITemplate (AIT) engine for lightning-fast inference serving. Using FX2AIT's built-in AITLowerer, partial AIT acceleration can be achieved for models with unsupported operators in AITemplate.\n\nKey features of FX2AIT include:\n\n* Easy Conversion: FX2AIT requires only a PyTorch model and input for conversion, generating an \"AITModule\" output for inference serving.\n* Expanded Support: AITemplate does not support all PyTorch operators. FX2AIT's AITLowerer offers a solution for partial AIT conversion for models with unsupported operators. Check the `fx2ait\u002Ffx2ait\u002Fexample\u002F03_lowering_split` for more information.\n\nMore info can be found from https:\u002F\u002Fgithub.com\u002Ffacebookincubator\u002FAITemplate\u002Ftree\u002Fmain\u002Ffx2ait.\n\n\n## Installation\n\n**Hardware requirements:**\n\n  - **NVIDIA**: AIT is only tested on SM80+ GPUs (Ampere etc). Not all kernels work with old SM75\u002FSM70 (T4\u002FV100) GPUs.\n  - **AMD**:  AIT is only tested on CDNA2 (MI-210\u002F250) GPUs. There may be compiler issues for old CDNA1 (MI-100) GPUs.\n\n### Clone the code\n\nWhen cloning the code, please use the following command to also clone the submodules:\n```\ngit clone --recursive https:\u002F\u002Fgithub.com\u002Ffacebookincubator\u002FAITemplate\n```\n\n### Docker Image\n\nWe highly recommend using AITemplate with Docker to avoid accidentally using a wrong version of NVCC or HIPCC.\n\n- CUDA: `.\u002Fdocker\u002Fbuild.sh cuda`\n- ROCM: `DOCKER_BUILDKIT=1 .\u002Fdocker\u002Fbuild.sh rocm`\n\nThis will build a docker image with tag `ait:latest`.\n\n### From Source\n\nThe following command will create a Python wheel for AITemplate. Please ensure you have correct CUDA\u002FROCm compiler installed.\n\n- CUDA: CUDA 11.6\n- ROCm: We tested on ROCm 5.2.3 with a customized build HIPCC with the command in docker\u002FDockerfile.rocm#L87-L96\n\n*Incorrect compiler will lead performance regression.*\n\n**Please check all submodules are cloned correctly before go to next step.**\n\n```\ncd python\npython setup.py bdist_wheel\npip install dist\u002F*.whl --force-reinstall\n```\n\n## Getting Started\n\nCheck out the [AITemplate Documentation](https:\u002F\u002Ffacebookincubator.github.io\u002FAITemplate) for API reference.\n\nThere are a few tutorials for onboarding:\n\n- 01: [How to inference a PyTorch model with AIT](https:\u002F\u002Ffacebookincubator.github.io\u002FAITemplate\u002Ftutorial\u002Fhow_to_infer_pt.html)\n- 02: [How to add an op to AIT codegen](https:\u002F\u002Ffacebookincubator.github.io\u002FAITemplate\u002Ftutorial\u002Fhow_to_add_op.html)\n- 03: [How to visualize AIT's optimization](https:\u002F\u002Ffacebookincubator.github.io\u002FAITemplate\u002Ftutorial\u002Fhow_to_visualize.html)\n\n\n## Examples & Performance\n\nAITemplate provides the following model templates & reference performance data on A100\u002FMI-250:\n\n- [01_ResNet-50](examples\u002F01_resnet-50\u002F) with PyTorch Image Models (TIMM)\n- [02_MaskRCNN-FPN](examples\u002F02_detectron2\u002F) with Detectron2\n- [03_BERT](examples\u002F03_bert\u002F) with Hugging Face Transformer\n- [04_Vision Transformer](examples\u002F04_vit\u002F) with PyTorch Image Models (TIMM)\n- [05_Stable Diffusion](examples\u002F05_stable_diffusion\u002F) with Hugging Face Diffusers\n\n\n## Release\n\nAll current development updates can be seen in the AITemplate repository. Releases are not on a set schedule and will only be tagged for significant feature releases.\n\nMid-term plan:\n\n- Better dynamic shape support: Focus on the dynamic sequence in Transformers. Add symbolic shape support.\n- More automatic graph passes: Relief manual rewrite models to obtain the best performance.\n- Quantization: fp8\u002Fint8\u002Fint4.\n- Sparsity pruning for Gemm.\n- PT2 integration: Aten2AIT is under active development.\n\nLong-term plan:\n\n- Automatic ONNX, Open-XLA and other format model conversion.\n- Composable Kernel CPU extension on AVX2\u002FAVX-512 for AMD Epyc CPU.\n\n\n## Contributing\n\nCheck our [contributing guide](CONTRIBUTING.md) to learn about how to contribute to the project.\n\n\n## The Team\n\nAITemplate is currently maintained by Meta engineers: [Ying Zhang](https:\u002F\u002Fgithub.com\u002Fipiszy), [Yang Chen](https:\u002F\u002Fgithub.com\u002Fchenyang78), [Terry Chen](https:\u002F\u002Fgithub.com\u002Fterrychenism), [Mu-Chu Lee](https:\u002F\u002Fgithub.com\u002Fmuchulee8), [Max Podkorytov](https:\u002F\u002Fgithub.com\u002Ftenpercent), [Adnan Akhundov](https:\u002F\u002Fgithub.com\u002Faakhundov).\n\nAITemplate is co-created by Meta engineers: [Bing Xu](https:\u002F\u002Fgithub.com\u002Fantinucleon), [Ying Zhang](https:\u002F\u002Fgithub.com\u002Fipiszy), [Hao Lu](https:\u002F\u002Fgithub.com\u002Fhlu1), [Yang Chen](https:\u002F\u002Fgithub.com\u002Fchenyang78), and [Terry Chen](https:\u002F\u002Fgithub.com\u002Fterrychenism), with major contributions coming from other talented engineers. A non-exhaustive list to mention is Mike Iovine, Mu-Chu Lee, Scott Wolchok, Oleg Khabinov, Shirong Wu, Huamin Li, Hui Guo, Zhijing Li, Max Podkorytov. We also want to thank Andrew Tulloch, Yinghai Lu, Lu Fang for the valuable discussions.\n\nFX2AIT and Aten2AIT are co-created and maintained by Meta engineers: [Wei Wei](https:\u002F\u002Fgithub.com\u002Ffrank-wei), [Shirong Wu](https:\u002F\u002Fgithub.com\u002Fwushirong) and [Zhijing Li](https:\u002F\u002Fgithub.com\u002Ftissue3).\n\n\n## Acknowledgements\n\nAITemplate team works closely with NVIDIA [CUTLASS](https:\u002F\u002Fgithub.com\u002FNVIDIA\u002Fcutlass) Team (led by Andrew Kerr, Haicheng Wu) and AMD [Composable Kernel](https:\u002F\u002Fgithub.com\u002FROCmSoftwarePlatform\u002Fcomposable_kernel) Team (led by Chao Liu, Jing Zhang). We co-designed many advanced GPU optimizations specialized for each platform, and nothing is possible without our close collaboration.\n\n\n## License\n\nAITemplate is licensed under the [Apache 2.0 License](https:\u002F\u002Fgithub.com\u002Ffacebookincubator\u002FAITemplate\u002Fblob\u002Fmain\u002FLICENSE).\n","# AITemplate\n\n[![许可证](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002F许可证-Apache_2.0-brightgreen.svg)](https:\u002F\u002Fgithub.com\u002Ffacebookincubator\u002FAITemplate\u002Fblob\u002Fmain\u002FLICENSE) |\n[![文档](https:\u002F\u002Fgithub.com\u002Ffacebookincubator\u002FAITemplate\u002Factions\u002Fworkflows\u002Fdocs.yaml\u002Fbadge.svg)](https:\u002F\u002Ffacebookincubator.github.io\u002FAITemplate) |\n[![CircleCI](https:\u002F\u002Fcircleci.com\u002Fgh\u002Ffacebookincubator\u002FAITemplate.svg?style=svg)](https:\u002F\u002Fapp.circleci.com\u002Fpipelines\u002Fgithub\u002Ffacebookincubator\u002FAITemplate)\n[![部署文档到GitHub Pages](https:\u002F\u002Fgithub.com\u002Ffacebookincubator\u002FAITemplate\u002Factions\u002Fworkflows\u002Fpages.yaml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Ffacebookincubator\u002FAITemplate\u002Factions\u002Fworkflows\u002Fpages.yaml)\n\n\nAITemplate (AIT) 是一个 Python 框架，可将深度神经网络转换为 CUDA（NVIDIA GPU）\u002F HIP（AMD GPU）C++ 代码，以实现闪电般的推理服务。AITemplate 的亮点包括：\n\n- 高性能：在主要模型上接近 NVIDIA GPU 的 fp16 TensorCore 或 AMD GPU 的 MatrixCore 性能上限，包括 ResNet、MaskRCNN、BERT、VisionTransformer、Stable Diffusion 等。\n- 统一、开放且灵活。无缝支持适用于 NVIDIA GPU 或 AMD GPU 的 fp16 深度神经网络模型。完全开源，乐高式易扩展的高性能原语可用于新模型的支持。相比现有方案，它对两种 GPU 平台都支持更为全面的融合操作。\n\n\n## 关于 AITemplate 的更多信息\n\n### 出色的向后兼容性\n\nAITemplate 不依赖于第三方库或运行时环境，例如 cuBLAS、cuDNN、rocBLAS、MIOpen、TensorRT、MIGraphX 等。每个模型都会被编译成一个自包含的可移植二进制文件，可在任何具有相同硬件的软件环境中使用。\n\n### 水平融合\n\nAITemplate 提供独特的高级水平融合功能。它可以将并行的 GEMM、LayerNorm 以及其他输入形状不同的算子融合为单个 GPU 内核。\n\n### 垂直融合\n\nAITemplate 具有强大的垂直融合能力。它可以将大量操作融合为 TensorCore\u002FMatrixCore 操作，例如逐元素运算、归约和布局变换等。AITemplate 还支持连续风格的 TensorCore \u002F MatrixCore 操作融合。\n\n### 内存融合\n\nAITemplate 提供创新的内存融合技术。它可以将 GEMM、LayerNorm 等算子与后续的拼接、拆分、切片等内存操作融合为单个算子。\n\n### 无需 PyTorch 即可工作\n\nAITemplate 生成的 Python 运行时可以接受 PyTorch 张量作为输入和输出，而无需额外的拷贝。对于没有 PyTorch 的环境，AITemplate 的 Python\u002FC++ 运行时是自包含的。\n\n### 扩展无忧\n\nAITemplate 提供了一种简单的代码生成扩展方法。要向 AITemplate 中添加新的算子或新的融合内核，大多数情况下只需添加两个 Python 文件：一个用于图节点定义，另一个用于后端代码生成。文本头文件中的 CUDA\u002FHIP 内核可以直接用于代码生成。\n\n\n## FX2AIT\n\nFX2AIT 是一款基于 Python 的工具，可将 PyTorch 模型转换为 AITemplate（AIT）引擎，以实现闪电般的推理服务。借助 FX2AIT 内置的 AITLowerer，即使模型中包含 AITemplate 不支持的算子，也可以实现部分 AIT 加速。\n\nFX2AIT 的主要特性包括：\n\n* 易于转换：FX2AIT 只需一个 PyTorch 模型和输入即可完成转换，生成用于推理服务的“AITModule”输出。\n* 更广泛的兼容性：AITemplate 并非支持所有 PyTorch 算子。FX2AIT 的 AITLowerer 为包含不支持算子的模型提供了部分 AIT 转换的解决方案。更多信息请参阅 `fx2ait\u002Ffx2ait\u002Fexample\u002F03_lowering_split`。\n\n更多详细信息请访问：https:\u002F\u002Fgithub.com\u002Ffacebookincubator\u002FAITemplate\u002Ftree\u002Fmain\u002Ffx2ait。\n\n\n## 安装\n\n**硬件要求：**\n\n  - **NVIDIA**：AIT 仅在 SM80+ GPU（Ampere 等）上进行了测试。并非所有内核都适用于旧的 SM75\u002FSM70（T4\u002FV100）GPU。\n  - **AMD**：AIT 仅在 CDNA2（MI-210\u002F250）GPU 上进行了测试。对于旧的 CDNA1（MI-100）GPU，可能存在编译器问题。\n\n### 克隆代码\n\n克隆代码时，请使用以下命令同时克隆子模块：\n```\ngit clone --recursive https:\u002F\u002Fgithub.com\u002Ffacebookincubator\u002FAITemplate\n```\n\n### Docker 镜像\n\n我们强烈建议使用 Docker 来运行 AITemplate，以避免意外使用错误版本的 NVCC 或 HIPCC。\n\n- CUDA：`.\u002Fdocker\u002Fbuild.sh cuda`\n- ROCM：`DOCKER_BUILDKIT=1 .\u002Fdocker\u002Fbuild.sh rocm`\n\n这将构建一个标签为 `ait:latest` 的 Docker 镜像。\n\n### 从源码安装\n\n以下命令将为 AITemplate 创建一个 Python wheel 包。请确保已安装正确的 CUDA\u002FROCm 编译器。\n\n- CUDA：CUDA 11.6\n- ROCm：我们已在 ROCm 5.2.3 上进行了测试，并使用 docker\u002FDockerfile.rocm#L87-L96 中的命令定制了 HIPCC。\n\n*使用错误的编译器会导致性能下降。*\n\n**请在继续下一步之前，确认所有子模块均已正确克隆。**\n\n```\ncd python\npython setup.py bdist_wheel\npip install dist\u002F*.whl --force-reinstall\n```\n\n## 开始使用\n\n请参阅 [AITemplate 文档](https:\u002F\u002Ffacebookincubator.github.io\u002FAITemplate)，以获取 API 参考。\n\n以下是几篇入门教程：\n\n- 01：[如何使用 AIT 推理 PyTorch 模型](https:\u002F\u002Ffacebookincubator.github.io\u002FAITemplate\u002Ftutorial\u002Fhow_to_infer_pt.html)\n- 02：[如何向 AIT 代码生成中添加算子](https:\u002F\u002Ffacebookincubator.github.io\u002FAITemplate\u002Ftutorial\u002Fhow_to_add_op.html)\n- 03：[如何可视化 AIT 的优化过程](https:\u002F\u002Ffacebookincubator.github.io\u002FAITemplate\u002Ftutorial\u002Fhow_to_visualize.html)\n\n\n## 示例与性能\n\nAITemplate 提供以下模型模板及在 A100\u002FMI-250 上的参考性能数据：\n\n- [01_ResNet-50](examples\u002F01_resnet-50\u002F) 使用 PyTorch Image Models (TIMM)\n- [02_MaskRCNN-FPN](examples\u002F02_detectron2\u002F) 使用 Detectron2\n- [03_BERT](examples\u002F03_bert\u002F) 使用 Hugging Face Transformer\n- [04_Vision Transformer](examples\u002F04_vit\u002F) 使用 PyTorch Image Models (TIMM)\n- [05_Stable Diffusion](examples\u002F05_stable_diffusion\u002F) 使用 Hugging Face Diffusers\n\n\n## 发布\n\n当前的所有开发更新都可以在 AITemplate 仓库中查看。发布并不遵循固定时间表，只有在重大功能发布时才会打上标签。\n\n中期计划：\n\n- 更好的动态形状支持：重点解决 Transformer 中的动态序列问题，并增加符号化形状支持。\n- 更多自动图遍历：减少手动重写模型以获得最佳性能的工作量。\n- 量化：fp8\u002Fint8\u002Fint4。\n- Gemm 的稀疏化剪枝。\n- PT2 集成：Aten2AIT 正在积极开发中。\n\n长期计划：\n\n- 自动 ONNX、Open-XLA 等格式的模型转换。\n- 在 AVX2\u002FAVX-512 上为 AMD Epyc CPU 提供可组合的内核扩展。\n\n\n## 贡献\n\n请查阅我们的 [贡献指南](CONTRIBUTING.md)，了解如何为该项目做出贡献。\n\n## 团队\n\nAITemplate 当前由 Meta 的工程师维护：[Ying Zhang](https:\u002F\u002Fgithub.com\u002Fipiszy)、[Yang Chen](https:\u002F\u002Fgithub.com\u002Fchenyang78)、[Terry Chen](https:\u002F\u002Fgithub.com\u002Fterrychenism)、[Mu-Chu Lee](https:\u002F\u002Fgithub.com\u002Fmuchulee8)、[Max Podkorytov](https:\u002F\u002Fgithub.com\u002Ftenpercent)、[Adnan Akhundov](https:\u002F\u002Fgithub.com\u002Faakhundov)。\n\nAITemplate 由 Meta 的工程师共同创建：[Bing Xu](https:\u002F\u002Fgithub.com\u002Fantinucleon)、[Ying Zhang](https:\u002F\u002Fgithub.com\u002Fipiszy)、[Hao Lu](https:\u002F\u002Fgithub.com\u002Fhlu1)、[Yang Chen](https:\u002F\u002Fgithub.com\u002Fchenyang78) 和 [Terry Chen](https:\u002F\u002Fgithub.com\u002Fterrychenism)，同時也得到了其他多位優秀工程師的重要貢獻。在此特別提及的部分人員包括：Mike Iovine、Mu-Chu Lee、Scott Wolchok、Oleg Khabinov、Shirong Wu、Huamin Li、Hui Guo、Zhijing Li、Max Podkorytov。我們亦感謝 Andrew Tulloch、Yinghai Lu 和 Lu Fang 提供的寶貴討論。\n\nFX2AIT 和 Aten2AIT 由 Meta 的工程師共同創建並維護：[Wei Wei](https:\u002F\u002Fgithub.com\u002Ffrank-wei)、[Shirong Wu](https:\u002F\u002Fgithub.com\u002Fwushirong) 和 [Zhijing Li](https:\u002F\u002Fgithub.com\u002Ftissue3)。\n\n\n## 致謝\n\nAITemplate 團隊與 NVIDIA 的 [CUTLASS](https:\u002F\u002Fgithub.com\u002FNVIDIA\u002Fcutlass) 團隊（由 Andrew Kerr 和 Haicheng Wu 領導）以及 AMD 的 [Composable Kernel](https:\u002F\u002Fgithub.com\u002FROCmSoftwarePlatform\u002Fcomposable_kernel) 團隊（由 Chao Liu 和 Jing Zhang 領導）保持緊密合作。我們共同設計了許多針對各個平台的先進 GPU 最佳化技術，而這些成果的實現離不開彼此的密切協作。\n\n\n## 授權條款\n\nAITemplate 依據 [Apache 2.0 許可證](https:\u002F\u002Fgithub.com\u002Ffacebookincubator\u002FAITemplate\u002Fblob\u002Fmain\u002FLICENSE) 授權。","# AITemplate 快速上手指南\n\nAITemplate (AIT) 是一个由 Meta 开源的 Python 框架，旨在将深度神经网络转换为高性能的 CUDA (NVIDIA) 或 HIP (AMD) C++ 代码，以实现极速推理。它不依赖 cuBLAS、cuDNN 等第三方运行时库，生成的模型为自包含的二进制文件，支持高度融合优化。\n\n## 环境准备\n\n### 硬件要求\n*   **NVIDIA GPU**: 仅测试支持 **SM80+** 架构（如 Ampere 系列的 A100, RTX 3090\u002F4090 等）。旧版 SM75\u002FSM70 (如 T4, V100) 可能无法运行部分内核。\n*   **AMD GPU**: 仅测试支持 **CDNA2** 架构（如 MI-210, MI-250）。CDNA1 (MI-100) 可能存在编译器问题。\n\n### 软件依赖\n*   **操作系统**: Linux\n*   **编译器**:\n    *   NVIDIA: CUDA 11.6+ (需安装 `nvcc`)\n    *   AMD: ROCm 5.2.3+ (需安装定制版 `hipcc`)\n*   **Python**: 建议 Python 3.8+\n*   **Git**: 用于克隆代码及子模块\n*   **Docker** (强烈推荐): 为避免编译器版本冲突，建议使用官方提供的 Docker 镜像进行构建和运行。\n\n## 安装步骤\n\n### 方法一：使用 Docker（推荐）\n此方法可自动配置正确的 NVCC\u002FHIPCC 环境，避免手动安装编译器的繁琐步骤。\n\n1.  克隆项目代码（务必包含子模块）：\n    ```bash\n    git clone --recursive https:\u002F\u002Fgithub.com\u002Ffacebookincubator\u002FAITemplate\n    cd AITemplate\n    ```\n\n2.  构建 Docker 镜像：\n    *   **NVIDIA (CUDA)**:\n        ```bash\n        .\u002Fdocker\u002Fbuild.sh cuda\n        ```\n    *   **AMD (ROCm)**:\n        ```bash\n        DOCKER_BUILDKIT=1 .\u002Fdocker\u002Fbuild.sh rocm\n        ```\n    构建完成后，镜像标签为 `ait:latest`。\n\n### 方法二：源码安装\n如果您已在宿主机正确配置了编译器环境，可直接构建 Python Wheel 包。\n\n1.  克隆代码并进入 Python 目录：\n    ```bash\n    git clone --recursive https:\u002F\u002Fgithub.com\u002Ffacebookincubator\u002FAITemplate\n    cd AITemplate\u002Fpython\n    ```\n\n2.  构建并安装 Wheel 包：\n    ```bash\n    python setup.py bdist_wheel\n    pip install dist\u002F*.whl --force-reinstall\n    ```\n    *注意：请确保使用的 CUDA\u002FROCm 编译器版本符合要求，否则会导致性能下降或编译失败。*\n\n## 基本使用\n\nAITemplate 通常配合 `FX2AIT` 工具使用，将 PyTorch 模型直接转换为 AIT 引擎。以下是最简化的转换与推理流程：\n\n### 1. 准备 PyTorch 模型\n假设你有一个标准的 PyTorch 模型 `model` 和对应的输入张量 `inputs`。\n\n### 2. 使用 FX2AIT 进行转换\n利用 `fx2ait` 将模型编译为 `.ait` 格式或直接生成可调用的模块。\n\n```python\nimport torch\nfrom fx2ait import AITLowerer, AITModule\nfrom fx2ait.tools.common_fx2ait import change_batch_size\n\n# 1. 定义你的 PyTorch 模型 (示例为 ResNet-50)\n# model = torchvision.models.resnet50(pretrained=True)\n# model.eval()\n\n# 2. 定义输入示例 (Batch Size, Channels, Height, Width)\n# inputs = (torch.randn(1, 3, 224, 224).cuda(),)\n\n# 3. 创建 AITLowerer 实例\nlowerer = AITLowerer(\n    model=model,\n    inputs=inputs,\n    # 可选配置：指定动态 Shape 或其他优化参数\n    # dynamic_shapes=[{0: \"batch\"}], \n)\n\n# 4. 执行转换，生成 AITModule\nait_module = lowerer.lower()\n\n# 5. 推理执行 (输入输出均为 PyTorch Tensor，无额外拷贝)\noutput = ait_module(*inputs)\n```\n\n### 3. 独立运行 (无 PyTorch 环境)\n如果部署环境没有安装 PyTorch，AITemplate 生成的二进制文件也可通过其自带的 C++\u002FPython 运行时独立加载运行，具体可参考生成的 `.so` 或 `.dll` 文件接口。\n\n### 更多资源\n*   **官方文档**: [AITemplate Documentation](https:\u002F\u002Ffacebookincubator.github.io\u002FAITemplate)\n*   **示例代码**: 查看 `examples\u002F` 目录下的 ResNet-50, BERT, Stable Diffusion 等完整案例。\n*   **教程**: 官方提供了如何添加算子、可视化优化过程等详细教程。","一家计算机视觉初创公司正致力于将其基于 VisionTransformer 的实时缺陷检测系统部署到工厂的 NVIDIA A100 GPU 集群上，以满足毫秒级响应需求。\n\n### 没有 AITemplate 时\n- **推理延迟波动大**：依赖 cuBLAS 和 cuDNN 等第三方库，算子调用开销高且显存访问效率低，导致高并发下延迟不稳定，难以达到硬件理论峰值性能。\n- **跨平台迁移困难**：若需适配客户现场的 AMD GPU 设备，必须重写大量底层 CUDA 代码或寻找替代方案，开发周期长达数周。\n- **部署环境复杂**：生成的模型严重依赖特定版本的深度学习运行时库，不同工厂服务器的环境差异常引发“在我机器上能跑”的兼容性问题。\n- **算子融合受限**：传统编译器无法将并行的 GEMM 计算与 LayerNorm 等操作有效融合，导致 GPU 算力闲置，吞吐量受限。\n\n### 使用 AITemplate 后\n- **极致推理性能**：AITemplate 直接将神经网络编译为优化的 C++ CUDA 代码，利用 TensorCore 实现接近硬件极限的 FP16 推理速度，延迟降低 40% 以上。\n- **统一代码架构**：凭借对 NVIDIA 和 AMD GPU 的统一支持，同一套 Python 定义即可自动生成适配不同硬件的高效内核，无需手动移植底层代码。\n- **独立便携部署**：编译产出的是无外部依赖的自包含二进制文件，彻底消除了运行时库版本冲突问题，实现了“一次编译，到处运行”。\n- **高级算子融合**：通过独特的水平与垂直融合技术，AITemplate 将多个细粒度算子合并为单个 GPU 内核，大幅减少内存读写次数，显著提升吞吐量。\n\nAITemplate 通过将模型直接转化为高性能原生代码，在消除部署依赖的同时，让企业能够以最低成本榨干异构 GPU 硬件的每一分算力。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Ffacebookincubator_AITemplate_93534e57.png","facebookincubator","Meta Incubator","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Ffacebookincubator_449342bd.png","We work hard to contribute our work back to the web, mobile, big data, & infrastructure communities. NB: members must have two-factor auth.",null,"https:\u002F\u002Fopensource.fb.com","https:\u002F\u002Fgithub.com\u002Ffacebookincubator",[81,85,89,93,97,101,104],{"name":82,"color":83,"percentage":84},"Python","#3572A5",77.9,{"name":86,"color":87,"percentage":88},"C++","#f34b7d",18.3,{"name":90,"color":91,"percentage":92},"Cuda","#3A4E3A",3.7,{"name":94,"color":95,"percentage":96},"C","#555555",0.1,{"name":98,"color":99,"percentage":100},"Shell","#89e051",0,{"name":102,"color":103,"percentage":100},"Nix","#7e7eff",{"name":105,"color":106,"percentage":100},"CMake","#DA3434",4720,386,"2026-04-14T14:26:39","Apache-2.0",4,"Linux","必需。NVIDIA: SM80+ (如 A100, Ampere 系列)，旧款 SM75\u002FSM70 (T4\u002FV100) 支持有限；AMD: CDNA2 (MI-210\u002F250)，CDNA1 (MI-100) 可能存在编译器问题。","未说明",{"notes":116,"python":114,"dependencies":117},"强烈建议使用提供的 Docker 镜像以避免编译器版本错误。该工具不依赖 cuBLAS、cuDNN 等第三方运行时库，编译后生成独立的二进制文件。若从源码安装，需确保正确克隆子模块并使用指定版本的编译器，否则会导致性能下降。",[118,119,120],"CUDA Toolkit 11.6 (NVIDIA)","ROCm 5.2.3 + 定制 HIPCC (AMD)","PyTorch (可选，用于 FX2AIT 转换)",[14],"2026-03-27T02:49:30.150509","2026-04-15T07:13:57.619261",[125,130,135,140,145,150],{"id":126,"question_zh":127,"answer_zh":128,"source_url":129},33937,"在使用 ControlNet 运行 Stable Diffusion 时遇到 \"ValueError: Did not get correct number of inputs expected 3, got 16\" 错误，如何解决？","该错误是因为使用了普通的 UNet 模型而不是支持 ControlNet 的 Control UNet。解决方法如下：\n1. 编译 UNet 时务必添加 `--controlnet True` 参数。\n2. 编译完成后，将生成的模型文件夹 `UNet2DConditionModel\u002F` 重命名为 `ControlNetUNet2DConditionModel\u002F`。\n3. 确保使用 PyTorch 1.13 + CUDA 11.7 环境，PyTorch 2.0 可能会引发此错误。\n4. 注意：`compile_alt.py` 目前仅支持静态形状，如果使用动态形状参数（如多个宽高值），它只会取第一个值。建议暂时使用单一尺寸（例如 `--width 512 512 --height 512 512`）进行编译。","https:\u002F\u002Fgithub.com\u002Ffacebookincubator\u002FAITemplate\u002Fissues\u002F797",{"id":131,"question_zh":132,"answer_zh":133,"source_url":134},33938,"如何在高分辨率（如 1024x1024）下推理以避免显存溢出（OOM）？","如果在高分辨率下遇到显存不足的问题，可以尝试以下方法：\n1. 拆分 Batch Size：将 batch size 设置为 2，然后分两次运行推理（每次 batch size 为 1），这通常能解决 OOM 问题。\n2. 等待 xformers 支持：基于 xformers 的注意力机制即将加入，这将显著降低显存消耗并支持更高分辨率。\n3. 检查输入尺寸：确保编译 VAE 和 UNet 模型时的输入尺寸设置合理，过大的编译输入可能导致推理时非法内存访问错误。","https:\u002F\u002Fgithub.com\u002Ffacebookincubator\u002FAITemplate\u002Fissues\u002F13",{"id":136,"question_zh":137,"answer_zh":138,"source_url":139},33939,"运行 Stable Diffusion 2.1 时生成图像异常或出现状态字典缺失（Missing keys in state_dict）错误怎么办？","Stable Diffusion 2.1 的架构与 1.5 有所不同，直接加载旧脚本或权重可能导致图像生成异常或报错。\n解决方案：\n1. 确保使用最新的 AITemplate 代码，特别是针对 ALT pipeline 的修复补丁（参考相关 PR）。\n2. 如果脚默认指向错误的版本（如脚本下载 1.5 但代码尝试加载 2.1），请显式指定正确的本地模型路径，例如：`python3 scripts\u002Fcompile.py --local-dir .\u002Ftmp\u002Fdiffusers-pipeline\u002Frunwayml\u002Fstable-diffusion-v1-5\u002F`（针对 1.5）或对应的 2.1 路径。\n3. 对于 SD 2.1，性能提升部分源于模型架构本身的改变，建议在拥有大显存 GPU（如 A100-80G）时开启 batch-size 选项进行基准测试。","https:\u002F\u002Fgithub.com\u002Ffacebookincubator\u002FAITemplate\u002Fissues\u002F722",{"id":141,"question_zh":142,"answer_zh":143,"source_url":144},33940,"在 fx2ait 工具中如何实现对张量沿特定维度求最大值（max\u002Famax）的操作？","早期版本的 AITemplate 不直接支持 `amax` 或 `max(dim=...)` 操作，导致移植包含此类操作的模型（如 `x = x \u002F x.amax(dim=-1, keepdim=True)`）失败。\n解决方案：\n请更新到最新版本的 AITemplate。维护者已通过 PR #942 添加了相关操作支持。更新后，`argmax`、`gather` 以及降维最大值操作应能正常工作。如果仍遇到问题，请确保使用的是包含该修复的最新代码库。","https:\u002F\u002Fgithub.com\u002Ffacebookincubator\u002FAITemplate\u002Fissues\u002F941",{"id":146,"question_zh":147,"answer_zh":148,"source_url":149},33941,"运行 Stable Diffusion 示例脚本时出现 Hugging Face Hub 验证错误或模型版本不匹配怎么办？","此问题通常是由于脚本中硬编码的模型版本与实际下载逻辑不一致导致的（例如脚本试图下载 1.5 但代码逻辑指向 2.0\u002F2.1）。\n解决方法：\n1. 更新代码库以获取最新的修复补丁（参考 PR #654）。\n2. 如果无法立即更新，可以在运行编译脚本时通过 `--local-dir` 参数显式指定已下载的正确模型版本路径，绕过自动下载和版本检测逻辑。例如：`python3 scripts\u002Fcompile.py --local-dir \u003Cpath_to_your_model>`。","https:\u002F\u002Fgithub.com\u002Ffacebookincubator\u002FAITemplate\u002Fissues\u002F650",{"id":151,"question_zh":152,"answer_zh":153,"source_url":134},33942,"AITemplate 是否支持 xformers 以降低 Stable Diffusion 的显存占用？","是的，AITemplate 已经支持或计划支持 xformers。维护者确认已完成相关工作（参考 PR #74）。使用 xformers 可以显著降低显存消耗，从而允许在更高分辨率（超过 1024x1024）下进行推理。如果遇到显存问题，请确保拉取了包含此功能的最新代码。",[155,160],{"id":156,"version":157,"summary_zh":158,"released_at":159},263838,"0.2","* FX2AIT：PyTorch 与 AITemplate 之间的连接器。更多详情请参阅：https:\u002F\u002Fgithub.com\u002Ffacebookincubator\u002FAITemplate\u002Ftree\u002Fmain\u002Ffx2ait\u002FREADME.md。PT2 与 AITemplate 的另一款连接器仍在开发中，敬请期待。\n* 数据类型支持：新增对 fp32 的支持。bfloat16 正在开发中。\n* 性能分析：缩短了 GeMM 和 Conv 核心的性能分析时间。\n* 工具链：新增简单的逐算子性能分析功能，并改进了错误提示信息。\n* 示例：StableDiffusion 示例已更新。","2023-01-31T05:49:01",{"id":161,"version":162,"summary_zh":163,"released_at":164},263839,"0.1","AITemplate 初始发布。","2022-10-11T07:10:16"]