[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-inoryy--reaver":3,"tool-inoryy--reaver":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":66,"readme_en":67,"readme_zh":68,"quickstart_zh":69,"use_case_zh":70,"hero_image_url":71,"owner_login":72,"owner_name":73,"owner_avatar_url":74,"owner_bio":75,"owner_company":76,"owner_location":77,"owner_email":78,"owner_twitter":77,"owner_website":79,"owner_url":80,"languages":81,"stars":86,"forks":87,"last_commit_at":88,"license":89,"difficulty_score":90,"env_os":91,"env_gpu":92,"env_ram":93,"env_deps":94,"category_tags":104,"github_topics":105,"view_count":32,"oss_zip_url":77,"oss_zip_packed_at":77,"status":17,"created_at":116,"updated_at":117,"faqs":118,"releases":148},5172,"inoryy\u002Freaver","reaver","Reaver: Modular Deep Reinforcement Learning Framework. Focused on StarCraft II. Supports Gym, Atari, and MuJoCo.","Reaver 是一个模块化的深度强化学习框架，最初专为《星际争霸 II》的高难度策略任务设计，同时也全面支持 Atari 游戏和 MuJoCo 物理仿真等经典环境。它旨在解决复杂游戏中智能体训练的挑战，让 AI 能够像人类玩家一样，基于视觉观察和有限的操作选项来学习决策，从而复现并验证前沿的强化学习算法（如 PPO）。\n\nReaver 的核心优势在于其高度解耦的架构设计。它将智能体、模型和环境分离开来，用户可以根据需要灵活替换各个组件。这种设计既照顾了初学者，也满足了资深专家的需求：编程爱好者只需调整少量超参数即可快速上手训练 AI；而研究人员则能利用其性能优化的代码库，轻松进行自定义算法的实验与验证。\n\n需要注意的是，该项目目前已停止维护，不再提供新的功能开发或技术支持。尽管如此，Reaver 依然适合那些希望研究《星际争霸 II》AI 策略、复现经典强化学习论文结果，或需要模块化框架进行教学演示的开发者与科研人员使用。对于想要深入理解深度强化学习在复杂即时战略游戏中应用的用户来说，Reaver 仍是一份极具参考价值的开源资源。","# Reaver: Modular Deep Reinforcement Learning Framework\n\n[![MoveToBeacon](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Finoryy_reaver_readme_beeff61e4bc9.gif)](https:\u002F\u002Fyoutu.be\u002FgEyBzcPU5-w)\n[![CollectMineralShards](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Finoryy_reaver_readme_4403565a409a.gif)](https:\u002F\u002Fyoutu.be\u002FgEyBzcPU5-w)\n[![DefeatRoaches](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Finoryy_reaver_readme_f32d97f5c77b.gif)](https:\u002F\u002Fyoutu.be\u002FgEyBzcPU5-w)\n[![DefeatZerglingsAndBanelings](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Finoryy_reaver_readme_092fa7a20cdf.gif)](https:\u002F\u002Fyoutu.be\u002FgEyBzcPU5-w)\n[![FindAndDefeatZerglings](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Finoryy_reaver_readme_4cf66aade41e.gif)](https:\u002F\u002Fyoutu.be\u002FgEyBzcPU5-w)\n[![BuildMarines](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Finoryy_reaver_readme_ca8836b0cb80.gif)](https:\u002F\u002Fyoutu.be\u002FgEyBzcPU5-w)\n\n[![MoveToBeacon](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Finoryy_reaver_readme_f1284293728d.gif)](https:\u002F\u002Fyoutu.be\u002FgEyBzcPU5-w)\n[![CollectMineralShards](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Finoryy_reaver_readme_f2be2942f8af.gif)](https:\u002F\u002Fyoutu.be\u002FgEyBzcPU5-w)\n[![DefeatRoaches](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Finoryy_reaver_readme_fe00f37d0576.gif)](https:\u002F\u002Fyoutu.be\u002FgEyBzcPU5-w)\n[![DefeatZerglingsAndBanelings](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Finoryy_reaver_readme_9506c24e807c.gif)](https:\u002F\u002Fyoutu.be\u002FgEyBzcPU5-w)\n[![FindAndDefeatZerglings](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Finoryy_reaver_readme_1af64c46f4f8.gif)](https:\u002F\u002Fyoutu.be\u002FgEyBzcPU5-w)\n[![BuildMarines](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Finoryy_reaver_readme_ad340d64830e.gif)](https:\u002F\u002Fyoutu.be\u002FgEyBzcPU5-w)\n\n**Project status:** No longer maintained!  \nUnfortunately, I am no longer able to further develop or provide support to the project.\n\n## Introduction\n\nReaver is a modular deep reinforcement learning framework with a focus on various StarCraft II based tasks, following in DeepMind's footsteps \nwho are pushing state-of-the-art of the field through the lens of playing a modern video game with human-like interface and limitations. \nThis includes observing visual features similar (though not identical) to what a human player would perceive and choosing actions from similar pool of options a human player would have.\nSee [StarCraft II: A New Challenge for Reinforcement Learning](https:\u002F\u002Farxiv.org\u002Fabs\u002F1708.04782) article for more details.\n\nThough development is research-driven, the philosophy behind Reaver API is akin to StarCraft II game itself - \nit has something to offer both for novices and experts in the field. For hobbyist programmers Reaver offers all the tools\nnecessary to train DRL agents by modifying only a small and isolated part of the agent (e.g. hyperparameters).\nFor veteran researchers Reaver offers simple, but performance-optimized codebase with modular architecture: \nagent, model, and environment are decoupled and can be swapped at will.\n\nWhile the focus of Reaver is on StarCraft II, it also has full support for other popular environments, notably Atari and MuJoCo. \nReaver agent algorithms are validated against reference results, e.g. PPO agent is able to match [\nProximal Policy Optimization Algorithms](https:\u002F\u002Farxiv.org\u002Fabs\u002F1707.06347). Please see [below](#but-wait-theres-more) for more details.\n\n## Installation\n\n### PIP Package\n\nEasiest way to install Reaver is through the `PIP` package manager:\n \n    pip install reaver\n\nYou can also install additional extras (e.g. `gym` support) through the helper flags:\n\n    pip install reaver[gym,atari,mujoco]\n\n### Manual Installation\n\nIf you plan to modify `Reaver` codebase you can retain its module functionality by installing from source:\n\n```\n$ git clone https:\u002F\u002Fgithub.com\u002Finoryy\u002Freaver-pysc2\n$ pip install -e reaver-pysc2\u002F\n```\n\nBy installing with `-e` flag `Python` will now look for `reaver` in the specified folder, rather than `site-packages` storage.\n\n### Windows\n\nPlease see the [wiki](https:\u002F\u002Fgithub.com\u002Finoryy\u002Freaver-pysc2\u002Fwiki\u002FWindows) page for detailed instructions on setting up Reaver on Windows.\n\nHowever, if possible please consider using `Linux OS` instead - due to performance and stability considerations.\nIf you would like to see your agent perform with full graphics enabled you can save a replay of the agent on Linux and open it on Windows.\nThis is how the video recording listed below was made.\n\n### Requirements\n\n* PySC2 >= 3.0.0\n* StarCraft II >= 4.1.2 ([instructions](https:\u002F\u002Fgithub.com\u002FBlizzard\u002Fs2client-proto#downloads))\n* gin-config >= 0.3.0\n* TensorFlow >= 2.0.0\n* TensorFlow Probability >= 0.9\n\n#### Optional Extras\nIf you would like to use Reaver with other supported environments, you must install relevant packages as well:\n\n* gym >= 0.10.0\n* atari-py >= 0.1.5\n* mujoco-py >= 1.50.0\n  * roboschool >= 1.0 (alternative)\n\n\n## Quick Start\n\nYou can train a DRL agent with multiple StarCraft II environments running in parallel with just four lines of code!\n\n```python\nimport reaver as rvr\n\nenv = rvr.envs.SC2Env(map_name='MoveToBeacon')\nagent = rvr.agents.A2C(env.obs_spec(), env.act_spec(), rvr.models.build_fully_conv, rvr.models.SC2MultiPolicy, n_envs=4)\nagent.run(env)\n```\n\nMoreover, Reaver comes with highly configurable commandline tools, so this task can be reduced to a short one-liner!\n\n```bash\npython -m reaver.run --env MoveToBeacon --agent a2c --n_envs 4 2> stderr.log\n```\n\nWith the line above Reaver will initialize the training procedure with a set of pre-defined hyperparameters, optimized\nspecifically for the given environment and agent. After awhile you will start seeing logs with various useful statistics\nin your terminal screen.\n\n    | T    118 | Fr     51200 | Ep    212 | Up    100 | RMe    0.14 | RSd    0.49 | RMa    3.00 | RMi    0.00 | Pl    0.017 | Vl    0.008 | El 0.0225 | Gr    3.493 | Fps   433 |\n    | T    238 | Fr    102400 | Ep    424 | Up    200 | RMe    0.92 | RSd    0.97 | RMa    4.00 | RMi    0.00 | Pl   -0.196 | Vl    0.012 | El 0.0249 | Gr    1.791 | Fps   430 |\n    | T    359 | Fr    153600 | Ep    640 | Up    300 | RMe    1.80 | RSd    1.30 | RMa    6.00 | RMi    0.00 | Pl   -0.035 | Vl    0.041 | El 0.0253 | Gr    1.832 | Fps   427 |\n    ...\n    | T   1578 | Fr    665600 | Ep   2772 | Up   1300 | RMe   24.26 | RSd    3.19 | RMa   29.00 | RMi    0.00 | Pl    0.050 | Vl    1.242 | El 0.0174 | Gr    4.814 | Fps   421 |\n    | T   1695 | Fr    716800 | Ep   2984 | Up   1400 | RMe   24.31 | RSd    2.55 | RMa   30.00 | RMi   16.00 | Pl    0.005 | Vl    0.202 | El 0.0178 | Gr   56.385 | Fps   422 |\n    | T   1812 | Fr    768000 | Ep   3200 | Up   1500 | RMe   24.97 | RSd    1.89 | RMa   31.00 | RMi   21.00 | Pl   -0.075 | Vl    1.385 | El 0.0176 | Gr   17.619 | Fps   423 |\n\n\nReaver should quickly converge to about 25-26 `RMe` (mean episode rewards), which matches DeepMind results for this environment.\nSpecific training time depends on your hardware. Logs above are produced on a laptop with Intel i5-7300HQ CPU (4 cores)\nand GTX 1050 GPU, the training took around 30 minutes.\n\nAfter Reaver has finished training, you can look at how it performs by appending `--test` and `--render` flags to the one-liner.\n\n```bash\npython -m reaver.run --env MoveToBeacon --agent a2c --test --render 2> stderr.log\n```\n\n### Google Colab\n\nA companion [Google Colab notebook](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1DvyCUdymqgjk85FB5DrTtAwTFbI494x7) \nnotebook is available to try out Reaver online.\n\n## Key Features\n\n### Performance\n\nMany modern DRL algorithms rely on being executed in multiple environments at the same time in parallel. \nAs Python has [GIL](https:\u002F\u002Fwiki.python.org\u002Fmoin\u002FGlobalInterpreterLock), this feature must be implemented through multiprocessing. \nMajority of open source implementations solve this task with message-based approach (e.g. Python `multiprocessing.Pipe` or `MPI`),\nwhere individual processes communicate by sending data through [IPC](https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FInter-process_communication).\nThis is a valid and most likely only reasonable approach for large-scale distributed approaches that companies like DeepMind and openAI operate on. \n\nHowever, for a typical researcher or hobbyist a much more common scenario is having access only to a \nsingle machine environment, whether it is a laptop or a node on a HPC cluster. Reaver is optimized specifically \nfor this case by making use of shared memory in a lock-free manner. This approach nets significant performance\nboost of up to **1.5x speed-up** in StarCraft II sampling rate (and up to 100x speedup in general case),\nbeing bottle-necked almost exclusively by GPU input\u002Foutput pipeline.\n\n### Extensibility\n\nThe three core Reaver modules - `envs`, `models`, and `agents` are almost completely detached from each other.\nThis ensures that extending functionality in one module is seamlessly integrated into the others.\n\n### Configurability\n\nAll configuration is handled through [gin-config](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgin-config) and can be easily shared as `.gin` files. \nThis includes all hyperparameters, environment arguments, and model definitions.\n\n### Implemented Agents\n\n* Advantage Actor-Critic (A2C)\n* Proximal Policy Optimization (PPO)\n\n#### Additional RL Features\n\n* Generalized Advantage Estimation (GAE)\n* Rewards clipping\n* Gradient norm clipping\n* Advantage normalization\n* Baseline (critic) bootstrapping\n* Separate baseline network\n\n### But Wait! There's more!\n\nWhen experimenting with novel ideas it is important to get feedback quickly, which is often not realistic with complex environments like StarCraft II.\nAs Reaver was built with modular architecture, its agent implementations are not actually tied to StarCraft II at all.\nYou can make drop-in replacements for many popular game environments (e.g. `openAI gym`) and verify implementations work with those first:\n\n```bash\npython -m reaver.run --env CartPole-v0 --agent a2c 2> stderr.log\n```\n\n```python\nimport reaver as rvr\n\nenv = rvr.envs.GymEnv('CartPole-v0')\nagent = rvr.agents.A2C(env.obs_spec(), env.act_spec())\nagent.run(env)\n```\n\n### Supported Environments\n\nCurrently the following environments are supported by Reaver:\n\n* StarCraft II via PySC2 (tested on all minigames)\n* openAI Gym (tested on `CartPole-v0`)\n* Atari (tested on `PongNoFrameskip-v0`)\n* Mujoco (tested on `InvertedPendulum-v2` and `HalfCheetah-v2`)\n\n## Results\n\nMap                         |                 Reaver (A2C) | DeepMind SC2LE | DeepMind ReDRL | Human Expert |\n:-------------------------- | ---------------------------: | -------------: | -------------: | -----------: |\nMoveToBeacon                |       26.3 (1.8)\u003Cbr>[21, 31] |             26 |             27 |           28 |\nCollectMineralShards        |    102.8 (10.8)\u003Cbr>[81, 135] |            103 |            196 |          177 |\nDefeatRoaches               |     72.5 (43.5)\u003Cbr>[21, 283] |            100 |            303 |          215 |\nFindAndDefeatZerglings      |       22.1 (3.6)\u003Cbr>[12, 40] |             45 |             62 |           61 |\nDefeatZerglingsAndBanelings |     56.8 (20.8)\u003Cbr>[21, 154] |             62 |            736 |          727 |\nCollectMineralsAndGas       |  2267.5 (488.8)\u003Cbr>[0, 3320] |          3,978 |          5,055 |        7,566 |\nBuildMarines                |                           -- |              3 |            123 |          133 |\n\n* `Human Expert` results were gathered by DeepMind from a GrandMaster level player.\n* `DeepMind ReDRL` refers to current state-of-the-art results, described in [Relational Deep Reinforcement Learning](https:\u002F\u002Farxiv.org\u002Fabs\u002F1806.01830) article.\n* `DeepMind SC2LE` are results published in [StarCraft II: A New Challenge for Reinforcement Learning](https:\u002F\u002Farxiv.org\u002Fabs\u002F1708.04782) article.\n* `Reaver (A2C)` are results gathered by training the `reaver.agents.A2C` agent, replicating `SC2LE` architecture as closely as possible on available hardware.\nResults are gathered by running the trained agent in `--test` mode for `100` episodes, calculating episode total rewards.\nListed are the mean, standard deviation (in parentheses), and min & max (in square brackets).\n\n### Training Details\n\nMap                         |        Samples |       Episodes | Approx. Time (hr) |\n:-------------------------- | -------------: | -------------: | ----------------: |\nMoveToBeacon                |        563,200 |          2,304 |               0.5 |\nCollectMineralShards        |     74,752,000 |        311,426 |                50 |\nDefeatRoaches               |    172,800,000 |      1,609,211 |               150 |\nFindAndDefeatZerglings      |     29,760,000 |         89,654 |                20 |\nDefeatZerglingsAndBanelings |     10,496,000 |        273,463 |                15 |\nCollectMineralsAndGas       |     16,864,000 |         20,544 |                10 |\nBuildMarines                |              - |              - |                 - |\n\n* `Samples` refer to total number of `observe -> step -> reward` chains in *one* environment.\n* `Episodes` refer to total number of `StepType.LAST` flags returned by PySC2.\n* `Approx. Time` is the approximate training time on a `laptop` with Intel `i5-7300HQ` CPU (4 cores) and `GTX 1050` GPU.\n\nNote that I did not put much time into hyperparameter tuning, focusing mostly on verifying that the agent is capable of learning\nrather than maximizing sample efficiency. For example, naive first try on `MoveToBeacon` required about 4 million samples,\nhowever after some playing around I was able to reduce it down all the way to 102,000 (~40x reduction) with PPO agent.\n\n[![](https:\u002F\u002Fi.imgur.com\u002FrIoc6rTl.png)](https:\u002F\u002Fi.imgur.com\u002FrIoc6rT.png)  \nMean episode rewards with std.dev filled in-between. Click to enlarge.\n\n### Video Recording\n\nA video recording of the agent performing on all six minigames is available online at: [https:\u002F\u002Fyoutu.be\u002FgEyBzcPU5-w](https:\u002F\u002Fyoutu.be\u002FgEyBzcPU5-w).\nIn the video on the left is the agent acting in with randomly initialized weights and no training, whereas on the right he is trained to target scores.\n\n## Reproducibility\n\nThe problem of reproducibility of research has recently become a subject of many debates in science\n[in general](https:\u002F\u002Fwww.nature.com\u002Fnews\u002F1-500-scientists-lift-the-lid-on-reproducibility-1.19970), \nand Reinforcement Learning is [not an exception](https:\u002F\u002Farxiv.org\u002Fabs\u002F1709.06560).\nOne of the goals of Reaver as a scientific project is to help facilitate reproducible research.\nTo this end Reaver comes bundled with various tools that simplify the process:\n\n* All experiments are saved into separate folders with automatic model checkpoints enabled by default\n* All configuration is handled through [gin-config](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgin-config) Python library and saved to experiment results directory\n* During training various statistics metrics are duplicated into experiment results directory\n* Results directory structure simplifies sharing individual experiments with full information\n\n### Pre-trained Weights & Summary Logs\n\nTo lead the way with reproducibility, Reaver is bundled with pre-trained weights and full Tensorboard summary logs for all six minigames. \nSimply download an experiment archive from the [releases](https:\u002F\u002Fgithub.com\u002Finoryy\u002Freaver-pysc2\u002Freleases) tab and unzip onto the `results\u002F` directory.\n\nYou can use pre-trained weights by appending `--experiment` flag to `reaver.run` command:\n\n    python reaver.run --map \u003Cmap_name> --experiment \u003Cmap_name>_reaver --test 2> stderr.log\n\nTensorboard logs are available if you launch `tensorboard --logidr=results\u002Fsummaries`.  \nYou can also view them [directly online](https:\u002F\u002Fboards.aughie.org\u002Fboard\u002FHWi4xmuvuOSuw09QBfyDD-oNF1U) via [Aughie Boards](https:\u002F\u002Fboards.aughie.org\u002F).\n\n## Why \"Reaver\"?\n\nReaver is a very special and subjectively cute Protoss unit in the StarCraft game universe.\nIn the StarCraft: Brood War version of the game, Reaver was notorious for being slow, clumsy,\nand often borderline useless if left on its own due to buggy in-game AI. However, in the hands of dedicated players that invested\ntime into mastery of the unit, Reaver became one of the most powerful assets in the game, often playing a key role in tournament winning games.\n\n## Acknowledgement\n\nA predecessor to Reaver, named simply `pysc2-rl-agent`, was developed as the practical part of\n[bachelor's thesis](https:\u002F\u002Fgithub.com\u002Finoryy\u002Fbsc-thesis) at the University of Tartu under the\nsupervision of [Ilya Kuzovkin](https:\u002F\u002Fgithub.com\u002Fkuz) and [Tambet Matiisen](https:\u002F\u002Fgithub.com\u002Ftambetm).\nYou can still access it on the [v1.0](https:\u002F\u002Fgithub.com\u002Finoryy\u002Freaver-pysc2\u002Ftree\u002Fv1.0) branch.\n\n## Support\n\nIf you encounter a codebase related problem then please open a ticket on GitHub and describe it in as much detail as possible. \nIf you have more general questions or simply seeking advice feel free to send me an email.\n\nI am also a proud member of an active and friendly [SC2AI](http:\u002F\u002Fsc2ai.net) online community, \nwe mostly use [Discord](https:\u002F\u002Fdiscordapp.com\u002Finvite\u002FEmm5Ztz) for communication. People of all backgrounds and levels of expertise are welcome to join!\n\n## Citing\n\nIf you have found Reaver useful in your research, please consider citing it with the following bibtex:\n\n```\n@misc{reaver,\n  author = {Ring, Roman},\n  title = {Reaver: Modular Deep Reinforcement Learning Framework},\n  year = {2018},\n  publisher = {GitHub},\n  journal = {GitHub repository},\n  howpublished = {\\url{https:\u002F\u002Fgithub.com\u002Finoryy\u002Freaver}},\n}\n```\n","# Reaver：模块化深度强化学习框架\n\n[![MoveToBeacon](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Finoryy_reaver_readme_beeff61e4bc9.gif)](https:\u002F\u002Fyoutu.be\u002FgEyBzcPU5-w)\n[![CollectMineralShards](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Finoryy_reaver_readme_4403565a409a.gif)](https:\u002F\u002Fyoutu.be\u002FgEyBzcPU5-w)\n[![DefeatRoaches](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Finoryy_reaver_readme_f32d97f5c77b.gif)](https:\u002F\u002Fyoutu.be\u002FgEyBzcPU5-w)\n[![DefeatZerglingsAndBanelings](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Finoryy_reaver_readme_092fa7a20cdf.gif)](https:\u002F\u002Fyoutu.be\u002FgEyBzcPU5-w)\n[![FindAndDefeatZerglings](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Finoryy_reaver_readme_4cf66aade41e.gif)](https:\u002F\u002Fyoutu.be\u002FgEyBzcPU5-w)\n[![BuildMarines](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Finoryy_reaver_readme_ca8836b0cb80.gif)](https:\u002F\u002Fyoutu.be\u002FgEyBzcPU5-w)\n\n[![MoveToBeacon](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Finoryy_reaver_readme_f1284293728d.gif)](https:\u002F\u002Fyoutu.be\u002FgEyBzcPU5-w)\n[![CollectMineralShards](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Finoryy_reaver_readme_f2be2942f8af.gif)](https:\u002F\u002Fyoutu.be\u002FgEyBzcPU5-w)\n[![DefeatRoaches](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Finoryy_reaver_readme_fe00f37d0576.gif)](https:\u002F\u002Fyoutu.be\u002FgEyBzcPU5-w)\n[![DefeatZerglingsAndBanelings](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Finoryy_reaver_readme_9506c24e807c.gif)](https:\u002F\u002Fyoutu.be\u002FgEyBzcPU5-w)\n[![FindAndDefeatZerglings](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Finoryy_reaver_readme_1af64c46f4f8.gif)](https:\u002F\u002Fyoutu.be\u002FgEyBzcPU5-w)\n[![BuildMarines](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Finoryy_reaver_readme_ad340d64830e.gif)](https:\u002F\u002Fyoutu.be\u002FgEyBzcPU5-w)\n\n**项目状态：** 已停止维护！  \n很遗憾，我目前无法继续开发或为该项目提供支持。\n\n## 简介\n\nReaver 是一个模块化的深度强化学习框架，专注于各种基于《星际争霸II》的任务。它追随 DeepMind 的脚步，通过模拟人类玩家的操作界面和限制条件来推动该领域的前沿发展。这包括观察与人类玩家相似（尽管不完全相同）的视觉特征，并从与人类玩家类似的可选动作中进行选择。更多细节请参阅论文 [《星际争霸II：强化学习的新挑战》](https:\u002F\u002Farxiv.org\u002Fabs\u002F1708.04782)。\n\n尽管 Reaver 的开发以研究为导向，但其 API 的设计理念却与《星际争霸II》本身如出一辙——无论你是该领域的初学者还是资深研究人员，都能从中受益。对于业余程序员来说，Reaver 提供了所有必要的工具，只需修改智能体的一小部分（例如超参数）即可训练深度强化学习智能体。而对于经验丰富的研究人员，Reaver 则提供了一个简单但性能优化的模块化代码库：智能体、模型和环境彼此解耦，可以随意互换。\n\n虽然 Reaver 的重点是《星际争霸II》，但它也完全支持其他流行的游戏环境，尤其是 Atari 和 MuJoCo。Reaver 的智能体算法已经过参考结果的验证，例如 PPO 智能体能够达到 [近端策略优化算法](https:\u002F\u002Farxiv.org\u002Fabs\u002F1707.06347) 的水平。更多详情请参见下文（#but-wait-theres-more）。\n\n## 安装\n\n### PIP 包\n\n安装 Reaver 最简单的方式是通过 `PIP` 包管理器：\n\n    pip install reaver\n\n你还可以通过附加标志安装额外的功能（例如 `gym` 支持）：\n\n    pip install reaver[gym,atari,mujoco]\n\n### 手动安装\n\n如果你计划修改 Reaver 的代码库，可以通过源码安装来保持其模块功能：\n\n```\n$ git clone https:\u002F\u002Fgithub.com\u002Finoryy\u002Freaver-pysc2\n$ pip install -e reaver-pysc2\u002F\n```\n\n使用 `-e` 标志安装后，Python 将会在指定的文件夹中查找 `reaver`，而不是在 `site-packages` 目录中。\n\n### Windows\n\n请参阅 [wiki](https:\u002F\u002Fgithub.com\u002Finoryy\u002Freaver-pysc2\u002Fwiki\u002FWindows) 页面，获取在 Windows 上设置 Reaver 的详细说明。\n\n不过，如果可能的话，请考虑使用 `Linux OS` —— 这主要是出于性能和稳定性方面的考虑。如果你想让智能体在开启完整图形的情况下运行，可以在 Linux 上保存智能体的回放录像，然后在 Windows 上打开。下面列出的视频录制就是通过这种方式完成的。\n\n### 需求\n\n* PySC2 >= 3.0.0\n* 星际争霸II >= 4.1.2（[安装说明](https:\u002F\u002Fgithub.com\u002FBlizzard\u002Fs2client-proto#downloads)）\n* gin-config >= 0.3.0\n* TensorFlow >= 2.0.0\n* TensorFlow Probability >= 0.9\n\n#### 可选扩展\n如果你想将 Reaver 与其他支持的环境一起使用，还需要安装相应的包：\n\n* gym >= 0.10.0\n* atari-py >= 0.1.5\n* mujoco-py >= 1.50.0\n  * roboschool >= 1.0（替代方案）\n\n## 快速入门\n\n只需四行代码，您就可以在多个并行运行的《星际争霸II》环境中训练一个强化学习智能体！\n\n```python\nimport reaver as rvr\n\nenv = rvr.envs.SC2Env(map_name='MoveToBeacon')\nagent = rvr.agents.A2C(env.obs_spec(), env.act_spec(), rvr.models.build_fully_conv, rvr.models.SC2MultiPolicy, n_envs=4)\nagent.run(env)\n```\n\n此外，Reaver 提供高度可配置的命令行工具，因此这项任务可以简化为一行短命令！\n\n```bash\npython -m reaver.run --env MoveToBeacon --agent a2c --n_envs 4 2> stderr.log\n```\n\n使用上述命令，Reaver 将以一组预定义的超参数初始化训练过程，这些超参数是专门为给定环境和智能体优化的。过一段时间后，您将在终端屏幕上看到包含各种有用统计信息的日志。\n\n    | T    118 | Fr     51200 | Ep    212 | Up    100 | RMe    0.14 | RSd    0.49 | RMa    3.00 | RMi    0.00 | Pl    0.017 | Vl    0.008 | El 0.0225 | Gr    3.493 | Fps   433 |\n    | T    238 | Fr    102400 | Ep    424 | Up    200 | RMe    0.92 | RSd    0.97 | RMa    4.00 | RMi    0.00 | Pl   -0.196 | Vl    0.012 | El 0.0249 | Gr    1.791 | Fps   430 |\n    | T    359 | Fr    153600 | Ep    640 | Up    300 | RMe    1.80 | RSd    1.30 | RMa    6.00 | RMi    0.00 | Pl   -0.035 | Vl    0.041 | El 0.0253 | Gr    1.832 | Fps   427 |\n    ...\n    | T   1578 | Fr    665600 | Ep   2772 | Up   1300 | RMe   24.26 | RSd    3.19 | RMa   29.00 | RMi    0.00 | Pl    0.050 | Vl    1.242 | El 0.0174 | Gr    4.814 | Fps   421 |\n    | T   1695 | Fr    716800 | Ep   2984 | Up   1400 | RMe   24.31 | RSd    2.55 | RMa   30.00 | RMi   16.00 | Pl    0.005 | Vl    0.202 | El 0.0178 | Gr   56.385 | Fps   422 |\n    | T   1812 | Fr    768000 | Ep   3200 | Up   1500 | RMe   24.97 | RSd    1.89 | RMa   31.00 | RMi   21.00 | Pl   -0.075 | Vl    1.385 | El 0.0176 | Gr   17.619 | Fps   423 |\n\nReaver 应该会迅速收敛到大约 25-26 的 `RMe`（每集平均奖励），这与 DeepMind 在该环境下的结果一致。具体的训练时间取决于您的硬件。以上日志是在一台配备 Intel i5-7300HQ CPU（4 核）和 GTX 1050 GPU 的笔记本电脑上生成的，训练耗时约 30 分钟。\n\n当 Reaver 完成训练后，您可以通过在单行命令中添加 `--test` 和 `--render` 标志来查看其表现。\n\n```bash\npython -m reaver.run --env MoveToBeacon --agent a2c --test --render 2> stderr.log\n```\n\n### Google Colab\n\n我们提供了一个配套的 [Google Colab 笔记本](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1DvyCUdymqgjk85FB5DrTtAwTFbI494x7)，您可以在网上试用 Reaver。\n\n## 核心特性\n\n### 性能\n\n许多现代强化学习算法依赖于同时在多个环境中并行执行。由于 Python 具有 [GIL](https:\u002F\u002Fwiki.python.org\u002Fmoin\u002FGlobalInterpreterLock)，这一功能必须通过多进程实现。大多数开源实现采用基于消息的方法（例如 Python 的 `multiprocessing.Pipe` 或 `MPI`），其中各个进程通过 [IPC](https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FInter-process_communication) 发送数据进行通信。对于像 DeepMind 和 OpenAI 这样的公司在大规模分布式系统上开展的工作来说，这是一种合理且可能是唯一可行的方式。\n\n然而，对于一般的科研人员或爱好者来说，更常见的情况是只能访问单机环境，无论是笔记本电脑还是 HPC 集群上的节点。Reaver 专门针对这种情况进行了优化，通过无锁方式利用共享内存。这种方法显著提升了性能，使《星际争霸II》的采样率最高可提升 **1.5 倍**（在一般情况下甚至可提升至 100 倍），几乎完全消除了 GPU 输入\u002F输出管道的瓶颈。\n\n### 扩展性\n\nReaver 的三个核心模块——`envs`、`models` 和 `agents`——几乎完全相互独立。这确保了在一个模块中扩展功能时，能够无缝地集成到其他模块中。\n\n### 可配置性\n\n所有配置都通过 [gin-config](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fgin-config) 处理，并且可以轻松地以 `.gin` 文件的形式共享。这包括所有的超参数、环境参数以及模型定义。\n\n### 已实现的智能体\n\n* 优势演员-评论家（A2C）\n* 局部策略优化（PPO）\n\n#### 其他强化学习特性\n\n* 广义优势估计（GAE）\n* 奖励裁剪\n* 梯度范数裁剪\n* 优势归一化\n* 基线（评论家）自举\n* 独立的基线网络\n\n### 还不止这些！\n\n在尝试新想法时，快速获得反馈非常重要，而这一点在像《星际争霸II》这样复杂的环境中往往难以实现。由于 Reaver 采用了模块化架构，其智能体实现实际上并不局限于《星际争霸II》。您可以直接替换为许多流行的游戏环境（例如 `openAI gym`），并先验证实现是否有效：\n\n```bash\npython -m reaver.run --env CartPole-v0 --agent a2c 2> stderr.log\n```\n\n```python\nimport reaver as rvr\n\nenv = rvr.envs.GymEnv('CartPole-v0')\nagent = rvr.agents.A2C(env.obs_spec(), env.act_spec())\nagent.run(env)\n```\n\n### 支持的环境\n\n目前 Reaver 支持以下环境：\n\n* 《星际争霸II》通过 PySC2（已在所有小游戏上测试）\n* openAI Gym（已在 `CartPole-v0` 上测试）\n* Atari（已在 `PongNoFrameskip-v0` 上测试）\n* Mujoco（已在 `InvertedPendulum-v2` 和 `HalfCheetah-v2` 上测试）\n\n## 结果\n\n地图                         |                 Reaver (A2C) | DeepMind SC2LE | DeepMind ReDRL | 人类专家 |\n:-------------------------- | ---------------------------: | -------------: | -------------: | -----------: |\n前往信标                |       26.3 (1.8)\u003Cbr>[21, 31] |             26 |             27 |           28 |\n收集矿物碎片        |    102.8 (10.8)\u003Cbr>[81, 135] |            103 |            196 |          177 |\n击败蟑螂               |     72.5 (43.5)\u003Cbr>[21, 283] |            100 |            303 |          215 |\n找到并击败泽格幼虫      |       22.1 (3.6)\u003Cbr>[12, 40] |             45 |             62 |           61 |\n击败泽格幼虫和狂暴者 |     56.8 (20.8)\u003Cbr>[21, 154] |             62 |            736 |          727 |\n收集矿物和气体       |  2267.5 (488.8)\u003Cbr>[0, 3320] |          3,978 |          5,055 |        7,566 |\n建造陆战队员                |                           -- |              3 |            123 |          133 |\n\n* `人类专家`的结果由DeepMind从一位大师级玩家那里收集而来。\n* `DeepMind ReDRL`指的是当前最先进的结果，详见论文《关系型深度强化学习》（https:\u002F\u002Farxiv.org\u002Fabs\u002F1806.01830）。\n* `DeepMind SC2LE`是发表在论文《星际争霸II：强化学习的新挑战》（https:\u002F\u002Farxiv.org\u002Fabs\u002F1708.04782）中的结果。\n* `Reaver (A2C)`是在现有硬件上尽可能复现SC2LE架构，训练`reaver.agents.A2C`智能体所得到的结果。\n结果通过让训练好的智能体以`--test`模式运行100个episode，并计算每个episode的总奖励来获得。列出的是平均值、标准差（括号内）以及最小值和最大值（方括号内）。\n\n### 训练详情\n\n地图                         |        样本数 |       episode数 | 大约时间（小时） |\n:-------------------------- | -------------: | -------------: | ----------------: |\n前往信标                |        563,200 |          2,304 |               0.5 |\n收集矿物碎片        |     74,752,000 |        311,426 |                50 |\n击败蟑螂               |    172,800,000 |      1,609,211 |               150 |\n找到并击败泽格幼虫      |     29,760,000 |         89,654 |                20 |\n击败泽格幼虫和狂暴者 |     10,496,000 |        273,463 |                15 |\n收集矿物和气体       |     16,864,000 |         20,544 |                10 |\n建造陆战队员                |              - |              - |                 - |\n\n* `样本数`指在一个环境中`observe -> step -> reward`链条的总数。\n* `episode数`指PySC2返回的`StepType.LAST`标志的总数。\n* `大约时间`是在配备Intel i5-7300HQ四核CPU和GTX 1050显卡的笔记本电脑上的大致训练时间。\n\n需要注意的是，我没有花太多时间进行超参数调优，而是主要关注验证智能体是否能够学习，而不是最大化样本效率。例如，在`MoveToBeacon`任务上，最初的尝试大约需要400万个样本，但经过一些调整后，我最终使用PPO智能体将所需样本数减少到10.2万个左右（约40倍的减少）。\n\n[![](https:\u002F\u002Fi.imgur.com\u002FrIoc6rTl.png)](https:\u002F\u002Fi.imgur.com\u002FrIoc6rT.png)  \n带标准差填充的平均episode奖励。点击可放大。\n\n### 视频记录\n\n智能体在所有六个小游戏上表现的视频录制已在线发布：[https:\u002F\u002Fyoutu.be\u002FgEyBzcPU5-w](https:\u002F\u002Fyoutu.be\u002FgEyBzcPU5-w)。视频左侧显示的是智能体在随机初始化权重且未经过训练时的表现，而右侧则是经过训练达到目标分数后的表现。\n\n## 可重复性\n\n近年来，研究的可重复性问题已成为科学界广泛讨论的话题，[总体而言](https:\u002F\u002Fwww.nature.com\u002Fnews\u002F1-500-scientists-lift-the-lid-on-reproducibility-1.19970)，强化学习也不例外，[如这篇论文所述](https:\u002F\u002Farxiv.org\u002Fabs\u002F1709.06560)。作为一项科学项目，Reaver的目标之一就是促进可重复性研究。为此，Reaver附带了多种简化流程的工具：\n\n* 所有实验都会保存到独立的文件夹中，默认启用自动模型检查点功能。\n* 所有配置都通过Python库gin-config管理，并保存到实验结果目录中。\n* 在训练过程中，各种统计指标会被复制到实验结果目录中。\n* 结果目录的结构便于分享包含完整信息的单个实验。\n\n### 预训练权重与摘要日志\n\n为推动可重复性研究，Reaver附带了所有六个小游戏的预训练权重和完整的TensorBoard摘要日志。只需从[release页面](https:\u002F\u002Fgithub.com\u002Finoryy\u002Freaver-pysc2\u002Freleases)下载实验存档，并解压到`results\u002F`目录即可。\n\n你可以通过在`reaver.run`命令中添加`--experiment`标志来使用预训练权重：\n\n    python reaver.run --map \u003Cmap_name> --experiment \u003Cmap_name>_reaver --test 2> stderr.log\n\nTensorBoard日志可以通过运行`tensorboard --logdir=results\u002Fsummaries`查看。你也可以通过[Aughie Boards](https:\u002F\u002Fboards.aughie.org\u002F)直接在线查看这些日志：[https:\u002F\u002Fboards.aughie.org\u002Fboard\u002FHWi4xmuvuOSuw09QBfyDD-oNF1U](https:\u002F\u002Fboards.aughie.org\u002Fboard\u002FHWi4xmuvuOSuw09QBfyDD-oNF1U)。\n\n## 为什么叫“Reaver”？\n\nReaver是星际争霸游戏宇宙中一种非常特别且颇具萌感的星灵单位。在《星际争霸：母巢之战》版本中，Reaver因行动迟缓、笨拙，且由于游戏内AI存在诸多漏洞，单独使用时往往几乎毫无用处而闻名。然而，对于那些愿意投入时间掌握该单位的资深玩家来说，Reaver却成为了游戏中最强大的资产之一，常常在锦标赛冠军比赛中发挥关键作用。\n\n## 致谢\n\nReaver的前身名为`pysc2-rl-agent`，它是塔尔图大学一篇学士论文的实践部分，由[Ilya Kuzovkin](https:\u002F\u002Fgithub.com\u002Fkuz)和[Tambet Matiisen](https:\u002F\u002Fgithub.com\u002Ftambetm)指导完成。你仍然可以在[v1.0分支](https:\u002F\u002Fgithub.com\u002Finoryy\u002Freaver-pysc2\u002Ftree\u002Fv1.0)中找到它。\n\n## 支持\n\n如果你遇到与代码库相关的问题，请在GitHub上提交一个issue，并尽可能详细地描述问题。如果你有更一般性的疑问或只是想寻求建议，欢迎随时给我发送电子邮件。\n\n我也是活跃友好的[SC2AI](http:\u002F\u002Fsc2ai.net)在线社区的一员，我们主要使用[Discord](https:\u002F\u002Fdiscordapp.com\u002Finvite\u002FEmm5Ztz)进行交流。欢迎来自不同背景和具有不同专业水平的人加入！\n\n## 引用\n\n如果您在研究中使用了 Reaver，请考虑使用以下 BibTeX 格式对其进行引用：\n\n```\n@misc{reaver,\n  author = {Ring, Roman},\n  title = {Reaver：模块化的深度强化学习框架},\n  year = {2018},\n  publisher = {GitHub},\n  journal = {GitHub 代码库},\n  howpublished = {\\url{https:\u002F\u002Fgithub.com\u002Finoryy\u002Freaver}},\n}\n```","# Reaver 快速上手指南\n\nReaver 是一个模块化的深度强化学习框架，专注于《星际争霸 II》（StarCraft II）任务，同时也支持 Atari 和 MuJoCo 等环境。它采用无锁共享内存机制，在单机环境下能显著提升采样速度。\n\n> **注意**：该项目目前不再维护（No longer maintained），但代码仍可用于学习和研究参考。\n\n## 1. 环境准备\n\n在开始之前，请确保您的系统满足以下要求：\n\n### 系统建议\n*   **操作系统**：推荐使用 **Linux** 以获得最佳性能和稳定性。\n    *   *Windows 用户*：虽可运行，但建议参考官方 Wiki 配置。若需查看带画面的回放，可在 Linux 训练保存回放后，移至 Windows 播放。\n*   **硬件**：多核 CPU 和 NVIDIA GPU（用于加速训练）。\n\n### 前置依赖\n您需要预先安装以下软件：\n*   **StarCraft II**: 版本 >= 4.1.2\n    *   下载及配置说明：[Blizzard s2client-proto](https:\u002F\u002Fgithub.com\u002FBlizzard\u002Fs2client-proto#downloads)\n*   **Python 环境**: 建议 Python 3.6+\n*   **核心库**:\n    *   PySC2 >= 3.0.0\n    *   TensorFlow >= 2.0.0\n    *   TensorFlow Probability >= 0.9\n    *   gin-config >= 0.3.0\n\n*(可选)* 若需运行其他环境（如 Gym\u002FAtari\u002FMuJoCo），还需安装对应库：`gym`, `atari-py`, `mujoco-py` 等。\n\n## 2. 安装步骤\n\n### 方式一：通过 PIP 安装（推荐）\n这是最简单的安装方式。国内用户建议使用清华或阿里镜像源加速安装。\n\n```bash\n# 基础安装\npip install reaver -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n\n# 若需要支持 Gym, Atari 或 MuJoCo 环境，可使用 extras 安装\npip install \"reaver[gym,atari,mujoco]\" -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n```\n\n### 方式二：源码安装（适合开发者）\n如果您计划修改 Reaver 源代码，请使用此方式：\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Finoryy\u002Freaver-pysc2\ncd reaver-pysc2\npip install -e . -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n```\n*注：`-e` 参数将使 Python 直接读取当前文件夹的代码，便于开发调试。*\n\n## 3. 基本使用\n\nReaver 提供了极高的易用性，既可以通过命令行一键启动，也可以通过 Python 代码灵活控制。\n\n### 方法 A：命令行一键训练（最简单）\n以下命令将启动一个 A2C 代理，在 `MoveToBeacon` 地图上利用 4 个并行环境进行训练：\n\n```bash\npython -m reaver.run --env MoveToBeacon --agent a2c --n_envs 4 2> stderr.log\n```\n\n运行后，终端将实时输出训练统计信息（如奖励均值 `RMe`、帧率 `Fps` 等）。当 `RMe` 收敛至 25-26 左右时，表示训练达到预期效果（与 DeepMind 基准相当）。\n\n**测试与可视化：**\n训练完成后，添加 `--test` 和 `--render` 参数即可观察代理表现：\n\n```bash\npython -m reaver.run --env MoveToBeacon --agent a2c --test --render 2> stderr.log\n```\n\n### 方法 B：Python 代码调用\n如果您需要在脚本中集成或自定义逻辑，仅需四行代码即可启动训练：\n\n```python\nimport reaver as rvr\n\n# 初始化环境\nenv = rvr.envs.SC2Env(map_name='MoveToBeacon')\n\n# 初始化代理 (A2C 算法)\nagent = rvr.agents.A2C(env.obs_spec(), env.act_spec(), rvr.models.build_fully_conv, rvr.models.SC2MultiPolicy, n_envs=4)\n\n# 开始训练\nagent.run(env)\n```\n\n### 其他支持的环境\nReaver 的架构是解耦的，您可以轻松切换至其他环境进行快速验证（无需启动庞大的星际争霸）：\n\n```bash\n# 示例：在 CartPole 环境中运行\npython -m reaver.run --env CartPole-v0 --agent a2c 2> stderr.log\n```\n\n目前支持的环境包括：\n*   StarCraft II (via PySC2)\n*   OpenAI Gym\n*   Atari\n*   MuJoCo","某高校人工智能实验室的研究团队正致力于复现 DeepMind 在《星际争霸 II》中的强化学习成果，并尝试将算法迁移至复杂的即时战略游戏环境中。\n\n### 没有 reaver 时\n- **环境适配繁琐**：研究人员需花费数周时间手动编写代码，将游戏原始的视觉特征和动作空间转换为强化学习模型可识别的格式。\n- **架构耦合严重**：代理逻辑、神经网络模型与游戏环境紧密耦合，一旦需要更换算法（如从 DQN 切换至 PPO），往往需要重构大量底层代码。\n- **基线验证困难**：缺乏标准化的参考实现，难以确认自研算法的性能下降是源于策略缺陷还是环境交互逻辑的错误。\n- **扩展性差**：若想将训练好的模型快速测试于 Atari 或 MuJoCo 等其他基准环境，几乎需要重新搭建整套实验框架。\n\n### 使用 reaver 后\n- **开箱即用**：reaver 内置了针对《星际争霸 II》的高度模块化接口，团队仅需修改少量配置文件即可启动训练，大幅缩短环境准备周期。\n- **模块自由替换**：得益于其解耦架构，研究人员可以像搭积木一样独立替换代理、模型或环境组件，轻松在不同算法间进行对比实验。\n- **结果可信度高**：reaver 提供的 PPO 等算法已通过与论文一致的基准验证，团队可直接以其为标尺，精准定位自身改进点的实际效果。\n- **多环境支持**：同一套代码库无缝支持 Gym、Atari 及 MuJoCo 环境，便于团队将游戏中学到的策略快速迁移验证到其他物理仿真场景中。\n\nreaver 通过高度模块化设计和标准化的基准实现，让研究人员从繁琐的工程基建中解放出来，专注于核心算法的创新与突破。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Finoryy_reaver_1e8a2805.png","inoryy","Roman Ring","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Finoryy_1b478eb4.png","Research Engineer. Interests lie at the intersection of Deep Learning, Computational Neuroscience, and Programming Languages.","@deepmind",null,"inoryy@gmail.com","http:\u002F\u002Finoryy.com","https:\u002F\u002Fgithub.com\u002Finoryy",[82],{"name":83,"color":84,"percentage":85},"Python","#3572A5",100,561,87,"2026-03-17T14:53:27","MIT",4,"Linux, Windows","需要 GPU（日志示例使用 GTX 1050），具体显存和 CUDA 版本未说明","未说明",{"notes":95,"python":93,"dependencies":96},"项目已不再维护。强烈建议使用 Linux 系统以获得更好的性能和稳定性；若在 Windows 上运行，建议仅在 Linux 上训练并保存回放，然后在 Windows 上观看。需要安装 StarCraft II 游戏客户端（版本>=4.1.2）。支持通过共享内存实现无锁多进程加速。",[97,98,99,100,101,102,103],"PySC2>=3.0.0","gin-config>=0.3.0","TensorFlow>=2.0.0","TensorFlow Probability>=0.9","gym>=0.10.0 (可选)","atari-py>=0.1.5 (可选)","mujoco-py>=1.50.0 (可选)",[14],[106,107,108,109,110,111,112,113,114,115],"artificial-intelligence","deep-learning","machine-learning","reinforcement-learning","actor-critic","tensorflow","pysc2","starcraft-ii","starcraft2","deepmind","2026-03-27T02:49:30.150509","2026-04-08T01:58:59.719511",[119,124,129,134,139,144],{"id":120,"question_zh":121,"answer_zh":122,"source_url":123},23451,"导入 reaver 时出现 'AttributeError: module 'tensorflow._api.v1.io' has no attribute 'gfile'' 错误怎么办？","该问题通常由 `gin-config` 版本不兼容引起。请尝试将 `gin-config` 降级到 0.1.2 版本。如果直接安装仍有问题，可能需要同时调整 TensorFlow 和 TF-Probability 的版本（例如 TF==1.11.0, TF-probability==0.4.0）。也可以尝试升级 reaver 到最新版本以获取修复：\n\npip install gin-config==0.1.2\n# 或者\npip install --upgrade reaver","https:\u002F\u002Fgithub.com\u002Finoryy\u002Freaver\u002Fissues\u002F24",{"id":125,"question_zh":126,"answer_zh":127,"source_url":128},23452,"在 Windows 上运行时报错 'TypeError: Can't index by type: \u003Cclass 'list'>' 且代理无法行动如何解决？","这是 Linux 和 Windows 在 `multiprocessing`（多进程）处理上的差异导致的。建议的解决方案包括：\n1. 在一个干净的 conda 环境中重新安装所有依赖。\n2. 强制升级 PySC2 到最新版本：\n   pip install --upgrade https:\u002F\u002Fgithub.com\u002Fdeepmind\u002Fpysc2\u002Farchive\u002Fmaster.zip\n3. 确保安装了最新的 reaver 版本，其中包含了默认的 logger 修复。","https:\u002F\u002Fgithub.com\u002Finoryy\u002Freaver\u002Fissues\u002F16",{"id":130,"question_zh":131,"answer_zh":132,"source_url":133},23453,"训练代理时性能不稳定，有时收敛到 'no_op' 动作且奖励很低怎么办？","这通常是因为所有可用动作的策略概率最终都变为 0，导致重新归一化无效并产生糟糕的梯度。维护者指出这是一个已知问题，并在重构代码时会避免此情况。如果是旧版本用户，建议关注项目更新或等待新版本发布，因为旧代码库中的此问题较难通过简单配置修复。","https:\u002F\u002Fgithub.com\u002Finoryy\u002Freaver\u002Fissues\u002F7",{"id":135,"question_zh":136,"answer_zh":137,"source_url":138},23454,"使用多个环境训练时，如果一个环境先结束，奖励计算是否会包含多个回合导致数值异常？","是的，这是一个已确认的 Bug。当有多个环境并行运行时，如果其中一个先完成并重启，而其他的还在运行，最终计算的奖励可能会错误地累积多个回合的数据。该问题已在后续版本中修复，请确保升级到最新版本。","https:\u002F\u002Fgithub.com\u002Finoryy\u002Freaver\u002Fissues\u002F14",{"id":140,"question_zh":141,"answer_zh":142,"source_url":143},23455,"运行 PySC2 环境时遇到奇怪的报错或与代理类型（A2C\u002FPPO）相关的错误怎么办？","这类问题通常是由于 PySC2 版本不匹配或环境依赖冲突造成的。最有效的解决方法是创建一个全新的干净 conda 环境并重新安装所有依赖。此外，可以尝试强制升级 PySC2：\n\npip install --upgrade https:\u002F\u002Fgithub.com\u002Fdeepmind\u002Fpysc2\u002Farchive\u002Fmaster.zip\n\n同时确保安装了包含默认 logger 修复的最新 reaver 版本。","https:\u002F\u002Fgithub.com\u002Finoryy\u002Freaver\u002Fissues\u002F20",{"id":145,"question_zh":146,"answer_zh":147,"source_url":133},23456,"为什么我无法复现论文或文档中报告的表演效果（Reward）？","如果在训练 CollectMineralShards 等地图时只能获得较低的奖励（如 100k steps 时 reward=75），可能是由于策略概率归零导致的梯度问题（见性能不稳定相关 Issue）。此外，请检查是否使用了正确的配置文件参数。由于该项目曾进行过重构，旧版本代码可能存在未优化的性能问题，建议使用最新版本的代码库进行训练。",[149,154],{"id":150,"version":151,"summary_zh":152,"released_at":153},144959,"v2.0.0","项目从头开始重写。概述请参阅 README.md。","2018-11-25T16:43:36",{"id":155,"version":156,"summary_zh":157,"released_at":158},144960,"v1.0.0","本科毕业论文中所描述的代码库：[使用演员—评论家方法复现 DeepMind 的《星际争霸 II》强化学习基准](https:\u002F\u002Fgithub.com\u002Finoryy\u002Fbsc-thesis)，塔尔图大学，2018 年。  \n指导教师：伊利亚·库佐夫金和坦贝特·马蒂森。\n\n**摘要。** 强化学习（RL）是人工智能（AI）的一个子领域，研究智能体如何在环境中导航，以最大化累积奖励。游戏因其规则简单、奖励信号明确，是测试强化学习算法的理想环境。本文的理论部分探讨了几种流行的经典与现代强化学习方法，其中包括在智能体中使用人工神经网络（ANN）作为函数近似器。在实践部分，我们实现了优势演员—评论家强化学习算法，并复现了 [Vinyals 等人，2017] 中描述的基于人工神经网络的智能体（[arXiv:1708.04782](https:\u002F\u002Farxiv.org\u002Fabs\u002F1708.04782)）。我们在现代即时战略游戏《星际争霸 II》中重现了当时最先进的实验结果；该游戏被视为继国际象棋和围棋之后，人工智能领域的又一重要里程碑。\n\n**全文：** [电子版](https:\u002F\u002Fgithub.com\u002Finoryy\u002Fbsc-thesis\u002Fraw\u002Fmaster\u002Fring_roman_bsc_2018.pdf)","2018-11-20T17:58:17"]