[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-mokemokechicken--reversi-alpha-zero":3,"tool-mokemokechicken--reversi-alpha-zero":64},[4,17,27,35,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":16},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,3,"2026-04-05T11:01:52",[13,14,15],"开发框架","图像","Agent","ready",{"id":18,"name":19,"github_repo":20,"description_zh":21,"stars":22,"difficulty_score":23,"last_commit_at":24,"category_tags":25,"status":16},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 真正成长为懂上",140436,2,"2026-04-05T23:32:43",[13,15,26],"语言模型",{"id":28,"name":29,"github_repo":30,"description_zh":31,"stars":32,"difficulty_score":23,"last_commit_at":33,"category_tags":34,"status":16},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 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",107662,"2026-04-03T11:11:01",[13,14,15],{"id":36,"name":37,"github_repo":38,"description_zh":39,"stars":40,"difficulty_score":10,"last_commit_at":41,"category_tags":42,"status":16},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",[13,14,15,43],"视频",{"id":45,"name":46,"github_repo":47,"description_zh":48,"stars":49,"difficulty_score":23,"last_commit_at":50,"category_tags":51,"status":16},3704,"NextChat","ChatGPTNextWeb\u002FNextChat","NextChat 是一款轻量且极速的 AI 助手，旨在为用户提供流畅、跨平台的大模型交互体验。它完美解决了用户在多设备间切换时难以保持对话连续性，以及面对众多 AI 模型不知如何统一管理的痛点。无论是日常办公、学习辅助还是创意激发，NextChat 都能让用户随时随地通过网页、iOS、Android、Windows、MacOS 或 Linux 端无缝接入智能服务。\n\n这款工具非常适合普通用户、学生、职场人士以及需要私有化部署的企业团队使用。对于开发者而言，它也提供了便捷的自托管方案，支持一键部署到 Vercel 或 Zeabur 等平台。\n\nNextChat 的核心亮点在于其广泛的模型兼容性，原生支持 Claude、DeepSeek、GPT-4 及 Gemini Pro 等主流大模型，让用户在一个界面即可自由切换不同 AI 能力。此外，它还率先支持 MCP（Model Context Protocol）协议，增强了上下文处理能力。针对企业用户，NextChat 提供专业版解决方案，具备品牌定制、细粒度权限控制、内部知识库整合及安全审计等功能，满足公司对数据隐私和个性化管理的高标准要求。",87618,"2026-04-05T07:20:52",[13,26],{"id":53,"name":54,"github_repo":55,"description_zh":56,"stars":57,"difficulty_score":23,"last_commit_at":58,"category_tags":59,"status":16},2268,"ML-For-Beginners","microsoft\u002FML-For-Beginners","ML-For-Beginners 是由微软推出的一套系统化机器学习入门课程，旨在帮助零基础用户轻松掌握经典机器学习知识。这套课程将学习路径规划为 12 周，包含 26 节精炼课程和 52 道配套测验，内容涵盖从基础概念到实际应用的完整流程，有效解决了初学者面对庞大知识体系时无从下手、缺乏结构化指导的痛点。\n\n无论是希望转型的开发者、需要补充算法背景的研究人员，还是对人工智能充满好奇的普通爱好者，都能从中受益。课程不仅提供了清晰的理论讲解，还强调动手实践，让用户在循序渐进中建立扎实的技能基础。其独特的亮点在于强大的多语言支持，通过自动化机制提供了包括简体中文在内的 50 多种语言版本，极大地降低了全球不同背景用户的学习门槛。此外，项目采用开源协作模式，社区活跃且内容持续更新，确保学习者能获取前沿且准确的技术资讯。如果你正寻找一条清晰、友好且专业的机器学习入门之路，ML-For-Beginners 将是理想的起点。",84991,"2026-04-05T10:45:23",[14,60,43,61,15,62,26,13,63],"数据工具","插件","其他","音频",{"id":65,"github_repo":66,"name":67,"description_en":68,"description_zh":69,"ai_summary_zh":69,"readme_en":70,"readme_zh":71,"quickstart_zh":72,"use_case_zh":73,"hero_image_url":74,"owner_login":75,"owner_name":76,"owner_avatar_url":77,"owner_bio":78,"owner_company":79,"owner_location":80,"owner_email":81,"owner_twitter":82,"owner_website":83,"owner_url":84,"languages":85,"stars":98,"forks":99,"last_commit_at":100,"license":101,"difficulty_score":102,"env_os":103,"env_gpu":104,"env_ram":105,"env_deps":106,"category_tags":115,"github_topics":116,"view_count":23,"oss_zip_url":82,"oss_zip_packed_at":82,"status":16,"created_at":124,"updated_at":125,"faqs":126,"releases":165},4150,"mokemokechicken\u002Freversi-alpha-zero","reversi-alpha-zero","Reversi reinforcement learning by AlphaGo Zero methods.","reversi-alpha-zero 是一个基于 AlphaGo Zero 算法原理构建的黑白棋（Reversi）强化学习开源项目。它旨在解决传统博弈程序依赖人类专家棋谱或手工规则的问题，通过让 AI 在完全零知识的状态下自我对弈，从零开始自主探索并掌握高超的棋艺策略。\n\n该项目非常适合对深度强化学习感兴趣的研究人员、AI 开发者以及希望深入理解 AlphaGo Zero 核心机制的技术爱好者使用。其独特的技术亮点在于完整复现了 AlphaGo Zero 的核心工作流，包含三个协同工作的模块：负责通过自我对弈生成训练数据的\"self\"模块、负责模型训练与迭代的\"opt\"模块，以及负责评估新模型性能以决定是否更新最佳模型的\"eval\"模块。此外，项目还提供了基于 wxPython 的图形界面，让用户能直观地与训练出的最强模型进行对战验证。依托 TensorFlow 和 Keras 框架，reversi-alpha-zero 为学习者提供了一个结构清晰、可复现的端到端实验环境，是研究无监督博弈智能的理想起点。","About\n=====\n\nReversi reinforcement learning by [AlphaGo Zero](https:\u002F\u002Fdeepmind.com\u002Fblog\u002Falphago-zero-learning-scratch\u002F) methods.\n\n@mokemokechicken's training hisotry is [Challenge History](challenge_history.md).\n\nIf you can share your achievements, I would be grateful if you post them to [Performance Reports](https:\u002F\u002Fgithub.com\u002Fmokemokechicken\u002Freversi-alpha-zero\u002Fissues\u002F40).\n\nEnvironment\n-----------\n\n* Python 3.6.3\n* tensorflow-gpu: 1.3.0 (+)\n  * tensorflow==1.3.0 is also ok, but very slow. When `play_gui`, tensorflow(cpu) is enough speed.\n* Keras: 2.0.8 (+)\n\nModules\n-------\n\n### Reinforcement Learning\n\nThis AlphaGo Zero implementation consists of three worker `self`, `opt` and `eval`.\n\n* `self` is Self-Play to generate training data by self-play using BestModel.\n* `opt` is Trainer to train model, and generate next-generation models.\n* `eval` is Evaluator to evaluate whether the next-generation model is better than BestModel. If better, replace BestModel.\n  * If `config.play.use_newest_next_generation_model = True`, this worker is useless. (It is AlphaZero method)\n\n### Evaluation\n\nFor evaluation, you can play reversi with the BestModel.  \n\n* `play_gui` is Play Game vs BestModel using wxPython.\n\nData\n-----\n\n* `data\u002Fmodel\u002Fmodel_best_*`: BestModel.\n* `data\u002Fmodel\u002Fnext_generation\u002F*`: next-generation models.\n* `data\u002Fplay_data\u002Fplay_*.json`: generated training data.\n* `logs\u002Fmain.log`: log file.\n\nIf you want to train the model from the beginning, delete the above directories.\n\nHow to use\n==========\n\nSetup\n-------\n### install libraries\n```bash\npip install -r requirements.txt\n```\n\n### install libraries with Anaconda\n```bash\ncp requirements.txt conda-requirements.txt\n```\n* Comment out lines for `jedi`, `Keras`, `parso`, `python-dotenv`, `tensorflow-tensorboard`, `wxPython` libraries\n* Replace '-' with '_' for  `ipython-genutils`, `jupyter-*`, `prompt-toolkit` libraries\n```bash\nconda env create -f environment.yml\nsource activate reversi-a0\nconda install --yes --file conda-requirements.txt\n```\n\nIf you want use GPU,\n\n```bash\npip install tensorflow-gpu\n```\n\n### set environment variables\nCreate `.env` file and write this.\n\n```text:.env\nKERAS_BACKEND=tensorflow\n```\n\nWindows Setup \n-------------\nThis instruction is written by @GCRhoads, Thanks!\n\n### Required: 64-bit windows\n\n##### Procedure verified for Windows 8.1.  Not yet tested for other versions.\n\nNote: Windows uses backslashes not forward slashes in path names.\n\n1. Change the first line (if necessary) of \"src\\reversi_zero\\agent\\player.py\" to\n**from asyncio.futures import Future**\n\n2. **Install the 64-bit version of Python 3.5** (the 32-bit version is not sufficient).  You have two options\n   - [**Direct download page**](https:\u002F\u002Fwww.python.org\u002Fdownloads\u002Frelease\u002Fpython-352\u002F)\n   - **Anaconda with Python 3.5 (Recommended)** [instructions](https:\u002F\u002Fdocs.anaconda.com\u002Fanaconda\u002Ffaq#how-do-i-get-anaconda-with-python-3-5)\n\n**Note:** For some strange reason, both Python 3.5 and Anaconda get installed in a hidden folder.  To access them, you first have to go to the Control Panel, select Folder Options, and on the View tab, click on the circle next to \"Show hidden files, folders, or drives\" in the Advanced settings section.  Anaconda gets installed in C:\\ProgramData\\Anaconda3\\.  The direct download option installs Python in (I believe) C:\\Users\\\\\u003Cyour user name>\\AppData\\Local\\Program\\Python\\.\n\n3. **Install Visual C++ 2015 build tools.** You could install the entire 2015 version (not the 2017 version that Microsoft tries to force on you) of Visual Studio but this is a large download and install, most of which you don't need. [Download visual C++ build tools](http:\u002F\u002Fgo.microsoft.com\u002Ffwlink\u002F?LinkId=691126).  Double-click on the downloaded file to run the installer.\n\n4. **Rewrite all uses of an f-strings**.  The python source code for this project uses numerous f-strings, a feature new to Python 3.6.  Since we need Python 3.5 (required by the windows version of tensorflow), use your editor's search feature to find every occurrence of an f-string and rewrite it using string.format().\n\n5. **Install the libraries**  From either the Anaconda prompt or from a command window in the top level folder where you put this distribution, enter the following.\n\n```bash\npip install -r requirements.txt\n```\n\n6. **Install tensor-flow**\n\nIf you have a gpu compatible with tensor-flow (see the list on the tensor-flow web site), then your code will execute much faster if you install the gpu version.  To install the gpu-version enter the following in either the Anaconda prompt or the command window.\n\n```bash\npip3 install -- upgrade tensorflow-gpu\n```\n\nIf you do not have a compatible gpu, then you will have to settle for the slow cpu-only version.  To install this, enter the following in either the Anaconda prompt or the command window.\n\n```bash\npip3 install -- upgrade tensorflow\n```\n7. **set environment variables**  Create a `.env` file and write the following line in this file.\n\n```text:.env\nKERAS_BACKEND=tensorflow\n```\n\nNow you should be good to go.\n\n\nStrongest Model\n---------------\nNow, \"challenge 5 model\" and \"ch5 config\" are strongest in my models.\nIf you want to play with it,\n\n```bash\nrm -rf data\u002Fmodel\u002Fnext_generation\u002F\nsh .\u002Fdownload_model.sh 5\n# run as wxPython GUI\npython src\u002Freversi_zero\u002Frun.py play_gui -c config\u002Fch5.yml\n```\n\nIf you want to use as a NBoard engine(see below \"Run as NBoard2.0 Engine\"), please use `nboard_engine -c config\u002Fch5.yml` for the Command. \n\nPast Models\n------------\nPlease remove( or rename) `data\u002Fmodel\u002Fnext_generation\u002F` directory if you want to use \"BestModel\" at `data\u002Fmodel\u002Fmodel_best_*`.\n\n### Download Trained BestModel\n\nDownload trained BestModel(trained by bellow Challenge 1) for example.\n\n```bash\nsh .\u002Fdownload_best_model.sh\n```\n\n### Download Trained the Newest Model\n\nDownload trained the newest model(trained by Challenge 2, 3, 4, 5) as BestModel.\n\n```bash\nsh .\u002Fdownload_model.sh \u003Cversion>\n```\n\nex)\n\n```bash\nsh .\u002Fdownload_model.sh 5\n```\n\nConfiguration\n--------------\n\n### 'AlphaGo Zero' method and 'AlphaZero' method\n\nI think the main difference between 'AlphaGo Zero' and 'AlphaZero' is whether using `eval` or not.\nIt is able to change these methods by configuration.\n\n#### AlphaGo Zero method\n\n* `PlayConfig#use_newest_next_generation_model = False`\n* `PlayWithHumanConfig#use_newest_next_generation_model = False`\n* Execute `Evaluator` to select the best model.\n\n#### AlphaZero method\n\n* `PlayConfig#use_newest_next_generation_model = True`\n* `PlayWithHumanConfig#use_newest_next_generation_model = True`\n* Not use `Evaluator` (the newest model is selected as `self-play`'s model)\n\n### policy distribution of self-play\n\nIn DeepMind's paper,\nit seems that policy(π) data saved by self-play are distribution in proportion to pow(N, 1\u002Ftau).\nAfter the middle of the game, the tau becomes 0, so the distribution is one-hot.\n\n`PlayDataConfig#save_policy_of_tau_1 = True` means that the saved policy's tau is always 1.\n\n## other important hyper-parameters (I think)\n\nIf you find a good parameter set, please share in the github issues!\n\n### PlayDataConfig\n\n* `nb_game_in_file,max_file_num`: The max game number of training data is `nb_game_in_file * max_file_num`.\n* `multi_process_num`: Number of process to generate self-play data.\n\n### PlayConfig, PlayWithHumanConfig\n\n* `simulation_num_per_move` : MCTS number per move.\n* `c_puct`: balance parameter of value network and policy network in MCTS.\n* `resign_threshold`: resign threshold\n* `parallel_search_num`: balance parameter(?) of speed and accuracy in MCTS.\n  * `prediction_queue_size` should be same or greater than `parallel_search_num`.\n* `dirichlet_alpha`: random parameter in self-play.\n* `share_mtcs_info_in_self_play`: extra option. if true, share MCTS tree node information among games in self-play.\n  * `reset_mtcs_info_per_game`: reset timing of shared MCTS information.\n* `use_solver_turn`, `use_solver_turn_in_simulation`: use solver from this turn. not use it if `None`.   \n\n### TrainerConfig\n\n* `wait_after_save_model_ratio`: if greater than 0, optimizer will wait the ratio time to time span of saving model every after saving model. It might be useful if you run `self-play` and `optimize` in one GPU. \n\nBasic Usages\n------------\n\nFor training model, execute `Self-Play`, `Trainer` and `Evaluator`.\n\n\nSelf-Play\n--------\n\n```bash\npython src\u002Freversi_zero\u002Frun.py self\n```\n\nWhen executed, Self-Play will start using BestModel.\nIf the BestModel does not exist, new random model will be created and become BestModel.\n\n### options\n* `--new`: create new BestModel\n* `-c config_yaml`: specify config yaml path override default settings of `config.py`\n\nTrainer\n-------\n\n```bash\npython src\u002Freversi_zero\u002Frun.py opt\n```\n\nWhen executed, Training will start.\nA base model will be loaded from latest saved next-generation model. If not existed, BestModel is used.\nTrained model will be saved every 2000 steps(mini-batch) after epoch.\n\n### options\n* `-c config_yaml`: specify config yaml path override default settings of `config.py`\n* `--total-step`: specify total step(mini-batch) numbers. The total step affects learning rate of training.\n\nEvaluator\n---------\n\n```bash\npython src\u002Freversi_zero\u002Frun.py eval\n```\n\nWhen executed, Evaluation will start.\nIt evaluates BestModel and the latest next-generation model by playing about 200 games.\nIf next-generation model wins, it becomes BestModel.\n\n### options\n* `-c config_yaml`: specify config yaml path override default settings of `config.py`\n\nPlay Game\n---------\n\n```bash\npython src\u002Freversi_zero\u002Frun.py play_gui\n```\n\n### Note: Mac pyenv environment\n\n`play_gui` uses `wxPython`.\nIt can not execute if your python environment is built without Framework.\nTry following pyenv install option.\n\n```bash\nenv PYTHON_CONFIGURE_OPTS=\"--enable-framework\" pyenv install 3.6.3\n```\n\nFor Anaconda users:\n```bash\nconda install python.app\npythonw src\u002Freversi_zero\u002Frun.py play_gui\n```\n\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmokemokechicken_reversi-alpha-zero_readme_8d0d5a1869ec.png\" width=\"50%\">\n\n\nWhen executed, ordinary reversi board will be displayed and you can play against BestModel.\nAfter BestModel moves, numbers are displayed on the board.\n\n* Top left numbers(1) mean 'Visit Count (=N(s,a))' of the last search.\n* Bottom left numbers(2) mean 'Q Value (=Q(s,a)) on AI side' of the last state and move. The Q values are multiplied by 100.\n\nRun as NBoard2.0 Engine\n--------------\n\n[NBoard](http:\u002F\u002Fwww.orbanova.com\u002Fnboard\u002F) is a very good reversi GUI and has strong reversi engines,\nwhich runs on Windows, Mac, and Linux (JRE required).\n\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmokemokechicken_reversi-alpha-zero_readme_b994ac74080f.png\" width=\"50%\">\n\nIt can add external engines that implement [NBoard Protocol](https:\u002F\u002Fgithub.com\u002Fweltyc\u002Fntest\u002Fblob\u002Fmaster\u002Finstructions\u002FProtocol.htm).\n\n### How to add this model as an external engine to NBoard\n\n* (0) launch NBoard from command line(need environment variables like PATH)\n  * ex) `java -jar \u002FApplications\u002FNBoard\u002Fnboard-2.0.jar`\n* (1) select menu `Engine -> Select Opponent...`\n* (2) clike button `Add Engine`\n* (3) set parameter:\n  * `Name` = `RAZ` (for example)\n  * `Working Directory` = PATH TO THIS PROJECT\n  * `Command` = `nboard_engine` or `bash nboard_engine`. If you want to specify config type, `nboard_engine -c config\u002Fch5.yml`.\n  \n* (4) Engine Level N is set as `simulation_num_per_move=N*20`\n\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmokemokechicken_reversi-alpha-zero_readme_ce026be4841e.png\" width=\"50%\">\n\n### convenient way to evaluate your model\n\nNBoard cannot play with two different engines (maybe).\nHowever, it can select different engines of play-engine and analysis-engine.\n\nSo, convenient way to evaluate your model is for example,\n\n* select this engine as play-engine (or analysis-engine), another engine as analysis-engine (or play-engine).\n* check menu `View -> Highlight Best Move`\n* start `User plays Black`(or White)\n* You simply choose the best move of analysis-engine.\n\nI have little confidence about `hint` protocol as analysis-engine (there is odd behavior),\nbut work in my environment.\n\nAuto Evaluation with other reversi AIs\n----------------\n\n[reversi-arena](https:\u002F\u002Fgithub.com\u002Fmokemokechicken\u002Freversi-arena) is a system for evaluating reversi AIs which implement NBoard Protocol.\nIt is useful when playing many games with strong AI like NTest.\n\n\nView Training Log in TensorBoard\n----------------\n\n### 1. install tensorboard\n\n```bash\npip install tensorboard\n```\n\n### 2. launch tensorboard and access by web browser\n\n```bash\ntensorboard --logdir logs\u002Ftensorboard\u002F\n```\n\nAnd access `http:\u002F\u002F\u003CThe Machine IP>:6006\u002F`.\n\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmokemokechicken_reversi-alpha-zero_readme_d0bfd7dc66d5.png\">\n\n### Trouble Shooting\n\nIf you can not launch tensorboard by error,\ntry to create another new plain project which includes only `tensorflow` and `tensorboard`.\n\nAnd\n\n```bash\ntensorboard --logdir \u003CPATH TO REVERSI DIR>\u002Flogs\u002Ftensorboard\u002F\n```\n\n\nTips and Memo\n====\n\nGPU Memory\n----------\n\nIn my environment of GeForce GTX 1080, memory is about 8GB, so sometimes lack of memory happen.\nUsually the lack of memory cause warnings, not error.\nIf error happens, try to change `per_process_gpu_memory_fraction` in `src\u002Fworker\u002F{evaluate.py,optimize.py,self_play.py}`,\n\n```python\ntf_util.set_session_config(per_process_gpu_memory_fraction=0.2)\n```\n\nLess batch_size will reduce memory usage of `opt`.\nTry to change `TrainerConfig#batch_size` in `NormalConfig`.\n\nTraining Speed\n------\n\n* CPU: 8 core i7-7700K CPU @ 4.20GHz\n* GPU: GeForce GTX 1080\n* 1 game in Self-Play: about 10~20 sec (simulation_num_per_move = 100, thinking_loop = 1).\n* 1 step(mini-batch, batch size=512) in Training: about 1.8 sec.\n","关于\n=====\n\n基于[AlphaGo Zero](https:\u002F\u002Fdeepmind.com\u002Fblog\u002Falphago-zero-learning-scratch\u002F)方法的黑白棋强化学习。\n\n@mokemokechicken 的训练历史请参见[挑战历史](challenge_history.md)。\n\n如果您能分享自己的成果，欢迎将其发布到[性能报告](https:\u002F\u002Fgithub.com\u002Fmokemokechicken\u002Freversi-alpha-zero\u002Fissues\u002F40)中。\n\n环境\n-----------\n\n* Python 3.6.3\n* tensorflow-gpu: 1.3.0 (+)\n  * tensorflow==1.3.0 也可以，但速度非常慢。在使用 `play_gui` 时，CPU 版本的 TensorFlow 就足够快了。\n* Keras: 2.0.8 (+)\n\n模块\n-------\n\n### 强化学习\n\n这个 AlphaGo Zero 实现由三个工作进程组成：`self`、`opt` 和 `eval`。\n\n* `self` 是自我对弈进程，通过使用最佳模型进行自我对弈来生成训练数据。\n* `opt` 是训练进程，用于训练模型并生成下一代模型。\n* `eval` 是评估进程，用于评估下一代模型是否优于当前的最佳模型。如果更好，则替换最佳模型。\n  * 如果 `config.play.use_newest_next_generation_model = True`，则此进程将不再需要。（这是 AlphaZero 方法）\n\n### 评估\n\n为了评估，您可以使用最佳模型与之对弈。\n\n* `play_gui` 是使用 wxPython 与最佳模型对战的游戏界面。\n\n数据\n-----\n\n* `data\u002Fmodel\u002Fmodel_best_*`: 最佳模型。\n* `data\u002Fmodel\u002Fnext_generation\u002F*`: 下一代模型。\n* `data\u002Fplay_data\u002Fplay_*.json`: 生成的训练数据。\n* `logs\u002Fmain.log`: 日志文件。\n\n如果您想从头开始训练模型，请删除上述目录。\n\n使用方法\n==========\n\n设置\n-------\n### 安装库\n```bash\npip install -r requirements.txt\n```\n\n### 使用 Anaconda 安装库\n```bash\ncp requirements.txt conda-requirements.txt\n```\n* 注释掉 `jedi`、`Keras`、`parso`、`python-dotenv`、`tensorflow-tensorboard`、`wxPython` 等库的行。\n* 将 `ipython-genutils`、`jupyter-*`、`prompt-toolkit` 等库中的 `-` 替换为 `_`。\n```bash\nconda env create -f environment.yml\nsource activate reversi-a0\nconda install --yes --file conda-requirements.txt\n```\n\n如果您想使用 GPU，\n\n```bash\npip install tensorflow-gpu\n```\n\n### 设置环境变量\n创建 `.env` 文件，并写入以下内容：\n\n```text:.env\nKERAS_BACKEND=tensorflow\n```\n\nWindows 设置 \n-------------\n本说明由 @GCRhoads 提供，感谢！\n\n### 必需：64位 Windows\n\n##### 此步骤已在 Windows 8.1 上验证。尚未在其他版本上测试。\n\n注意：Windows 路径名使用反斜杠而非正斜杠。\n\n1. 如有必要，将“src\\reversi_zero\\agent\\player.py”文件的第一行修改为：\n**from asyncio.futures import Future**\n\n2. **安装 64 位版本的 Python 3.5**（32 位版本不满足要求）。您有两种选择：\n   - [**直接下载页面**](https:\u002F\u002Fwww.python.org\u002Fdownloads\u002Frelease\u002Fpython-352\u002F)\n   - **推荐使用包含 Python 3.5 的 Anaconda** [安装说明](https:\u002F\u002Fdocs.anaconda.com\u002Fanaconda\u002Ffaq#how-do-i-get-anaconda-with-python-3-5)\n\n**注意:** 由于某种原因，Python 3.5 和 Anaconda 都会被安装在一个隐藏文件夹中。要访问它们，您需要首先进入控制面板，选择文件夹选项，在“查看”选项卡中，点击“高级设置”部分中“显示隐藏的文件、文件夹或驱动器”旁边的圆圈。Anaconda 会安装在 C:\\ProgramData\\Anaconda3\\ 目录下。而直接下载的 Python 则会安装在 (我认为是) C:\\Users\\\\\u003C您的用户名>\\AppData\\Local\\Program\\Python\\ 目录中。\n\n3. **安装 Visual C++ 2015 构建工具。** 您可以安装完整的 Visual Studio 2015 版本（而不是微软试图强加给您的 2017 版本），但这将是一个庞大的下载和安装过程，其中大部分内容您并不需要。[下载 Visual C++ 构建工具](http:\u002F\u002Fgo.microsoft.com\u002Ffwlink\u002F?LinkId=691126)。双击下载的文件以运行安装程序。\n\n4. **将所有 f-string 替换为 string.format()。** 该项目的 Python 源代码大量使用了 f-string，这是 Python 3.6 才引入的新特性。由于我们需要的是 Python 3.5（Windows 版本的 TensorFlow 要求），请使用编辑器的搜索功能找到每一个 f-string 的用法，并将其替换为 string.format()。\n\n5. **安装所需的库。** 无论是从 Anaconda 提示符还是从您放置本项目的顶级文件夹中的命令窗口，输入以下命令：\n\n```bash\npip install -r requirements.txt\n```\n\n6. **安装 TensorFlow**\n\n如果您拥有与 TensorFlow 兼容的 GPU（请参阅 TensorFlow 官网上的兼容列表），那么安装 GPU 版本将使代码运行得更快。要安装 GPU 版本，请在 Anaconda 提示符或命令窗口中输入以下命令：\n\n```bash\npip3 install --upgrade tensorflow-gpu\n```\n\n如果您没有兼容的 GPU，则只能使用较慢的仅 CPU 版本。要安装此版本，请在 Anaconda 提示符或命令窗口中输入以下命令：\n\n```bash\npip3 install --upgrade tensorflow\n```\n\n7. **设置环境变量。** 创建一个 `.env` 文件，并在其中写入以下内容：\n\n```text:.env\nKERAS_BACKEND=tensorflow\n```\n\n现在您就可以开始了。\n\n最强模型\n---------------\n目前，“challenge 5 model”和“ch5 config”是我训练出的最强模型。如果您想使用它进行对弈，\n\n```bash\nrm -rf data\u002Fmodel\u002Fnext_generation\u002F\nsh .\u002Fdownload_model.sh 5\n# 以 wxPython GUI 运行\npython src\u002Freversi_zero\u002Frun.py play_gui -c config\u002Fch5.yml\n```\n\n如果您想将其用作 NBoard 引擎（见下文“作为 NBoard2.0 引擎运行”），请使用命令 `nboard_engine -c config\u002Fch5.yml`。\n\n过往模型\n------------\n如果您想使用 `data\u002Fmodel\u002Fmodel_best_*` 中的最佳模型，请先移除（或重命名）`data\u002Fmodel\u002Fnext_generation\u002F` 目录。\n\n### 下载已训练的最佳模型\n\n例如，下载由下方挑战 1 训练的最佳模型：\n\n```bash\nsh .\u002Fdownload_best_model.sh\n```\n\n### 下载最新训练的模型\n\n将挑战 2、3、4、5 训练的最新模型下载为最佳模型：\n\n```bash\nsh .\u002Fdownload_model.sh \u003C版本>\n```\n\n例如：\n\n```bash\nsh .\u002Fdownload_model.sh 5\n```\n\n配置\n--------------\n\n### “AlphaGo Zero”方法与“AlphaZero”方法\n\n我认为“AlphaGo Zero”和“AlphaZero”的主要区别在于是否使用 `eval` 进程。可以通过配置来切换这两种方法。\n\n#### AlphaGo Zero 方法\n\n* `PlayConfig#use_newest_next_generation_model = False`\n* `PlayWithHumanConfig#use_newest_next_generation_model = False`\n* 执行 `Evaluator` 进程以选择最佳模型。\n\n#### AlphaZero 方法\n\n* `PlayConfig#use_newest_next_generation_model = True`\n* `PlayWithHumanConfig#use_newest_next_generation_model = True`\n* 不使用 `Evaluator` 进程（最新的模型将被选为自我对弈的模型）。\n\n### 自我对弈中的策略分布\n\n在 DeepMind 的论文中，自我对弈保存的策略数据似乎按照 pow(N, 1\u002Ftau) 的比例分布。在对局中后期，tau 会变为 0，此时策略分布变为 one-hot 形式。\n\n`PlayDataConfig#save_policy_of_tau_1 = True` 表示保存的策略始终使用 tau=1。\n\n## 其他重要超参数（我认为）\n\n如果你找到了一组好的参数，请在 GitHub 的 Issues 中分享！\n\n### PlayDataConfig\n\n* `nb_game_in_file,max_file_num`: 训练数据的最大游戏数量为 `nb_game_in_file * max_file_num`。\n* `multi_process_num`: 用于生成自我对弈数据的进程数。\n\n### PlayConfig, PlayWithHumanConfig\n\n* `simulation_num_per_move`：每步的 MCTS 次数。\n* `c_puct`: MCTS 中价值网络和策略网络的平衡参数。\n* `resign_threshold`: 投子阈值。\n* `parallel_search_num`: MCTS 中速度与准确性的平衡参数（？）。\n  * `prediction_queue_size` 应该等于或大于 `parallel_search_num`。\n* `dirichlet_alpha`: 自我对弈中的随机参数。\n* `share_mtcs_info_in_self_play`: 额外选项。如果为真，则在自我对弈的不同游戏中共享 MCTS 树节点信息。\n  * `reset_mtcs_info_per_game`: 共享 MCTS 信息的重置时机。\n* `use_solver_turn`, `use_solver_turn_in_simulation`: 从这一回合开始使用解算器。如果为 `None`，则不使用。\n\n### TrainerConfig\n\n* `wait_after_save_model_ratio`: 如果大于 0，优化器会在每次保存模型后，等待相当于保存间隔比例的时间。这在你用同一块 GPU 同时运行“自我对弈”和“优化”时可能会很有用。\n\n基本用法\n--------\n\n要训练模型，需要依次执行“自我对弈”、“训练器”和“评估器”。\n\n自我对弈\n--------\n\n```bash\npython src\u002Freversi_zero\u002Frun.py self\n```\n\n执行时，自我对弈将使用最佳模型开始。如果最佳模型不存在，则会创建一个新的随机模型并将其设为最佳模型。\n\n### 选项\n* `--new`: 创建新的最佳模型。\n* `-c config_yaml`: 指定配置文件路径，以覆盖 `config.py` 的默认设置。\n\n训练器\n-------\n\n```bash\npython src\u002Freversi_zero\u002Frun.py opt\n```\n\n执行时，训练将开始。基础模型将从最近保存的下一代模型中加载。如果不存在，则使用最佳模型。训练后的模型将在每个 epoch 结束后每 2000 步（小批量）保存一次。\n\n### 选项\n* `-c config_yaml`: 指定配置文件路径，以覆盖 `config.py` 的默认设置。\n* `--total-step`: 指定总步数（小批量）。总步数会影响训练的学习率。\n\n评估器\n---------\n\n```bash\npython src\u002Freversi_zero\u002Frun.py eval\n```\n\n执行时，评估将开始。它通过进行约 200 场比赛来评估最佳模型和最新的下一代模型。如果下一代模型获胜，则它将成为最佳模型。\n\n### 选项\n* `-c config_yaml`: 指定配置文件路径，以覆盖 `config.py` 的默认设置。\n\n对弈\n---------\n\n```bash\npython src\u002Freversi_zero\u002Frun.py play_gui\n```\n\n### 注意：Mac pyenv 环境\n\n`play_gui` 使用 `wxPython`。如果你的 Python 环境是在没有 Framework 的情况下构建的，则无法执行。请尝试以下 pyenv 安装选项：\n\n```bash\nenv PYTHON_CONFIGURE_OPTS=\"--enable-framework\" pyenv install 3.6.3\n```\n\n对于 Anaconda 用户：\n```bash\nconda install python.app\npythonw src\u002Freversi_zero\u002Frun.py play_gui\n```\n\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmokemokechicken_reversi-alpha-zero_readme_8d0d5a1869ec.png\" width=\"50%\">\n\n执行时，会显示一个普通的黑白棋棋盘，你可以与最佳模型对弈。在最佳模型走完一步后，棋盘上会显示一些数字。\n* 左上角的数字 (1) 表示上次搜索的“访问次数 (=N(s,a))”。\n* 左下角的数字 (2) 表示上次状态和走法的“AI 方面的 Q 值 (=Q(s,a))”。这些 Q 值被乘以 100。\n\n作为 NBoard 2.0 引擎运行\n--------------\n\n[NBoard](http:\u002F\u002Fwww.orbanova.com\u002Fnboard\u002F) 是一款非常好的黑白棋 GUI，并且拥有强大的黑白棋引擎，可在 Windows、Mac 和 Linux 上运行（需要 JRE）。\n\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmokemokechicken_reversi-alpha-zero_readme_b994ac74080f.png\" width=\"50%\">\n\n它可以添加实现 [NBoard 协议](https:\u002F\u002Fgithub.com\u002Fweltyc\u002Fntest\u002Fblob\u002Fmaster\u002Finstructions\u002FProtocol.htm) 的外部引擎。\n\n### 如何将本模型作为外部引擎添加到 NBoard\n\n* (0) 从命令行启动 NBoard（需要设置 PATH 等环境变量）\n  * 例如：`java -jar \u002FApplications\u002FNBoard\u002Fnboard-2.0.jar`\n* (1) 选择菜单 `Engine -> Select Opponent...`\n* (2) 点击按钮 `Add Engine`\n* (3) 设置参数：\n  * `Name` = `RAZ`（例如）\n  * `Working Directory` = 本项目的路径\n  * `Command` = `nboard_engine` 或 `bash nboard_engine`。如果你想指定配置文件类型，可以使用 `nboard_engine -c config\u002Fch5.yml`。\n  \n* (4) 将引擎等级 N 设置为 `simulation_num_per_move=N*20`。\n\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmokemokechicken_reversi-alpha-zero_readme_ce026be4841e.png\" width=\"50%\">\n\n### 评估你的模型的便捷方法\n\nNBoard 似乎不能同时使用两个不同的引擎（可能）。不过，它可以分别选择对弈引擎和分析引擎。\n\n因此，评估你的模型的一个便捷方法是：\n\n* 将本模型设为对弈引擎（或分析引擎），另一个引擎设为分析引擎（或对弈引擎）。\n* 打开菜单 `View -> Highlight Best Move`。\n* 开始让“用户执黑棋”（或白棋）。\n* 你只需选择分析引擎推荐的最佳走法即可。\n\n我对作为分析引擎的 `hint` 协议不太有信心（存在一些奇怪的行为），但在我的环境中可以正常工作。\n\n与其他黑白棋 AI 的自动评估\n----------------\n\n[reversi-arena](https:\u002F\u002Fgithub.com\u002Fmokemokechicken\u002Freversi-arena) 是一个用于评估实现 NBoard 协议的黑白棋 AI 的系统。当需要与像 NTest 这样的强大 AI 进行大量对局时，这个系统非常有用。\n\n在 TensorBoard 中查看训练日志\n----------------\n\n### 1. 安装 tensorboard\n\n```bash\npip install tensorboard\n```\n\n### 2. 启动 tensorboard 并通过浏览器访问\n\n```bash\ntensorboard --logdir logs\u002Ftensorboard\u002F\n```\n\n然后访问 `http:\u002F\u002F\u003C机器IP>:6006\u002F`。\n\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmokemokechicken_reversi-alpha-zero_readme_d0bfd7dc66d5.png\">\n\n### 故障排除\n\n如果由于错误无法启动 tensorboard，请尝试创建一个仅包含 `tensorflow` 和 `tensorboard` 的新项目。\n\n然后运行：\n\n```bash\ntensorboard --logdir \u003CREVERSI 项目路径>\u002Flogs\u002Ftensorboard\u002F\n```\n\n\n提示与备忘录\n====\n\nGPU 内存\n----------\n\n在我的 GeForce GTX 1080 环境中，显存约为 8GB，因此有时会出现显存不足的情况。通常，显存不足只会导致警告，而不会引发错误。如果出现错误，请尝试修改 `src\u002Fworker\u002F{evaluate.py,optimize.py,self_play.py}` 中的 `per_process_gpu_memory_fraction`：\n\n```python\ntf_util.set_session_config(per_process_gpu_memory_fraction=0.2)\n```\n\n减少 batch_size 可以降低 `opt` 的内存使用量。可以尝试在 `NormalConfig` 中调整 `TrainerConfig#batch_size`。\n\n训练速度\n------\n\n* CPU: 8 核 i7-7700K，主频 4.20GHz\n* GPU: GeForce GTX 1080\n* 自我对弈中一局游戏：约 10~20 秒（simulation_num_per_move = 100，thinking_loop = 1）。\n* 训练中一步（小批量，batch size=512）：约 1.8 秒。","# Reversi Alpha Zero 快速上手指南\n\n本项目基于 AlphaGo Zero 算法实现黑白棋（Reversi）的强化学习训练与对战。\n\n## 环境准备\n\n### 系统要求\n*   **操作系统**: Linux \u002F macOS \u002F Windows (64-bit)\n    *   *Windows 用户注意*: 官方验证环境为 Windows 8.1 64-bit。若使用 Windows，需安装 **Python 3.5** (因 TensorFlow GPU 版本限制) 及 **Visual C++ 2015 Build Tools**。此外，需将源码中的 f-string 语法手动改为 `.format()` 以兼容 Python 3.5。\n*   **Python**: 推荐 3.6.3+ (Linux\u002FmacOS); Windows 需 3.5\n*   **硬件**: 推荐使用 NVIDIA GPU 加速训练；仅 CPU 也可运行但速度较慢。\n\n### 前置依赖\n*   TensorFlow (GPU 版推荐): `tensorflow-gpu >= 1.3.0`\n*   Keras: `>= 2.0.8`\n*   wxPython: 用于图形化界面 (`play_gui`)\n\n> **国内加速建议**: 安装依赖时建议使用清华或阿里镜像源，例如：\n> `pip install -r requirements.txt -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple`\n\n---\n\n## 安装步骤\n\n### 1. 克隆项目与安装基础库\n```bash\ngit clone \u003Crepository_url>\ncd reversi-alpha-zero\npip install -r requirements.txt\n```\n\n若需使用 GPU 加速，请单独安装：\n```bash\npip install tensorflow-gpu\n```\n\n### 2. 配置环境变量\n在项目根目录创建 `.env` 文件，写入以下内容以指定后端：\n```text:.env\nKERAS_BACKEND=tensorflow\n```\n\n### 3. Windows 用户额外步骤\n若你在 Windows 上运行，请确保：\n1.  安装 Python 3.5 (64-bit)。\n2.  安装 [Visual C++ 2015 Build Tools](http:\u002F\u002Fgo.microsoft.com\u002Ffwlink\u002F?LinkId=691126)。\n3.  修改 `src\u002Freversi_zero\u002Fagent\u002Fplayer.py` 第一行为：`from asyncio.futures import Future`。\n4.  全局替换代码中的 f-string (如 `f\"{var}\"`) 为 `\"{0}\".format(var)` 格式。\n\n---\n\n## 基本使用\n\n### 1. 下载预训练模型（可选）\n若想直接体验最强模型或从断点继续，可下载已有模型。\n下载最强模型 (Challenge 5):\n```bash\nsh .\u002Fdownload_model.sh 5\n```\n下载基础最佳模型:\n```bash\nsh .\u002Fdownload_best_model.sh\n```\n*(Windows 用户若无 bash 环境，可手动下载对应文件至 `data\u002Fmodel\u002F` 目录)*\n\n### 2. 开始自我对弈生成数据 (Self-Play)\n启动自我对弈进程，利用当前最佳模型生成训练数据。若无模型，会自动创建随机模型。\n```bash\npython src\u002Freversi_zero\u002Frun.py self\n```\n*   `--new`: 强制创建新的随机最佳模型。\n*   `-c config\u002Fch5.yml`: 指定配置文件。\n\n### 3. 训练模型 (Trainer)\n启动训练进程，利用生成的数据进行模型迭代。\n```bash\npython src\u002Freversi_zero\u002Frun.py opt\n```\n*   `--total-step 10000`: 指定总训练步数。\n\n### 4. 评估模型 (Evaluator)\n评估新一代模型是否优于当前最佳模型（AlphaGo Zero 模式需要此步骤）。\n```bash\npython src\u002Freversi_zero\u002Frun.py eval\n```\n\n### 5. 图形化对战 (Play GUI)\n启动图形界面，人类玩家可与最佳模型对战。\n```bash\npython src\u002Freversi_zero\u002Frun.py play_gui\n```\n*   **Mac 用户注意**: 若报错，可能需要重装支持 Framework 的 Python：\n    `env PYTHON_CONFIGURE_OPTS=\"--enable-framework\" pyenv install 3.6.3`\n*   **Anaconda 用户**: 建议使用 `pythonw src\u002Freversi_zero\u002Frun.py play_gui`。\n\n界面说明：\n*   左上角数字：访问次数 (Visit Count)。\n*   左下角数字：Q 值 (胜率评估，已乘以 100)。\n\n### 6. 接入 NBoard 引擎 (高级)\n若需在专业的 NBoard 软件中运行此 AI：\n```bash\n# 在 NBoard 中添加引擎命令\nnboard_engine -c config\u002Fch5.yml\n```","某高校人工智能实验室的研究团队正致力于复现 AlphaGo Zero 算法，并计划将其迁移到黑白棋（Reversi）领域以验证强化学习在完全信息博弈中的泛化能力。\n\n### 没有 reversi-alpha-zero 时\n- **架构从零搭建**：研究人员需手动编写自我对弈（Self-Play）、模型训练（Trainer）和评估（Evaluator）三个核心模块的交互逻辑，极易出现状态同步错误。\n- **数据生成低效**：缺乏自动化的对弈数据生成机制，团队只能依赖人工编写规则引擎或爬取少量历史棋谱，导致训练数据匮乏且多样性不足。\n- **迭代验证困难**：没有内置的“新一代模型 vs 最佳模型”自动评估流程，每次算法改进后需人工设计测试用例，难以量化模型是否真正进化。\n- **环境配置繁琐**：在 Windows 等复杂环境下，协调 TensorFlow、Keras 与特定 Python 版本的依赖关系耗时耗力，常因环境报错中断实验。\n\n### 使用 reversi-alpha-zero 后\n- **开箱即用架构**：直接复用其成熟的 `self`、`opt`、`eval` 三 worker 协作架构，研究重心可立即从工程实现转向算法策略优化。\n- **自动化数据闭环**：利用 `self` 模块驱动 BestModel 进行高强度自我对弈，自动生成海量高质量 JSON 格式训练数据，彻底解决数据瓶颈。\n- **智能模型迭代**：通过 `eval` 模块自动执行新模型与当前最强模型的对抗赛，仅当胜率提升时自动替换 BestModel，实现了无人值守的持续进化。\n- **可视化对战调试**：借助 `play_gui` 图形界面，研究人员可实时观察模型决策过程并与最强模型人机对战，直观分析策略缺陷。\n\nreversi-alpha-zero 将原本需要数周搭建的强化学习基础设施缩短为几小时的配置工作，让研究者能专注于探索算法边界而非重复造轮子。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmokemokechicken_reversi-alpha-zero_b994ac74.png","mokemokechicken","Ken Morishita ","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fmokemokechicken_a65697fd.png","森下 健","https:\u002F\u002Fwww.sprocket.bz\u002F","Tokyo, Japan","mokemokechicken@gmail.com",null,"http:\u002F\u002Ftwitter.com\u002Fmokemokechicken","https:\u002F\u002Fgithub.com\u002Fmokemokechicken",[86,90,94],{"name":87,"color":88,"percentage":89},"Python","#3572A5",92.1,{"name":91,"color":92,"percentage":93},"Jupyter Notebook","#DA5B0B",7.2,{"name":95,"color":96,"percentage":97},"Shell","#89e051",0.7,686,167,"2026-03-19T12:47:12","MIT",4,"Linux, macOS, Windows","非必需。支持 NVIDIA GPU (需安装 tensorflow-gpu)，若无 GPU 可使用 CPU 版本 (tensorflow)，但在训练时速度较慢。具体显卡型号、显存大小及 CUDA 版本未在文档中明确说明，但基于 TensorFlow 1.3.0 推测需较旧的 CUDA 版本 (如 CUDA 8.0\u002F9.0)。","未说明",{"notes":107,"python":108,"dependencies":109},"1. Windows 用户需注意：由于 TensorFlow 1.3.0 的限制，必须使用 64 位 Python 3.5，且需要手动将代码中的 f-string 语法改写为 string.format()，并安装 Visual C++ 2015 构建工具。2. macOS 用户若使用 pyenv 运行 GUI (play_gui)，安装 Python 时需添加 '--enable-framework' 选项，或使用 Anaconda 的 pythonw 启动。3. 项目包含 Self-Play、Trainer 和 Evaluator 三个主要工作模块，可通过配置文件切换 AlphaGo Zero 或 AlphaZero 模式。4. 若需从头训练，需删除 data 目录下的模型和数据文件。","3.6.3 (Windows 环境下因 TensorFlow 限制需使用 Python 3.5)",[110,111,112,113,114],"tensorflow-gpu>=1.3.0","Keras>=2.0.8","wxPython","numpy","h5py",[13],[117,118,119,120,121,122,123],"reinforcement-learning","deeplearning","alphago-zero","keras","tensorflow","machine-learning","reversi","2026-03-27T02:49:30.150509","2026-04-06T12:16:00.287765",[127,132,137,142,146,151,155,160],{"id":128,"question_zh":129,"answer_zh":130,"source_url":131},18914,"并行进程中使用相同的随机种子会导致什么问题？","如果每个并行进程或线程共享相同的随机种子，它们将生成相同的伪随机序列，导致状态转移等模拟结果完全一致（确定性行为），从而 nullify 多线程\u002F多进程带来的多样性优势。虽然由于执行速度差异可能在后期出现不同结果，但最佳实践是为每个子进程设置不同的种子（例如基于进程 ID 或时间戳），以确保真正的随机性和探索多样性。","https:\u002F\u002Fgithub.com\u002Fmokemokechicken\u002Freversi-alpha-zero\u002Fissues\u002F47",{"id":133,"question_zh":134,"answer_zh":135,"source_url":136},18907,"如何在单机多 GPU 环境下配置自对弈（self-play）以利用所有显卡？","如果在同一台机器上使用多个 GPU，需要为不同的进程指定不同的 GPU ID。可以通过设置环境变量 `CUDA_VISIBLE_DEVICES` 来实现。例如，在一个终端运行优化器：`CUDA_VISIBLE_DEVICES=0 python *** opt ***`，在另一个终端运行自对弈：`CUDA_VISIBLE_DEVICES=1 python **** self ***`。这种架构允许一个 GPU 负责梯度更新，其他 GPU 负责自对弈，权重在每次更新后同步。","https:\u002F\u002Fgithub.com\u002Fmokemokechicken\u002Freversi-alpha-zero\u002Fissues\u002F57",{"id":138,"question_zh":139,"answer_zh":140,"source_url":141},18908,"共享 MCTS 信息（share_mtcs_info_in_self_play）对棋力有何影响？其原理是什么？","共享 MCTS 信息的目的是鼓励在困难局面（即多个着法的访问次数 N 和胜率 W 几乎相同）下探索不同的着法。通过共享信息，下一局游戏中处于劣势的一方会因为知道之前的着法不好而倾向于选择其他着法，类似于国际象棋的“死后分析”（post mortem）。虽然这在一定程度上实现了目标，但也确实会抑制探索性。目前实现中，共享信息每 N 局（当前设为 5 局）重置一次。","https:\u002F\u002Fgithub.com\u002Fmokemokechicken\u002Freversi-alpha-zero\u002Fissues\u002F43",{"id":143,"question_zh":144,"answer_zh":145,"source_url":141},18909,"共享 MCTS 信息是否会显著增加内存占用？","不会显著增加内存占用。因为该机制只是更新父节点（及祖先节点）的访问次数 N 或胜率 W，并没有存储额外的庞大数据结构。",{"id":147,"question_zh":148,"answer_zh":149,"source_url":150},18910,"在 Mac 上运行 GUI 时报错\"This program needs access to the screen\"怎么办？","该错误是因为程序无法访问屏幕缓冲区。解决方法是使用 Python 的 Framework 构建版本运行程序，并且确保你已登录到 Mac 的主显示器会话中。普通的命令行 Python 环境可能没有权限访问 GUI 所需的屏幕资源。","https:\u002F\u002Fgithub.com\u002Fmokemokechicken\u002Freversi-alpha-zero\u002Fissues\u002F19",{"id":152,"question_zh":153,"answer_zh":154,"source_url":150},18911,"如何消除 TensorFlow 关于 CPU 指令集（SSE4.2, AVX）的警告信息？","这些警告表明当前安装的 TensorFlow 库未针对你的机器可用的 SSE4.2 和 AVX 指令集进行编译，虽然不影响运行，但会损失部分 CPU 计算速度。要消除警告并提升性能，需要重新编译 TensorFlow 以启用这些指令集，或者寻找已经针对你的 CPU 架构优化过的预编译二进制文件。如果仅想忽略警告，可以在代码中设置日志级别过滤掉 WARNING 级别的输出。",{"id":156,"question_zh":157,"answer_zh":158,"source_url":159},18912,"是否应该为双方都设置认输条件（例如当预测胜率 > 0.8 时）？","实际上不需要显式地为双方都设置认输条件。在自对弈过程中，由于双方使用相同的模型，当一方的模型预测状态值低于负阈值（如 -0.8）从而认输时，另一方的模型自然会预测状态值高于正阈值（如 0.8）。因此，现有的单侧认输设计已经隐含地处理了双方局势悬殊的情况。","https:\u002F\u002Fgithub.com\u002Fmokemokechicken\u002Freversi-alpha-zero\u002Fissues\u002F11",{"id":161,"question_zh":162,"answer_zh":163,"source_url":164},18913,"预测工作器（prediction worker）在调用 API 时是否应该使用 await？","关键点在于预测工作器在调用 `api#predict()` 时不应阻塞等待（not awaiting）。如果错误地使用了 await 导致阻塞，会严重影响并发性能。确保异步调用正确执行是提升推理速度的关键。","https:\u002F\u002Fgithub.com\u002Fmokemokechicken\u002Freversi-alpha-zero\u002Fissues\u002F42",[]]