[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-pytorch--benchmark":3,"tool-pytorch--benchmark":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 真正成长为懂上",143909,2,"2026-04-07T11:33:18",[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":32,"last_commit_at":50,"category_tags":51,"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":54,"name":55,"github_repo":56,"description_zh":57,"stars":58,"difficulty_score":10,"last_commit_at":59,"category_tags":60,"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":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":73,"owner_avatar_url":74,"owner_bio":75,"owner_company":76,"owner_location":76,"owner_email":76,"owner_twitter":76,"owner_website":77,"owner_url":78,"languages":79,"stars":103,"forks":104,"last_commit_at":105,"license":106,"difficulty_score":107,"env_os":108,"env_gpu":109,"env_ram":110,"env_deps":111,"category_tags":119,"github_topics":121,"view_count":32,"oss_zip_url":76,"oss_zip_packed_at":76,"status":17,"created_at":122,"updated_at":123,"faqs":124,"releases":155},5058,"pytorch\u002Fbenchmark","benchmark","TorchBench is a collection of open source benchmarks used to evaluate PyTorch performance.","TorchBench 是一套专为评估 PyTorch 性能而设计的开源基准测试集合。它收录了多种主流或具有代表性的 AI 工作负载模型，并进行了标准化改造，旨在解决不同模型间测试接口不统一、依赖环境复杂以及缺乏标准训练\u002F测试数据等痛点，让性能对比更加公平、高效。\n\n这套工具主要面向 AI 框架开发者、系统优化工程师及研究人员。如果你需要验证新版本的 PyTorch 是否带来速度提升，或者想测试 torchinductor、torchscript 等不同后端的执行效率，TorchBench 能提供开箱即用的支持。其核心亮点在于“自包含”设计：每个模型都内置了微型数据集和自动化的依赖安装脚本，并暴露了统一的 API 供测试驱动调用，极大降低了搭建测试环境的门槛。\n\n此外，TorchBench 特别强调测试结果的准确性，提供了针对低噪声机器的自动化调优工具，帮助排除中断、上下文切换等系统干扰，确保基准测试数据的可靠性。需要注意的是，为了获得最佳效果，建议使用最新的 PyTorch 夜间构建版本，并严格保持 torch、torchvision 和 torchaudio 来自同一构建源，以避免二","TorchBench 是一套专为评估 PyTorch 性能而设计的开源基准测试集合。它收录了多种主流或具有代表性的 AI 工作负载模型，并进行了标准化改造，旨在解决不同模型间测试接口不统一、依赖环境复杂以及缺乏标准训练\u002F测试数据等痛点，让性能对比更加公平、高效。\n\n这套工具主要面向 AI 框架开发者、系统优化工程师及研究人员。如果你需要验证新版本的 PyTorch 是否带来速度提升，或者想测试 torchinductor、torchscript 等不同后端的执行效率，TorchBench 能提供开箱即用的支持。其核心亮点在于“自包含”设计：每个模型都内置了微型数据集和自动化的依赖安装脚本，并暴露了统一的 API 供测试驱动调用，极大降低了搭建测试环境的门槛。\n\n此外，TorchBench 特别强调测试结果的准确性，提供了针对低噪声机器的自动化调优工具，帮助排除中断、上下文切换等系统干扰，确保基准测试数据的可靠性。需要注意的是，为了获得最佳效果，建议使用最新的 PyTorch 夜间构建版本，并严格保持 torch、torchvision 和 torchaudio 来自同一构建源，以避免二进制兼容性问题。无论是进行底层算子优化还是框架级性能分析，TorchBench 都是值得信赖的得力助手。","# PyTorch Benchmarks\nThis is a collection of open source benchmarks used to evaluate PyTorch performance.\n\n`torchbenchmark\u002Fmodels` contains copies of popular or exemplary workloads which have been modified to:\n*(a)* expose a standardized API for benchmark drivers, *(b)* optionally, enable backends such as torchinductor\u002Ftorchscript,\n *(c)* contain a miniature version of train\u002Ftest data and a dependency install script.\n\n## Installation\nThe benchmark suite should be self contained in terms of dependencies,\nexcept for the torch products which are intended to be installed separately so\ndifferent torch versions can be benchmarked.\n\n### Using Pre-built Packages\nWe support Python 3.8+, and 3.11 is recommended. Conda is optional but suggested. To start with Python 3.11 in conda:\n```\n# Using your current conda environment:\nconda install -y python=3.11\n\n# Or, using a new conda environment:\nconda create -n torchbenchmark python=3.11\nconda activate torchbenchmark\n```\n\nIf you are running NVIDIA GPU tests, we support both CUDA 11.8 and 12.1, and use CUDA 12.1 as default:\n```\nconda install -y -c pytorch magma-cuda121\n```\n\nThen install pytorch, torchvision, and torchaudio using conda:\n```\nconda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch-nightly -c nvidia\n```\nOr use pip:\n(but don't mix and match pip and conda for the torch family of libs! - [see notes below](#notes))\n```\npip3 install --pre torch torchvision torchaudio --index-url https:\u002F\u002Fdownload.pytorch.org\u002Fwhl\u002Fnightly\u002Fcu121\n```\n\nInstall the benchmark suite, which will recursively install dependencies for all the models.  Currently, the repo is intended to be installed from the source tree.\n```\ngit clone https:\u002F\u002Fgithub.com\u002Fpytorch\u002Fbenchmark\ncd benchmark\npython3 install.py\n```\n\n### Install torchbench as a library\n\nif you're interested in running torchbench as a library you can\n\n```bash\npython3 install.py\npip install git+https:\u002F\u002Fwww.github.com\u002Fpytorch\u002Fbenchmark.git\n```\n\nor \n\n```bash\npython3 install.py\npip install . # add -e for an editable installation\n```\n\nThe above\n\n```python\nimport torchbenchmark.models.densenet121\nmodel, example_inputs = torchbenchmark.models.densenet121.Model(test=\"eval\", device=\"cuda\", batch_size=1).get_module()\nmodel(*example_inputs)\n```\n\n### Building From Source\nNote that when building PyTorch from source, torchvision and torchaudio must also be built from source to make sure the C APIs match.\n\nSee detailed instructions to install torchvision [here](https:\u002F\u002Fgithub.com\u002Fpytorch\u002Fvision\u002Fblob\u002Fmain\u002FCONTRIBUTING.md) and torchaudio [here](https:\u002F\u002Fgithub.com\u002Fpytorch\u002Faudio\u002Fblob\u002Fmain\u002FCONTRIBUTING.md).\nMake sure to enable CUDA (by `USE_CUDA=1`) if using CUDA.\nThen,\n```\ngit clone https:\u002F\u002Fgithub.com\u002Fpytorch\u002Fbenchmark\ncd benchmark\npython3 install.py\n```\n\n### Notes\n- Setup steps require network connectivity - make sure to enable a proxy if needed.\n- We suggest using the latest PyTorch nightly releases to run the benchmark. Stable versions are NOT tested or maintained.\n- torch, torchvision, and torchaudio must all be installed from the same build process.  This means it isn't possible to mix conda torchvision\n  with pip torch, or mix built-from-source torch with pip torchvision.  It's important to match even the conda channel (nightly vs regular).\n  This is due to the differences in the compilation process used by different packaging systems producing incompatible Python binary extensions.\n\n## Using a low-noise machine\nVarious sources of noise, such as interrupts, context switches, clock frequency scaling, etc. can all conspire to make benchmark results variable.  It's important to understand the level of noise in your setup before drawing conclusions from benchmark data.  While any machine can in principle be tuned up, the steps and end-results vary with OS, kernel, drivers, and hardware.  To this end, torchbenchmark picks a favorite machine type it can support well, and provides utilities for automated tuning on that machine.  In the future, we may support more machine types and would be happy for contributions here.\n\nThe currently supported machine type is an AWS g4dn.metal instance using Amazon Linux.  This is one of the subsets of AWS instance types that supports [processor state control](https:\u002F\u002Fdocs.aws.amazon.com\u002FAWSEC2\u002Flatest\u002FUserGuide\u002Fprocessor_state_control.html), with documented tuning guides for Amazon Linux.  Most if not all of these steps should be possible on Ubuntu but haven't been automated yet.\n\nTo tune your g4dn.metal Amazon Linux machine, run\n```\nsudo `which python` torchbenchmark\u002Futil\u002Fmachine_config.py --configure\n```\n\nWhen running pytest (see below), the machine_config script is invoked to assert a proper configuration and log config info into the output json.  It is possible to ```--ignore_machine_config``` if running pytest without tuning is desired.\n\n\n## Running Model Benchmarks\nThere are multiple ways for running the model benchmarks.\n\n`test.py` offers the simplest wrapper around the infrastructure for iterating through each model and installing and executing it.\n\n`test_bench.py` is a pytest-benchmark script that leverages the same infrastructure but collects benchmark statistics and supports pytest filtering.\n\n`userbenchmark` allows to develop and run customized benchmarks.\n\nIn each model repo, the assumption is that the user would already have all of the torch family of packages installed (torch, torchvision, torchaudio...) but it installs the rest of the dependencies for the model.\n\n### Using `test.py`\n`python3 test.py` will execute the APIs for each model, as a sanity check.  For benchmarking, use `test_bench.py`.  It is based on unittest, and supports filtering via CLI.\n\nFor instance, to run the BERT model on CPU for the train execution mode:\n```\npython3 test.py -k \"test_BERT_pytorch_train_cpu\"\n```\n\nThe test name follows the following pattern:\n\n```\n\"test_\" + \u003Cmodel_name> + \"_\" + {\"train\" | \"eval\" } + \"_\" + {\"cpu\" | \"cuda\"}\n```\n\n### Using pytest-benchmark driver\n`pytest test_bench.py` invokes the benchmark driver.  See `--help` for a complete list of options.\n\nSome useful options include:\n- `--benchmark-autosave` (or other save related flags) to get .json output\n- `-k \u003Cfilter expression>` standard pytest filtering\n- `--collect-only` only show what tests would run, useful to see what models there are or debug your filter expression\n- `--cpu_only` if running on a local CPU machine and ignoring machine configuration checks\n\n#### Examples of Benchmark Filters\n- `-k \"test_train[NAME-cuda]\"` for a particular flavor of a particular model\n- `-k \"(BERT and (not cuda))\"` for a more flexible approach to filtering\n\nNote that `test_bench.py` will eventually be deprecated as the `userbenchmark` work evolve. Users are encouraged to explore and consider using [userbenchmark](#using-userbenchmark).\n\n### Using userbenchmark\n\nThe `userbenchmark` allows you to develop your customized benchmarks with TorchBench models. Refer to the [userbenchmark instructions](https:\u002F\u002Fgithub.com\u002Fpytorch\u002Fbenchmark\u002Fblob\u002Fmain\u002Fuserbenchmark\u002FADDING_USERBENCHMARKS.md) to learn more on how you can create a new `userbenchmark`. You can then use the `run_benchmark.py` driver to drive the benchmark. e.g. `python run_benchmark.py \u003Cbenchmark_name>`. Run `python run_benchmark.py —help` to find out available options.\n\n### Using `run.py` for simple debugging or profiling\nSometimes you may want to just run train or eval on a particular model, e.g. for debugging or profiling.  Rather than relying on __main__ implementations inside each model, `run.py` provides a lightweight CLI for this purpose, building on top of the standard BenchmarkModel API.\n\n```\npython3 run.py \u003Cmodel> [-d {cpu,cuda}] [-t {eval,train}] [--profile]\n```\nNote: `\u003Cmodel>` can be a full, exact name, or a partial string match.\n\n### Using torchbench models as a library\n\nIf you're interested in using torchbench as a suite of models you can test, the easiest way to integrate it into your code\u002Fci\u002Ftests would be something like\n\n```python\nimport torch\nimport importlib \nimport sys\n\n# If your directory looks like this_file.py, benchmark\u002F\nsys.path.append(\"benchmark\")\nmodel_name = \"torchbenchmark.models.stable_diffusion_text_encoder\" # replace this by the name of the model you're working on\nmodule = importlib.import_module(model_name)\n\nbenchmark_cls = getattr(module, \"Model\", None)\nbenchmark = benchmark_cls(test=\"eval\", device = \"cuda\") # test = train or eval device = cuda or cpu\n\nmodel, example = benchmark.get_module()\nmodel(*example)\n```\n\n## Nightly CI runs\n\nCurrently, the models run on nightly pytorch builds and push data to Meta's internal database.\nThe [Nightly CI](https:\u002F\u002Fgithub.com\u002Fpytorch\u002Fbenchmark\u002Factions) publishes both\n[V1](torchbenchmark\u002Fscore\u002Fconfigs\u002Fv1\u002Fconfig-v1.md) and\n[V0](torchbenchmark\u002Fscore\u002Fconfigs\u002Fv0\u002Fconfig-v0.md) performance scores.\n\n\nSee [Unidash](https:\u002F\u002Fwww.internalfb.com\u002Fintern\u002Funidash\u002Fdashboard\u002Fpytorch_benchmarks\u002Ftorchbenchmark_v0\u002F) (Meta-internal only)\n\n## Adding new models\n\nSee [Adding Models](torchbenchmark\u002Fmodels\u002FADDING_MODELS.md).\n","# PyTorch 基准测试\n这是一个用于评估 PyTorch 性能的开源基准测试集合。\n\n`torchbenchmark\u002Fmodels` 包含一些流行或典型的负载副本，这些副本已被修改，以：\n*(a)* 暴露一个标准化的 API 供基准测试驱动程序使用；*(b)* 可选地支持诸如 torchinductor\u002Ftorchscript 等后端；*(c)* 包含训练\u002F测试数据的精简版本以及依赖项安装脚本。\n\n## 安装\n该基准测试套件在依赖项方面应是自包含的，\n但 PyTorch 相关产品除外，因为它们需要单独安装，以便可以对不同版本的 PyTorch 进行基准测试。\n\n### 使用预构建包\n我们支持 Python 3.8 及以上版本，推荐使用 3.11。Conda 是可选的，但建议使用。要在 Conda 中使用 Python 3.11：\n```\n# 使用当前的 Conda 环境：\nconda install -y python=3.11\n\n# 或者，使用一个新的 Conda 环境：\nconda create -n torchbenchmark python=3.11\nconda activate torchbenchmark\n```\n\n如果您要运行 NVIDIA GPU 测试，我们同时支持 CUDA 11.8 和 12.1，并默认使用 CUDA 12.1：\n```\nconda install -y -c pytorch magma-cuda121\n```\n\n然后使用 Conda 安装 PyTorch、torchvision 和 torchaudio：\n```\nconda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch-nightly -c nvidia\n```\n或者使用 pip：\n（但请勿将 pip 和 Conda 混用来安装 PyTorch 家族的库！— [参见下方说明](#notes)）\n```\npip3 install --pre torch torchvision torchaudio --index-url https:\u002F\u002Fdownload.pytorch.org\u002Fwhl\u002Fnightly\u002Fcu121\n```\n\n安装基准测试套件，它会递归地安装所有模型所需的依赖项。目前，该仓库建议从源代码树进行安装。\n```\ngit clone https:\u002F\u002Fgithub.com\u002Fpytorch\u002Fbenchmark\ncd benchmark\npython3 install.py\n```\n\n### 将 torchbench 作为库安装\n\n如果您希望将 torchbench 作为库来运行，可以执行以下操作：\n\n```bash\npython3 install.py\npip install git+https:\u002F\u002Fwww.github.com\u002Fpytorch\u002Fbenchmark.git\n```\n\n或者\n\n```bash\npython3 install.py\npip install . # 添加 -e 选项以进行可编辑安装\n```\n\n上述操作后，您可以这样使用：\n\n```python\nimport torchbenchmark.models.densenet121\nmodel, example_inputs = torchbenchmark.models.densenet121.Model(test=\"eval\", device=\"cuda\", batch_size=1).get_module()\nmodel(*example_inputs)\n```\n\n### 从源码构建\n请注意，当从源码构建 PyTorch 时，torchvision 和 torchaudio 也必须从源码构建，以确保 C API 匹配。\n\n有关安装 torchvision 的详细说明，请参阅 [此处](https:\u002F\u002Fgithub.com\u002Fpytorch\u002Fvision\u002Fblob\u002Fmain\u002FCONTRIBUTING.md)，而 torchaudio 的说明则可在 [此处](https:\u002F\u002Fgithub.com\u002Fpytorch\u002Faudio\u002Fblob\u002Fmain\u002FCONTRIBUTING.md)找到。如果使用 CUDA，请务必启用 CUDA（通过 `USE_CUDA=1`）。之后，执行以下命令：\n```\ngit clone https:\u002F\u002Fgithub.com\u002Fpytorch\u002Fbenchmark\ncd benchmark\npython3 install.py\n```\n\n### 注意事项\n- 设置步骤需要网络连接——如有必要，请确保已启用代理。\n- 我们建议使用最新的 PyTorch 夜间版来运行基准测试。稳定版未经过测试或维护。\n- PyTorch、torchvision 和 torchaudio 必须来自同一构建过程。这意味着不能将 Conda 版本的 torchvision 与 pip 版本的 PyTorch 混用，也不能将源码编译的 PyTorch 与 pip 安装的 torchvision 混用。即使是 Conda 通道（夜间版 vs 正常版）也必须一致。这是由于不同打包系统采用的编译流程存在差异，从而导致生成的 Python 二进制扩展不兼容。\n\n## 使用低噪声机器\n各种噪声源，如中断、上下文切换、时钟频率缩放等，都可能导致基准测试结果出现波动。在根据基准测试数据得出结论之前，了解您环境中的噪声水平非常重要。虽然原则上任何机器都可以进行优化，但具体步骤和最终效果会因操作系统、内核、驱动程序和硬件的不同而有所差异。为此，torchbenchmark 选择了一种能够良好支持的机器类型，并提供了针对该机器的自动化调优工具。未来，我们可能会支持更多类型的机器，并欢迎在此方面的贡献。\n\n目前支持的机器类型是使用 Amazon Linux 的 AWS g4dn.metal 实例。这是 AWS 实例类型中少数支持 [处理器状态控制](https:\u002F\u002Fdocs.aws.amazon.com\u002FAWSEC2\u002Flatest\u002FUserGuide\u002Fprocessor_state_control.html)的实例之一，并且有针对 Amazon Linux 的官方调优指南。尽管这些步骤在大多数情况下也可以在 Ubuntu 上实现，但尚未实现自动化。\n\n要调优您的 g4dn.metal Amazon Linux 机器，运行以下命令：\n```\nsudo `which python` torchbenchmark\u002Futil\u002Fmachine_config.py --configure\n```\n\n在运行 pytest 时（见下文），machine_config 脚本会被调用以确认配置是否正确，并将配置信息记录到输出的 JSON 文件中。如果希望在不进行调优的情况下运行 pytest，可以使用 `--ignore_machine_config` 选项。\n\n## 运行模型基准测试\n运行模型基准测试有多种方式。\n\n`test.py` 提供了一个最简单的封装，用于遍历每个模型并安装和执行它们。\n\n`test_bench.py` 是一个 pytest-benchmark 脚本，它利用相同的基础设施，但会收集基准测试统计信息，并支持 pytest 过滤功能。\n\n`userbenchmark` 允许开发和运行自定义基准测试。\n\n在每个模型仓库中，假设用户已经安装了 PyTorch 家族的所有软件包（PyTorch、torchvision、torchaudio 等），但它会安装该模型所需的其余依赖项。\n\n### 使用 `test.py`\n`python3 test.py` 会执行每个模型的 API，作为一项健全性检查。若要进行基准测试，请使用 `test_bench.py`。它基于 unittest，并支持通过 CLI 进行过滤。\n\n例如，要在 CPU 上运行 BERT 模型的训练模式：\n```\npython3 test.py -k \"test_BERT_pytorch_train_cpu\"\n```\n\n测试名称遵循以下模式：\n\n```\n\"test_\" + \u003C模型名称> + \"_\" + {\"train\" | \"eval\"} + \"_\" + {\"cpu\" | \"cuda\"}\n```\n\n### 使用 pytest-benchmark 驱动程序\n`pytest test_bench.py` 会调用基准测试驱动程序。完整的选项列表可通过 `--help` 查看。\n\n一些有用的选项包括：\n- `--benchmark-autosave`（或其他保存相关标志）以获取 .json 格式的输出\n- `-k \u003C筛选表达式>` 标准的 pytest 筛选功能\n- `--collect-only` 仅显示将要运行的测试，可用于查看有哪些模型或调试您的筛选表达式\n- `--cpu_only` 如果在本地 CPU 机器上运行且忽略机器配置检查\n\n#### 基准测试筛选示例\n- `-k \"test_train[NAME-cuda]\"` 用于特定模型的特定变体\n- `-k \"(BERT and (not cuda))\"` 用于更灵活的筛选方法\n\n请注意，随着 `userbenchmark` 的不断发展，`test_bench.py` 最终将被弃用。鼓励用户探索并考虑使用 [userbenchmark](#using-userbenchmark)。\n\n### 使用 userbenchmark\n\n`userbenchmark` 允许您基于 TorchBench 中的模型开发自定义基准测试。请参阅 [userbenchmark 使用说明](https:\u002F\u002Fgithub.com\u002Fpytorch\u002Fbenchmark\u002Fblob\u002Fmain\u002Fuserbenchmark\u002FADDING_USERBENCHMARKS.md)，了解如何创建新的 `userbenchmark`。随后，您可以使用 `run_benchmark.py` 驱动程序来运行基准测试，例如：`python run_benchmark.py \u003Cbenchmark_name>`。运行 `python run_benchmark.py —help` 可查看可用选项。\n\n### 使用 `run.py` 进行简单调试或性能分析\n有时您可能只想针对特定模型运行训练或评估，例如用于调试或性能分析。为了避免依赖每个模型内部的 `__main__` 实现，`run.py` 提供了一个轻量级的命令行界面来实现这一目的，该界面基于标准的 BenchmarkModel API 构建。\n\n```\npython3 run.py \u003Cmodel> [-d {cpu,cuda}] [-t {eval,train}] [--profile]\n```\n注意：\u003Cmodel> 可以是完整的精确名称，也可以是部分字符串匹配。\n\n### 将 torchbench 模型用作库\n\n如果您希望将 torchbench 作为一个可供测试的模型集合来使用，最简单的方式是将其集成到您的代码、CI 或测试中，如下所示：\n\n```python\nimport torch\nimport importlib\nimport sys\n\n# 如果您的目录结构为 this_file.py, benchmark\u002F\nsys.path.append(\"benchmark\")\nmodel_name = \"torchbenchmark.models.stable_diffusion_text_encoder\" # 替换为您正在使用的模型名称\nmodule = importlib.import_module(model_name)\n\nbenchmark_cls = getattr(module, \"Model\", None)\nbenchmark = benchmark_cls(test=\"eval\", device=\"cuda\") # test 可为 train 或 eval；device 可为 cuda 或 cpu\n\nmodel, example = benchmark.get_module()\nmodel(*example)\n```\n\n## 每日 CI 测试运行\n\n目前，这些模型在每日构建的 PyTorch 版本上运行，并将数据推送至 Meta 的内部数据库。[每日 CI](https:\u002F\u002Fgithub.com\u002Fpytorch\u002Fbenchmark\u002Factions) 会发布 V1 和 V0 两种版本的性能分数。\n\n详情请参见 [Unidash](https:\u002F\u002Fwww.internalfb.com\u002Fintern\u002Funidash\u002Fdashboard\u002Fpytorch_benchmarks\u002Ftorchbenchmark_v0\u002F)（仅限 Meta 内部）。\n\n## 添加新模型\n\n请参阅 [添加模型](torchbenchmark\u002Fmodels\u002FADDING_MODELS.md)。","# PyTorch Benchmark 快速上手指南\n\n## 环境准备\n\n在开始之前，请确保您的系统满足以下要求：\n\n*   **操作系统**：Linux (推荐 Amazon Linux 或 Ubuntu)，Windows\u002FmacOS 支持有限。\n*   **Python 版本**：Python 3.8+ (推荐使用 **Python 3.11**)。\n*   **GPU 支持**：若需测试 NVIDIA GPU，需安装 CUDA 11.8 或 12.1 (默认推荐 **CUDA 12.1**)。\n*   **网络环境**：安装过程需要下载大量依赖，请确保网络畅通。国内用户建议配置代理或使用国内镜像源加速 `pip`\u002F`conda`。\n*   **管理工具**：推荐使用 **Conda** 管理环境（可选但强烈建议）。\n\n> **注意**：`torch`, `torchvision`, `torchaudio` 必须来自同一构建源（例如全部通过 conda 安装，或全部通过 pip 安装，或全部源码编译），严禁混用，否则会导致二进制不兼容。\n\n## 安装步骤\n\n### 1. 创建并激活 Conda 环境\n推荐使用 Python 3.11 创建独立环境：\n\n```bash\n# 创建新环境\nconda create -n torchbenchmark python=3.11\nconda activate torchbenchmark\n```\n\n### 2. 安装 PyTorch 及相关组件\n根据是否使用 GPU 选择以下一种方式安装。**国内用户建议使用清华或中科大镜像源加速**。\n\n**方案 A：使用 Conda 安装 (推荐)**\n```bash\n# 安装 magma (仅 NVIDIA GPU 需要)\nconda install -y -c pytorch magma-cuda121\n\n# 安装 PyTorch 全家桶 (使用 nightly 版本以获得最新支持)\nconda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch-nightly -c nvidia\n```\n\n**方案 B：使用 Pip 安装**\n```bash\npip3 install --pre torch torchvision torchaudio --index-url https:\u002F\u002Fdownload.pytorch.org\u002Fwhl\u002Fnightly\u002Fcu121\n```\n\n### 3. 安装 Benchmark 套件\n克隆仓库并运行安装脚本，该脚本会自动递归安装所有模型所需的依赖。\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fpytorch\u002Fbenchmark\ncd benchmark\npython3 install.py\n```\n\n> **提示**：如果您希望将 `torchbench` 作为库在其他项目中使用，也可执行 `pip install .` 或 `pip install -e .` 进行安装。\n\n## 基本使用\n\n安装完成后，您可以通过以下几种方式使用该工具：\n\n### 1. 运行特定模型测试 (最简单)\n使用 `test.py` 可以快速验证单个模型的运行情况。命令格式遵循 `test_\u003C模型名>_\u003C模式>_\u003C设备>` 的模式。\n\n**示例：在 CPU 上运行 BERT 模型的训练模式**\n```bash\npython3 test.py -k \"test_BERT_pytorch_train_cpu\"\n```\n\n**示例：在 CUDA 上运行 BERT 模型的评估模式**\n```bash\npython3 test.py -k \"test_BERT_pytorch_eval_cuda\"\n```\n\n### 2. 执行性能基准测试\n使用 `pytest` 驱动 `test_bench.py` 可以收集详细的性能统计数据。\n\n**示例：运行所有可用的基准测试并保存结果为 JSON**\n```bash\npytest test_bench.py --benchmark-autosave\n```\n\n**示例：仅运行包含 \"BERT\" 且不在 CUDA 上运行的测试**\n```bash\npytest test_bench.py -k \"(BERT and (not cuda))\"\n```\n\n### 3. 调试与性能分析 (Profile)\n如果只需对单个模型进行简单的调试或性能剖析，可使用 `run.py`。\n\n**示例：对 resnet18 模型在 CUDA 上进行训练模式剖析**\n```bash\npython3 run.py resnet18 -d cuda -t train --profile\n```\n\n### 4. 作为 Python 库调用\n您可以在自己的代码中直接加载模型进行测试：\n\n```python\nimport torchbenchmark.models.densenet121\n\n# 初始化模型 (模式：eval, 设备：cuda, 批次大小：1)\nmodel, example_inputs = torchbenchmark.models.densenet121.Model(test=\"eval\", device=\"cuda\", batch_size=1).get_module()\n\n# 执行推理\nmodel(*example_inputs)\n```","某深度学习框架优化团队在发布新版 PyTorch 前，需要验证其编译器后端（如 TorchInductor）对主流模型的实际加速效果。\n\n### 没有 benchmark 时\n- **模型复现成本高**：工程师需手动寻找并配置 DenseNet、BERT 等数十个主流模型的代码与依赖，常因版本冲突耗费数天环境调试时间。\n- **评估标准不统一**：不同成员使用的输入数据形状（Batch Size、分辨率）和预处理逻辑各异，导致性能对比数据缺乏公信力，难以定位是模型差异还是代码问题。\n- **硬件噪声干扰大**：缺乏标准化的低噪声机器调优指南，CPU 频率波动或系统中断导致测试结果忽高忽低，无法判断性能提升是真实优化还是实验误差。\n- **后端适配困难**：手动修改每个模型以支持新后端（如 TorchScript）极易引入 bug，且难以保证所有模型都能正确运行在新编译器上。\n\n### 使用 benchmark 后\n- **一键加载模型**：通过 `torchbenchmark.models` 直接调用预置的标准化模型（如 `densenet121`），自动处理迷你数据集与依赖安装，将环境准备时间从几天缩短至几分钟。\n- **标准化 API 对齐**：所有模型暴露统一的接口规范，确保测试时的输入维度、设备类型完全一致，生成的性能报表具备横向可比性，精准反映框架升级收益。\n- **自动化环境调优**：利用内置工具自动配置低噪声运行环境，抑制上下文切换与频率缩放干扰，确保毫秒级的性能差异也能被稳定捕捉。\n- **无缝后端切换**：只需在调用时指定参数即可轻松切换 TorchInductor 或 TorchScript 后端，快速验证新编译器在各类负载下的兼容性与加速比。\n\nbenchmark 将碎片化的模型评估工作转化为标准化的流水线，让团队能专注于核心算法优化而非繁琐的环境搭建。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fpytorch_benchmark_17f60510.png","pytorch","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fpytorch_be722ba8.jpg","",null,"https:\u002F\u002Fpytorch.org","https:\u002F\u002Fgithub.com\u002Fpytorch",[80,84,88,92,96,99],{"name":81,"color":82,"percentage":83},"Python","#3572A5",90,{"name":85,"color":86,"percentage":87},"Jupyter Notebook","#DA5B0B",8.7,{"name":89,"color":90,"percentage":91},"Shell","#89e051",0.9,{"name":93,"color":94,"percentage":95},"MATLAB","#e16737",0.2,{"name":97,"color":98,"percentage":95},"Dockerfile","#384d54",{"name":100,"color":101,"percentage":102},"Makefile","#427819",0,1021,331,"2026-04-07T02:53:52","BSD-3-Clause",4,"Linux","NVIDIA GPU 为可选项（支持 CPU 模式）。若运行 GPU 测试，支持 CUDA 11.8 和 12.1（默认 12.1），需安装 magma-cuda121。具体显存大小未说明，取决于所选模型。","未说明",{"notes":112,"python":113,"dependencies":114},"1. torch、torchvision 和 torchaudio 必须来自同一构建过程（例如全部使用 conda 或全部源码编译），严禁混用不同安装源（如 conda 与 pip 混用），否则会导致二进制不兼容。\n2. 建议使用最新的 PyTorch 夜间版（nightly），稳定版未经过测试和维护。\n3. 为了获得准确的基准测试结果，建议在低噪声机器上运行（如配置了处理器状态控制的 AWS g4dn.metal 实例），并可使用提供的脚本进行自动调优。\n4. 安装过程需要网络连接，如需代理请提前配置。\n5. 该工具集包含多个模型的迷你训练\u002F测试数据及依赖安装脚本，安装时会递归安装各模型所需的依赖。","3.8+ (推荐 3.11)",[115,116,117,118],"torch (nightly build recommended)","torchvision","torchaudio","magma-cuda121 (仅限 NVIDIA GPU)",[120,14],"其他",[73,64],"2026-03-27T02:49:30.150509","2026-04-07T22:49:57.431079",[125,130,135,140,145,150],{"id":126,"question_zh":127,"answer_zh":128,"source_url":129},22989,"如何运行 TorchBench 基准测试？","请使用 `run_benchmark.py` 脚本代替已弃用的 `score.py`。命令示例：`python run_benchmark.py torch-nightly -c v3-cuda-tests.yaml`。如果运行出错，可能需要从配置文件（如 `userbenchmark\u002Ftorch-nightly\u002Fv3-cuda-tests.yaml`）中删除不兼容的模型（例如 `torchrec_dlrm`）。成功运行后，指标将保存在 `metrics-YYmmddHHMMSS.json` 文件中。","https:\u002F\u002Fgithub.com\u002Fpytorch\u002Fbenchmark\u002Fissues\u002F1707",{"id":131,"question_zh":132,"answer_zh":133,"source_url":134},22990,"运行某些模型时遇到 \"RuntimeError: Could not infer dtype of numpy.int64\" 或 \"Numpy is not available\" 错误怎么办？","这通常是由于 `pillow` 库版本不兼容导致的。尝试将 `pillow` 降级到 8.2.0 版本可解决此问题。执行命令：`pip install pillow==8.2.0`。该问题在 fastNLP_Bert、detectron2_maskrcnn、yolov3 等模型中较为常见。","https:\u002F\u002Fgithub.com\u002Fpytorch\u002Fbenchmark\u002Fissues\u002F1152",{"id":136,"question_zh":137,"answer_zh":138,"source_url":139},22991,"CI 在 A100 GPU 上出现段错误 (Segfault) 或 CUDA 错误如何解决？","如果在同时安装了 CUDA 11.8\u002FCUDNN 8.7 和 `nvidia-*-cu12` 包的环境中遇到段错误，可以通过不安装 TensorRT 库来规避此问题。复现步骤涉及混合使用不同版本的 CUDA 驱动和库，临时解决方案是调整环境依赖，避免冲突。","https:\u002F\u002Fgithub.com\u002Fpytorch\u002Fbenchmark\u002Fissues\u002F2081",{"id":141,"question_zh":142,"answer_zh":143,"source_url":144},22992,"TorchBench CI 报告的性能回归 (Performance Signal) 一定是真实的吗？","不一定。许多性能信号被标记为误报 (false-positive)，特别是当波动源于测试不稳定 (flaky test) 或非核心算子（如 LayerNorm 在小模型中占比极小）时。维护者通常会调查具体 Commit，如果确认为预期行为（如 AMP 中的上采样操作）或测试噪声，会关闭该问题并在发布说明中标记破坏性变更。","https:\u002F\u002Fgithub.com\u002Fpytorch\u002Fbenchmark\u002Fissues\u002F1099",{"id":146,"question_zh":147,"answer_zh":148,"source_url":149},22993,"如何验证某个 PyTorch PR 是否修复了特定的性能回归问题？","通常在相关的 Issue 评论中会有开发者确认修复状态。例如，对于 `pytorch_stargan` 的 CPU 延迟回归，在对应的 PR (如 #120767) 合并后，维护者会重新运行测试并确认指标已恢复正常（如延迟降低到预期值），随后关闭 Issue。用户可以关注 Issue 中的最新评论以获取验证结果。","https:\u002F\u002Fgithub.com\u002Fpytorch\u002Fbenchmark\u002Fissues\u002F2076",{"id":151,"question_zh":152,"answer_zh":153,"source_url":154},22994,"为什么某些性能回归问题被关闭且标记为 \"预期结果\"？","部分性能变化是由于底层算法或数值精度的预期调整引起的。例如，在 AMP (自动混合精度) 模式下对 float32 张量进行上采样操作可能会导致确定性模式下的性能差异。如果维护者确认这是框架设计的预期行为而非 Bug，会将此类性能信号标记为预期结果并关闭问题。","https:\u002F\u002Fgithub.com\u002Fpytorch\u002Fbenchmark\u002Fissues\u002F2247",[]]