[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-astooke--rlpyt":3,"tool-astooke--rlpyt":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":73,"owner_company":73,"owner_location":75,"owner_email":73,"owner_twitter":73,"owner_website":73,"owner_url":76,"languages":77,"stars":82,"forks":83,"last_commit_at":84,"license":85,"difficulty_score":10,"env_os":86,"env_gpu":87,"env_ram":88,"env_deps":89,"category_tags":97,"github_topics":73,"view_count":32,"oss_zip_url":73,"oss_zip_packed_at":73,"status":17,"created_at":98,"updated_at":99,"faqs":100,"releases":129},4384,"astooke\u002Frlpyt","rlpyt","Reinforcement Learning in PyTorch","rlpyt 是一个基于 PyTorch 构建的模块化深度强化学习开源库，旨在为中小规模研究提供高效、统一的代码基础。它涵盖了策略梯度（如 PPO、A2C）、深度 Q 学习（如 DQN 及其变体）以及基于 Q 函数的策略梯度（如 SAC、TD3）三大类主流无模型算法，并全面支持循环神经网络代理。\n\n针对强化学习研究中实验复现难、并行训练配置复杂等痛点，rlpyt 提供了灵活的运行模式：既支持便于调试的串行执行，也能利用多 GPU 和并行采样进行大规模分布式训练。其独特的技术亮点包括引入 `namedarraytuple` 数据结构以简化张量管理，原生支持异步\u002F同步采样与优化，以及针对 Atari 等环境的帧缓冲内存优化机制。此外，它还内置了实用的实验队列管理工具，帮助用户在本地硬件上高效并发运行数十个实验任务。\n\nrlpyt 特别适合具备一定编程基础的 AI 研究人员和开发者使用，尤其是那些希望快速验证新算法想法、复现经典论文或进行系统性超参数搜索的团队。对于刚入门深度强化学习的初学者，建议先通过其他教程熟悉基础概念，再借助 rlpyt 进行进阶探索。","\u003Cimg align=\"right\" width=\"205\" height=\"109\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fastooke_rlpyt_readme_01c70fe9670d.png\">\n\n# rlpyt\n[![tests](https:\u002F\u002Fgithub.com\u002Fastooke\u002Frlpyt\u002Fworkflows\u002Ftests\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Fastooke\u002Frlpyt\u002Factions)\n[![codecov](https:\u002F\u002Fcodecov.io\u002Fgh\u002Fastooke\u002Frlpyt\u002Fgraph\u002Fbadge.svg)](https:\u002F\u002Fcodecov.io\u002Fgh\u002Fastooke\u002Frlpyt)\n[![Docs](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fastooke_rlpyt_readme_13d664e1afd7.png)](https:\u002F\u002Frlpyt.readthedocs.io\u002Fen\u002Flatest\u002F)\n[![GitHub license](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Flicense\u002Fastooke\u002Frlpyt)](https:\u002F\u002Fgithub.com\u002Fastooke\u002Frlpyt\u002Fblob\u002Fmaster\u002FLICENSE)\n[![GitHub issues](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fissues\u002Fastooke\u002Frlpyt)](https:\u002F\u002Fgithub.com\u002Fastooke\u002Frlpyt\u002Fissues)\n[![GitHub stars](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Fastooke\u002Frlpyt)](https:\u002F\u002Fgithub.com\u002Fastooke\u002Frlpyt\u002Fstargazers)\n\n## Deep Reinforcement Learning in PyTorch\n\n*NEW: extended documentation available at [https:\u002F\u002Frlpyt.readthedocs.io](https:\u002F\u002Frlpyt.readthedocs.io)  (as of 27 Jan 2020)*\n\n*View the [Change Log](CHANGELOG.md)*\n\n\nModular, optimized implementations of common deep RL algorithms in PyTorch, with unified infrastructure supporting all three major families of model-free algorithms: policy gradient, deep-q learning, and q-function policy gradient.  Intended to be a high-throughput code-base for small- to medium-scale research (large-scale meaning like OpenAI Dota with 100's GPUs).  Key capabilities\u002Ffeatures include:\n\n* Run experiments in serial mode (helpful for debugging during development, or maybe sufficient for experiments).\n* Run experiments fully parallelized, with options for parallel sampling and\u002For multi-GPU optimization.\n  * Multi-GPU optimization uses PyTorch's DistributedDataParallel, which supports gradient reduction concurrent with backprop.\n* Use CPU or GPU for training and\u002For batched action selection during environment sampling.\n* Sampling and optimization synchronous or asynchronous (via replay buffer).\n* Full support for recurrent agents.\n  * All agents receive `observation, prev_action, prev_reward`.\n  * Training data always organized with leading indexes as `[Time, Batch]`.\n* Online or offline evaluation of agent diagnostics during training.\n* Launching utilities for stacking\u002Fqueueing sets of experiments in parallel on given **local** hardware resources (e.g. run 40 experiments on an 8-GPU machine with 1 experiment per GPU at a time).\n* Compatible with the OpenAI Gym environment interface.\u003Csup>1\u003C\u002Fsup>\n* Modularity for easy modification \u002F re-use of existing components.\n\n### Implemented Algorithms\n**Policy Gradient** A2C, PPO.\n\n**Replay Buffers** (supporting both DQN + QPG) non-sequence and sequence (for recurrent) replay, n-step returns, uniform or prioritized replay, full-observation or frame-based buffer (e.g. for Atari, stores only unique frames to save memory, reconstructs multi-frame observations).\n\n**Deep Q-Learning** DQN + variants: Double, Dueling, Categorical (up to Rainbow minus Noisy Nets), Recurrent (R2D2-style).  *Coming soon*: Implicit Quantile Networks?\n\n**Q-Function Policy Gradient** DDPG, TD3, SAC.  *Coming soon*: Distributional DDPG?\n\n\n### Getting Started\nFollow the installation instructions below, and then get started in the examples folder.  Example scripts are ordered by increasing complexity.\n\nFor newcomers to deep RL, it may be better to get familiar with the algorithms using a different resource, such as the excellent OpenAI Spinning Up: [docs](https:\u002F\u002Fspinningup.openai.com\u002Fen\u002Flatest\u002F), [code](https:\u002F\u002Fgithub.com\u002Fopenai\u002Fspinningup).\n\n### New data structure: `namedarraytuple`\nRlpyt introduces new object classes `namedarraytuple` for easier organization of collections of numpy arrays \u002F torch tensors. (see `rlpyt\u002Futils\u002Fcollections.py`).  A `namedarraytuple` is essentially a `namedtuple` which exposes indexed or sliced read\u002Fwrites into the structure.  For example, consider writing into a (possibly nested) dictionary of arrays:\n```python\nfor k, v in src.items():\n  if isinstance(dest[k], dict):\n    ..recurse..\n  dest[k][slice_or_indexes] = v\n ```\n This code is replaced by the following:\n ```python\n dest[slice_or_indexes] = src\n ```\n Importantly, this syntax looks the same whether `dest` and `src` are indiviual numpy arrays or arbitrarily-structured collections of arrays (the structures of `dest` and `src` must match, or `src` can be a single value, or `None` is an empty placeholder).  Rlpyt uses this data structure extensively--different elements of training data are organized with the same leading dimensions, making it easy to interact with desired time- or batch-dimensions.\n\nThis is also intended to support environments with multi-modal observations or actions.  For example, rather than flattening joint-angle and camera-image observations into one observation vector, the environment can store them as-is into a `namedarraytuple` for the observation, and in the forward method of the model, `observation.joint` and `observation.image` can be fed into the desired layers.  Intermediate infrastructure code doesn’t change.\n\n## Future Developments.\n\nOverall the code is stable, but might still develop, changes may occur.  Open to suggestions\u002Fcontributions for other established algorithms to add or other developments to support more use cases--please see our simple [contribution guidelines](CONTRIBUTING.md).\n\n\n\n## Visualization\n\nThis package does not include its own visualization, as the logged data is compatible with previous editions (see below). For more features, use [https:\u002F\u002Fgithub.com\u002Fvitchyr\u002Fviskit](https:\u002F\u002Fgithub.com\u002Fvitchyr\u002Fviskit).\n\n\n## Installation\n\n1.  Clone this repository to the local machine.\n\n2. Install the anaconda environment appropriate for the machine.\n```\nconda env create -f linux_[cpu|cuda9|cuda10].yml\nsource activate rlpyt\n```\n\n3. Either A) Edit the PYTHONPATH to include the rlpyt directory, or\n          B) Install as editable python package\n```\n#A\nexport PYTHONPATH=path_to_rlpyt:$PYTHONPATH\n\n#B\npip install -e .\n```\n\n4. Install any packages \u002F files pertaining to desired environments (e.g. gym, mujoco).  Atari is included.\n\nHint: for easy access, add the following to your `~\u002F.bashrc` (might substitute `conda` for `source`).\n```\nalias rlpyt=\"source activate rlpyt; cd path_to_rlpyt\"\n```\n\n## Extended Notes\n\nFor more discussion, please see the [white paper on Arxiv](https:\u002F\u002Farxiv.org\u002Fabs\u002F1909.01500).  If you use this repository in your work or otherwise wish to cite it, please make reference to the white paper.\n\n\n\n### Code Organization\n\nThe class types perform the following roles:\n\n* **Runner** - Connects the `sampler`, `agent`, and `algorithm`; manages the training loop and logging of diagnostics.\n  * **Sampler** - Manages `agent` \u002F `environment` interaction to collect training data, can initialize parallel workers.\n    * **Collector** - Steps `environments` (and maybe operates `agent`) and records samples, attached to `sampler`.\n      * **Environment** - The task to be learned.\n        * **Observation Space\u002FAction Space** - Interface specifications from `environment` to `agent`.\n      * **TrajectoryInfo** - Diagnostics logged on a per-trajectory basis.\n  * **Agent** - Chooses control action to the `environment` in `sampler`; trained by the `algorithm`.  Interface to `model`.\n    * **Model** - Torch neural network module, attached to the `agent`.\n    * **Distribution** - Samples actions for stochastic `agents` and defines related formulas for use in loss function, attached to the `agent`.\n  * **Algorithm** - Uses gathered samples to train the `agent` (e.g. defines a loss function and performs gradient descent).\n    * **Optimizer** - Training update rule (e.g. Adam), attached to the `algorithm`.\n    * **OptimizationInfo** - Diagnostics logged on a per-training batch basis.\n\n### Historical, Scaling, Interfaces\n\nThis code is a revision and extension of [accel_rl](https:\u002F\u002Fgithub.com\u002Fastooke\u002Faccel_rl), which explored scaling RL in the Atari domain using Theano.  Scaling results were recorded here: [A. Stooke & P. Abbeel, \"Accelerated Methods for Deep Reinforcement Learning\"](https:\u002F\u002Farxiv.org\u002Fabs\u002F1803.02811).  For an insightful study of batch-size scaling across deep learning including RL, see [S. McCandlish, et. al \"An Empirical Model of Large-Batch Training\"](https:\u002F\u002Farxiv.org\u002Fabs\u002F1812.06162).\n\nAccel_rl was inspired by [rllab](https:\u002F\u002Fgithub.com\u002Frll\u002Frllab) (the `logger` here is nearly a direct copy).  Rlpyt follows the rllab interfaces: agents output `action, agent_info`, environments output `observation, reward, done, env_info`.  In general in rlpyt, agent inputs\u002Foutputs are torch tensors, and environment inputs\u002Fouputs are numpy arrays, with conversions handled automatically.\n\n1.  Regarding OpenAI Gym compatibility, rlpyt uses a `namedtuple` for `env_info` rather than a `dict`.  This makes for easier data recording but does require the same fields to be output at every environment step.  An environment wrapper is provided.  Wrappers are also provided for Gym spaces to convert to rlpyt spaces (notably `Dict` to `composite`).\n\n### Acknowledgements\nThanks for support \u002F mentoring from Pieter Abbeel, the Fannie & John Hertz Foundation, NVIDIA, Max Jaderberg, OpenAI, and the BAIR community.  And thanks in advance to any contributors!\n\nHappy reinforcement learning!\n","\u003Cimg align=\"right\" width=\"205\" height=\"109\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fastooke_rlpyt_readme_01c70fe9670d.png\">\n\n# rlpyt\n[![tests](https:\u002F\u002Fgithub.com\u002Fastooke\u002Frlpyt\u002Fworkflows\u002Ftests\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Fastooke\u002Frlpyt\u002Factions)\n[![codecov](https:\u002F\u002Fcodecov.io\u002Fgh\u002Fastooke\u002Frlpyt\u002Fgraph\u002Fbadge.svg)](https:\u002F\u002Fcodecov.io\u002Fgh\u002Fastooke\u002Frlpyt)\n[![Docs](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fastooke_rlpyt_readme_13d664e1afd7.png)](https:\u002F\u002Frlpyt.readthedocs.io\u002Fen\u002Flatest\u002F)\n[![GitHub license](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Flicense\u002Fastooke\u002Frlpyt)](https:\u002F\u002Fgithub.com\u002Fastooke\u002Frlpyt\u002Fblob\u002Fmaster\u002FLICENSE)\n[![GitHub issues](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fissues\u002Fastooke\u002Frlpyt)](https:\u002F\u002Fgithub.com\u002Fastooke\u002Frlpyt\u002Fissues)\n[![GitHub stars](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Fastooke\u002Frlpyt)](https:\u002F\u002Fgithub.com\u002Fastooke\u002Frlpyt\u002Fstargazers)\n\n## PyTorch中的深度强化学习\n\n*新增：扩展文档已在[https:\u002F\u002Frlpyt.readthedocs.io](https:\u002F\u002Frlpyt.readthedocs.io)上线（截至2020年1月27日）*\n\n*查看[变更日志](CHANGELOG.md)*\n\n\n在PyTorch中对常见深度强化学习算法的模块化、优化实现，提供统一的基础架构，支持无模型强化学习的三大主要类别：策略梯度、深度Q学习和Q函数策略梯度。旨在为中小规模研究提供高吞吐量的代码库（大规模指类似OpenAI Dota那样使用数百块GPU的场景）。关键功能包括：\n\n* 以串行模式运行实验（有助于开发过程中的调试，或对于某些实验来说已足够）。\n* 完全并行化运行实验，支持并行采样和\u002F或多GPU优化。\n  * 多GPU优化采用PyTorch的DistributedDataParallel，可在反向传播的同时进行梯度归约。\n* 训练和\u002F或环境采样期间的批量动作选择可使用CPU或GPU。\n* 采样与优化可以同步或异步（通过回放缓冲区）。\n*  volle Unterstützung für rekurrente Agenten.\n  * Alle Agenten erhalten `observation, prev_action, prev_reward`.\n  * Trainingsdaten werden immer mit führenden Indizes als `[Time, Batch]` organisiert.\n* Online- oder Offline-Bewertung von Agentendiagnosen während des Trainings.\n* Startprogramme zum Stapeln\u002FWarteschlangen von Experimenten auf gegebenen **lokalen** Hardware-Ressourcen (z.B. 40 Experimente auf einem 8-GPU-Rechner, jeweils ein Experiment pro GPU).\n* Kompatibel mit der OpenAI Gym-Umgebungsschnittstelle.\u003Csup>1\u003C\u002Fsup>\n* Modularität für einfache Modifikation \u002F Wiederverwendung bestehender Komponenten.\n\n### Implementierte Algorithmen\n**Policy Gradient** A2C, PPO.\n\n**Replay Buffers** (unterstützt sowohl DQN + QPG) nicht-sequentiell und sequentiell (für rekurrente), n-Schritt-Renditen, uniforme oder priorisierte Wiederholungen, vollständige Beobachtung oder framebasierte Puffer (z.B. für Atari speichert nur einzigartige Frames, um Speicher zu sparen, rekonstruiert mehrere Frames).\n\n**Deep Q-Learning** DQN + Varianten: Double, Dueling, Categorical (bis Rainbow ohne Noisy Nets), Recurrent (R2D2-Stil). *Demnächst*: Implicit Quantile Networks?\n\n**Q-Function Policy Gradient** DDPG, TD3, SAC. *Demnächst*: Distributional DDPG?\n\n\n### Erste Schritte\nBefolgen Sie die unten stehenden Installationsanweisungen und beginnen Sie dann im Beispielordner. Die Beispiel-Skripte sind nach steigendem Schwierigkeitsgrad geordnet.\n\nFür Neueinsteiger in Deep RL kann es sinnvoll sein, sich zunächst anhand anderer Ressourcen mit den Algorithmen vertraut zu machen, beispielsweise dem hervorragenden OpenAI Spinning Up: [Dokumentation](https:\u002F\u002Fspinningup.openai.com\u002Fen\u002Flatest\u002F), [Code](https:\u002F\u002Fgithub.com\u002Fopenai\u002Fspinningup).\n\n### Neue Datenstruktur: `namedarraytuple`\nRlpyt führt neue Objektklassen `namedarraytuple` ein, um Sammlungen von NumPy-Arrays \u002F Torch-Tensoren leichter zu organisieren. (siehe `rlpyt\u002Futils\u002Fcollections.py`). Ein `namedarraytuple` ist im Wesentlichen ein `namedtuple`, das indizierten oder geschnittenen Lese-\u002FSchreibzugriff auf die Struktur ermöglicht. Betrachten wir beispielsweise das Schreiben in ein (ggf. verschachteltes) Wörterbuch mit Arrays:\n```python\nfor k, v in src.items():\n  if isinstance(dest[k], dict):\n    ..rekursiv..\n  dest[k][slice_or_indexes] = v\n ```\n Dieser Code wird durch Folgendes ersetzt:\n ```python\n dest[slice_or_indexes] = src\n ```\n Wichtig ist, dass diese Syntax gleich aussieht, ob `dest` und `src` einzelne NumPy-Arrays oder beliebig strukturierte Sammlungen von Arrays sind (die Strukturen von `dest` und `src` müssen übereinstimmen, oder `src` kann ein einzelner Wert sein, oder `None` dient als leeres Platzhalter). Rlpyt verwendet diese Datenstruktur intensiv – verschiedene Teile der Trainingsdaten werden mit denselben führenden Dimensionen organisiert, wodurch der Zugriff auf gewünschte Zeit- oder Batch-Dimensionen erleichtert wird.\n\nDies soll auch Umgebungen mit multimodalen Beobachtungen oder Aktionen unterstützen. Statt beispielsweise Gelenkwinkel- und Kamerabildbeobachtungen in einen einzigen Beobachtungsvektor zu flachen, kann die Umgebung sie unverändert in einem `namedarraytuple` für die Beobachtung speichern, und im Forward-Verfahren des Modells können `observation.joint` und `observation.image` den entsprechenden Schichten zugeführt werden. Die darunterliegende Infrastruktur bleibt unverändert.\n\n## Zukünftige Entwicklungen.\n\nIm Großen und Ganzen ist der Code stabil, könnte sich jedoch noch weiterentwickeln; Änderungen sind möglich. Wir freuen uns über Vorschläge und Beiträge zu weiteren etablierten Algorithmen oder anderen Entwicklungen, die mehr Anwendungsfälle unterstützen – bitte beachten Sie unsere einfachen [Beitragsrichtlinien](CONTRIBUTING.md).\n\n\n\n## Visualisierung\n\nDieses Paket enthält keine eigene Visualisierung, da die protokollierten Daten mit früheren Versionen kompatibel sind (siehe unten). Für weitere Funktionen verwenden Sie [https:\u002F\u002Fgithub.com\u002Fvitchyr\u002Fviskit](https:\u002F\u002Fgithub.com\u002Fvitchyr\u002Fviskit).\n\n\n## Installation\n\n1. Klonen Sie dieses Repository auf Ihren lokalen Rechner.\n\n2. Installieren Sie die für Ihren Rechner geeignete Anaconda-Umgebung.\n```\nconda env create -f linux_[cpu|cuda9|cuda10].yml\nsource activate rlpyt\n```\n\n3. Entweder A) Bearbeiten Sie den PYTHONPATH, um das rlpyt-Verzeichnis einzuschließen, oder\n          B) Installieren Sie es als editierbares Python-Paket\n```\n#A\nexport PYTHONPATH=path_to_rlpyt:$PYTHONPATH\n\n#B\npip install -e .\n```\n\n4. Installieren Sie alle Pakete bzw. Dateien, die für die gewünschten Umgebungen erforderlich sind (z. B. gym, mujoco). Atari ist bereits enthalten.\n\nHinweis: Für einen schnellen Zugriff fügen Sie Folgendes zu Ihrer `~\u002F.bashrc` hinzu (anstelle von `source` kann auch `conda` verwendet werden).\n```\nalias rlpyt=\"source activate rlpyt; cd path_to_rlpyt\"\n```\n\n## Erweiterte Hinweise\n\nWeitere Informationen finden Sie im [Whitepaper auf Arxiv](https:\u002F\u002Farxiv.org\u002Fabs\u002F1909.01500). Wenn Sie dieses Repository in Ihrer Arbeit verwenden oder es anderweitig zitieren möchten, verweisen Sie bitte auf das Whitepaper.\n\n### 代码组织\n\n类的类型分别承担以下职责：\n\n* **Runner** - 连接 `sampler`、`agent` 和 `algorithm`；管理训练循环及诊断信息的日志记录。\n  * **Sampler** - 管理 `agent` 与 `environment` 的交互以收集训练数据，可初始化并行工作进程。\n    * **Collector** - 步进 `environments`（并可能操作 `agent`），记录采样数据，隶属于 `sampler`。\n      * **Environment** - 待学习的任务。\n        * **观测空间\u002F动作空间** - `environment` 向 `agent` 提供的接口规范。\n      * **TrajectoryInfo** - 按轨迹级别记录的诊断信息。\n  * **Agent** - 在 `sampler` 中为 `environment` 选择控制动作；由 `algorithm` 进行训练。与 `model` 对接。\n    * **Model** - PyTorch 神经网络模块，隶属于 `agent`。\n    * **Distribution** - 为随机性 `agents` 采样动作，并定义用于损失函数的相关公式，隶属于 `agent`。\n  * **Algorithm** - 利用收集到的样本训练 `agent`（例如定义损失函数并执行梯度下降）。\n    * **Optimizer** - 训练更新规则（如 Adam），隶属于 `algorithm`。\n    * **OptimizationInfo** - 按训练批次级别记录的诊断信息。\n\n### 历史、扩展性、接口\n\n本代码是对 [accel_rl](https:\u002F\u002Fgithub.com\u002Fastooke\u002Faccel_rl) 的修订和扩展，该库曾使用 Theano 探索 Atari 环境下的强化学习扩展问题。相关扩展结果已发表于：[A. Stooke & P. Abbeel, “加速深度强化学习方法”](https:\u002F\u002Farxiv.org\u002Fabs\u002F1803.02811)。若需深入了解包括强化学习在内的深度学习中批量大小的扩展规律，可参阅 [S. McCandlish 等人“大规模批量训练的经验模型”](https:\u002F\u002Farxiv.org\u002Fabs\u002F1812.06162)。\n\nAccel_rl 受 [rllab](https:\u002F\u002Fgithub.com\u002Frll\u002Frllab) 的启发（此处的 `logger` 几乎是直接复制而来）。Rlpyt 沿用了 rllab 的接口规范：智能体输出 `action, agent_info`，环境输出 `observation, reward, done, env_info`。通常在 rlpyt 中，智能体的输入\u002F输出为 PyTorch 张量，而环境的输入\u002F输出为 NumPy 数组，两者之间的转换会自动完成。\n\n1. 关于 OpenAI Gym 的兼容性，rlpyt 使用 `namedtuple` 来表示 `env_info`，而非 `dict`。这种方式更便于数据记录，但也要求每个环境步都必须输出相同的字段。为此提供了环境包装器。此外，还提供了将 Gym 空间转换为 rlpyt 空间的包装器，尤其是将 `Dict` 空间转换为 `composite` 空间。\n\n### 致谢\n感谢 Pieter Abbeel、Fannie and John Hertz 基金会、NVIDIA、Max Jaderberg、OpenAI 以及 BAIR 社区的支持与指导。也提前感谢所有贡献者！\n\n祝大家强化学习愉快！","# rlpyt 快速上手指南\n\nrlpyt 是一个基于 PyTorch 的模块化、高性能深度强化学习（Deep RL）代码库。它支持策略梯度（如 PPO）、深度 Q 学习（如 DQN）以及基于 Q 函数的策略梯度（如 SAC）三大类算法，专为中小规模研究设计，支持多 GPU 并行训练和循环智能体。\n\n## 环境准备\n\n*   **操作系统**: Linux (推荐)\n*   **Python 版本**: 建议使用 Python 3.6+\n*   **核心依赖**:\n    *   PyTorch (需匹配 CUDA 版本)\n    *   Anaconda\u002FMiniconda (用于环境管理)\n    *   OpenAI Gym (用于环境接口)\n    *   MuJoCo \u002F Atari (可选，视具体实验需求而定)\n\n> **注意**：本项目主要面向 Linux 环境开发，Windows 用户可能需要额外配置或使用 WSL。\n\n## 安装步骤\n\n### 1. 克隆仓库\n将 rlpyt 源代码克隆到本地机器：\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fastooke\u002Frlpyt.git\ncd rlpyt\n```\n\n### 2. 创建 Conda 环境\n根据机器的硬件配置（CPU 或特定版本的 CUDA），创建相应的 conda 环境。项目提供了预定义的配置文件：\n\n*   **CPU 版本**:\n    ```bash\n    conda env create -f linux_cpu.yml\n    ```\n*   **CUDA 9 版本**:\n    ```bash\n    conda env create -f linux_cuda9.yml\n    ```\n*   **CUDA 10 版本**:\n    ```bash\n    conda env create -f linux_cuda10.yml\n    ```\n\n激活环境：\n```bash\nconda activate rlpyt\n```\n\n> **国内加速提示**：如果 `conda` 下载速度慢，建议先配置清华或中科大镜像源：\n> ```bash\n> conda config --add channels https:\u002F\u002Fmirrors.tuna.tsinghua.edu.cn\u002Fanaconda\u002Fpkgs\u002Fmain\u002F\n> conda config --add channels https:\u002F\u002Fmirrors.tuna.tsinghua.edu.cn\u002Fanaconda\u002Fpkgs\u002Ffree\u002F\n> conda config --set show_channel_urls yes\n> ```\n\n### 3. 安装 rlpyt 包\n有两种方式将 rlpyt 添加到 Python 路径中，任选其一即可：\n\n*   **方式 A：设置环境变量 (临时或写入 ~\u002F.bashrc)**\n    ```bash\n    export PYTHONPATH=\u002Fpath\u002Fto\u002Frlpyt:$PYTHONPATH\n    ```\n\n*   **方式 B：以可编辑模式安装 (推荐)**\n    ```bash\n    pip install -e .\n    ```\n\n### 4. 安装环境依赖\n安装你计划使用的具体强化学习环境包，例如 Gym 或 Atari：\n```bash\npip install gym[atari]\n# 如需使用 Mujoco，请自行安装 mujoco-py 并配置 license\n```\n\n## 基本使用\n\nrlpyt 的设计理念是高度模块化。最简单的入门方式是运行 `examples` 文件夹中的示例脚本，这些脚本按复杂度递增排列。\n\n### 运行示例脚本\n假设你已经完成了安装，可以尝试运行一个基础的 PPO 算法在 CartPole 环境上的示例（具体文件名请参考 `examples\u002F` 目录）：\n\n```bash\n# 进入示例目录\ncd examples\n\n# 运行一个简单的串行模式实验 (适合调试)\npython run_example_ppo_cartpole.py\n```\n\n### 代码结构简述\n在编写自己的实验时，你需要组合以下核心组件：\n\n1.  **Environment**: 定义任务（如 Gym 环境）。\n2.  **Agent & Model**: 定义智能体及其神经网络结构。\n3.  **Algorithm**: 定义学习算法（如 PPO, DQN），负责计算损失和更新权重。\n4.  **Sampler**: 负责与环境交互收集数据，支持并行采样。\n5.  **Runner**: 连接上述所有组件，管理训练循环和日志记录。\n\n### 简单代码逻辑示意\n以下是一个概念性的代码组织方式，展示如何启动训练：\n\n```python\nfrom rlpyt.runners.minibatch_rl import MinibatchRl\nfrom rlpyt.samplers.parallel.cpu.sampler import CpuSampler\nfrom rlpyt.algos.pg.ppo import PPO\nfrom rlpyt.agents.pg.gaussian import PgGaussianAgent\nfrom rlpyt.models.pg.mlp_policy import MlpPolicy\nfrom rlpyt.envs.gym import make as gym_make\n\ndef build_and_train():\n    # 1. 定义算法\n    algo = PPO(optim_kwargs=dict(lr=3e-4))\n    \n    # 2. 定义智能体 (包含模型)\n    agent = PgGaussianAgent(Model=MlpPolicy)\n    \n    # 3. 定义采样器\n    sampler = CpuSampler(\n        Env=gym_make(\"CartPole-v1\"),\n        batch_T=100,\n        batch_B=4,\n        max_decorrelation_steps=0,\n    )\n    \n    # 4. 定义 Runner 并运行\n    runner = MinibatchRl(\n        algo=algo,\n        agent=agent,\n        sampler=sampler,\n        n_steps=1e6,\n        log_interval_steps=1e5,\n    )\n    runner.train()\n\nif __name__ == \"__main__\":\n    build_and_train()\n```\n\n更多详细用法、参数配置及高级功能（如多 GPU 训练、循环智能体），请参阅官方扩展文档：[https:\u002F\u002Frlpyt.readthedocs.io](https:\u002F\u002Frlpyt.readthedocs.io)。","某机器人实验室的研究团队正致力于训练一个基于视觉输入的机械臂抓取策略，需要快速验证 PPO 和 SAC 等多种算法在复杂环境下的表现。\n\n### 没有 rlpyt 时\n- **并行实验效率低下**：团队需在单卡上串行调试代码，或利用脚本手动管理多 GPU 资源，难以同时启动数十个对比实验，导致超参数搜索周期长达数周。\n- **循环神经网络实现繁琐**：为了让机械臂理解动作序列，研究人员需从头编写复杂的 RNN 数据对齐逻辑，经常因时间步（Time）与批次（Batch）维度混乱而引入隐蔽 Bug。\n- **算法复用成本高**：每尝试一种新算法（如从 PPO 切换到 SAC），都要重写大量采样器和回放缓冲区代码，缺乏统一的模块化接口，开发重心被迫偏离核心算法创新。\n\n### 使用 rlpyt 后\n- **大规模并行加速**：利用 rlpyt 内置的本地实验队列工具，团队在 8 卡服务器上轻松并发运行 40 组实验，自动分配 GPU 资源，将超参数调优时间压缩至几天内。\n- **原生支持时序数据**：rlpyt 提供的 `namedarraytuple` 数据结构天然按 `[时间，批次]` 组织数据，并内置完整的循环智能体支持，让 RNN 策略的训练无需关心底层维度变换。\n- **模块化灵活切换**：依托其统一的无模型算法架构，研究人员仅需修改配置文件即可在策略梯度（PPO）和 Q 函数策略梯度（SAC）间无缝切换，复用已有的采样与环境接口。\n\nrlpyt 通过高度模块化的并行架构和统一的数据抽象，将研究人员从繁琐的工程实现中解放出来，显著提升了深度强化学习算法的迭代速度与实验规模。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fastooke_rlpyt_02eeb16a.png","astooke",null,"https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fastooke_28ecc9c4.jpg","Berkeley, CA","https:\u002F\u002Fgithub.com\u002Fastooke",[78],{"name":79,"color":80,"percentage":81},"Python","#3572A5",100,2273,328,"2026-03-21T03:00:38","MIT","Linux","可选（支持 CPU 或 GPU）。若使用 GPU，需 NVIDIA 显卡以支持 PyTorch DistributedDataParallel；README 中提供的安装脚本明确支持 CUDA 9 和 CUDA 10 版本。","未说明（取决于具体实验规模及 Atari 帧缓冲内存占用）",{"notes":90,"python":91,"dependencies":92},"1. 该项目主要针对 Linux 系统设计，安装脚本仅包含 linux_cpu\u002Fcuda9\u002Fcuda10 配置文件，未提及 macOS 或 Windows 支持。\n2. 必须使用 Conda 创建虚拟环境进行安装。\n3. 支持多 GPU 并行优化（基于 PyTorch DDP）及多进程采样。\n4. 兼容 OpenAI Gym 接口，内置 Atari 环境支持（可存储唯一帧以节省内存）。\n5. 引入了自定义数据结构 `namedarraytuple` 以优化嵌套数组\u002F张量的操作。","未说明（需通过 Anaconda 环境管理）",[93,94,95,96],"pytorch","numpy","gym","atari-py",[14],"2026-03-27T02:49:30.150509","2026-04-06T19:58:14.750115",[101,106,111,116,121,125],{"id":102,"question_zh":103,"answer_zh":104,"source_url":105},19930,"如何在 rlpyt 中支持多智能体（Multi-Agent）环境？","可以通过以下方式实现：\n1. **传递多智能体观测值**：如果所有智能体共用一个模型，将所有观测值打包成一个数组，视为单个“超级智能体”；如果有多个模型，建议使用 `torch.nn.ModuleList` 或 `torch.nn.ModuleDict` 组织模型，并并行应用函数。\n2. **传递多个奖励值**：Gym 环境的 step 返回必须是标量奖励。若需为每个智能体提供独立奖励，应将实际奖励数组放入 `info` 字典中，而返回的 `reward` 设为实际奖励的总和或平均值。代码示例：\n   ```python\n   actual_reward = self.reward()  # 获取实际奖励数组\n   reward = sum(actual_reward)    # 返回标量奖励\n   info = OrderedDict(reward=actual_reward)\n   return observation, reward, done, info\n   ```\n3. **修改算法部分**：需调整 `initialize_replay_buffer`、`samples_to_buffer` 等函数以处理样本与缓冲区之间的转换。","https:\u002F\u002Fgithub.com\u002Fastooke\u002Frlpyt\u002Fissues\u002F14",{"id":107,"question_zh":108,"answer_zh":109,"source_url":110},19931,"遇到 'No module named rlpyt.samplers.cpu' 错误如何解决？","该错误通常是因为导入路径过时。在较新版本中，采样器模块已移至 `parallel` 子目录下。请检查脚本中的导入语句，将旧路径：\n`from rlpyt.samplers.gpu.sampler import GpuSampler`\n替换为新路径：\n`from rlpyt.samplers.parallel.gpu.sampler import GpuSampler`\n同样适用于 `collectors` 等其他模块。维护者已修复部分脚本，但若使用自定义或旧的启动脚本，需手动更新导入路径。","https:\u002F\u002Fgithub.com\u002Fastooke\u002Frlpyt\u002Fissues\u002F15",{"id":112,"question_zh":113,"answer_zh":114,"source_url":115},19932,"在使用 multiprocessing 的 'spawn' 启动方法时，如何处理 namedtuple 导致的 pickle 错误？","由于 'spawn' 模式不保留全局变量，动态创建的 `namedtuple` 类型无法在子进程中找到。解决方案是使用 `NamedTupleSchema` 和 `NamedTuple` 类替代原生的 `namedtuple`，它们不会为每种组合创建新类型，从而避免 pickle 错误。此外，库已更新支持：\n1. 使用 `np_mp_array_spawn` 支持 spawn 模式的共享内存。\n2. 使用带有 `_schema` 后缀的新 Gym 环境和空间包装器。\n3. 数据缓冲区的序列化\u002F反序列化现在在 spawn 模式下也可正常工作。","https:\u002F\u002Fgithub.com\u002Fastooke\u002Frlpyt\u002Fissues\u002F99",{"id":117,"question_zh":118,"answer_zh":119,"source_url":120},19933,"如何正确保存和加载回放缓冲区（Replay Buffer）以恢复训练？","简单的 pickle 保存可能无法完全恢复状态，特别是对于使用回放缓冲区的算法。虽然 Issue 中展示了通过 `pickle.dump` 保存缓冲区的尝试，但官方建议需要更细致的处理以确保缓冲区状态（如索引、数据一致性）被正确恢复。目前推荐的做法是参考库中关于断点续训的更新或示例代码，确保在保存模型权重的同时，也序列化缓冲区的内部状态，并在加载时重新初始化缓冲区结构后再填入数据。具体实现需根据所使用的 Runner 和 Algo 类进行调整。","https:\u002F\u002Fgithub.com\u002Fastooke\u002Frlpyt\u002Fissues\u002F111",{"id":122,"question_zh":123,"answer_zh":124,"source_url":105},19934,"如何理解 progress.csv 中的 'grad_norm' 以及如何设置 clip_grad_norm？","`grad_norm` 记录了梯度范数，用于监控训练过程中梯度的大小，帮助判断是否出现梯度爆炸或不稳定。如果数值过大，可能需要梯度裁剪。关于 `self.clip_grad_norm` 的设置：\n1. 没有固定的最佳值，通常需要根据具体任务和模型架构进行实验。\n2. 常见做法是观察 `progress.csv` 中的 `grad_norm` 趋势，如果出现异常峰值，可尝试设置一个合理的上限（如 0.5, 1.0 或 10.0）。\n3. 在算法代码中设置 `self.clip_grad_norm = 1.0`（示例值），系统会在反向传播时自动裁剪超过该值的梯度。",{"id":126,"question_zh":127,"answer_zh":128,"source_url":105},19935,"如何在训练初期避免过早进行评估（Evaluation），特别是在经验回放较大时？","默认情况下，如果在开始学习前就运行评估，可能会导致日志记录不及时。虽然可以将 `log_interval_steps` 设置为大于等于 `min_steps_learn`，但这在大型经验回放场景下会导致日志过少（例如仅在训练结束时记录一次）。更好的解决方案是修改 Runner（如 `MiniBatchRl`）的逻辑，使其在决定是否运行评估和记录日志时检查 `min_steps_learn` 属性。可以通过自定义 Runner 或在现有 Runner 中添加判断逻辑：`if steps >= getattr(self.algo, \"min_steps_learn\", 0): run_evaluation()`，从而实现更灵活的监控。",[]]