{"id":19287354,"url":"https://github.com/opendilab/di-sheep","last_synced_at":"2025-05-15T23:04:12.572Z","repository":{"id":60109413,"uuid":"539488728","full_name":"opendilab/DI-sheep","owner":"opendilab","description":"羊了个羊 + 深度强化学习（Deep Reinforcement Learning + 3 Tiles Game)","archived":false,"fork":false,"pushed_at":"2025-03-10T01:41:45.000Z","size":19736,"stargazers_count":448,"open_issues_count":0,"forks_count":25,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-12T18:47:32.964Z","etag":null,"topics":["artificial-intelligence","deep-reinforcement-learning","di-engine","javascript","python","react","reinforcement-learning","typescript"],"latest_commit_sha":null,"homepage":"https://opendilab.net/sheep","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/opendilab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-21T12:56:14.000Z","updated_at":"2025-04-10T13:55:49.000Z","dependencies_parsed_at":"2025-03-29T16:01:37.478Z","dependency_job_id":"82259b1b-425e-49c2-a168-e2e9cdba8acc","html_url":"https://github.com/opendilab/DI-sheep","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opendilab%2FDI-sheep","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opendilab%2FDI-sheep/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opendilab%2FDI-sheep/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opendilab%2FDI-sheep/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/opendilab","download_url":"https://codeload.github.com/opendilab/DI-sheep/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254436944,"owners_count":22070946,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["artificial-intelligence","deep-reinforcement-learning","di-engine","javascript","python","react","reinforcement-learning","typescript"],"created_at":"2024-11-09T22:05:55.074Z","updated_at":"2025-05-15T23:04:12.546Z","avatar_url":"https://github.com/opendilab.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DI-sheep：深度强化学习 + 羊了个羊\n\n当 AI 技术的明珠——深度强化学习，遇到号称“通关率只有0.01%”的游戏“羊了个羊”，会碰撞出哪些奇思妙想呢？\n\nP.S. 路过记得点个 star ![stars - di-sheep](https://img.shields.io/github/stars/opendilab/di-sheep?style=social) ，持续更新ing。\n\nP.S.S. 想了解更多深度强化学习相关知识？快来 [DI-engine](https://github.com/opendilab/DI-engine) 训练自己的智能体。\n\n\u003cdiv align=\"center\"\u003e\n    \u003ca href=\"https://github.com/opendilab/DI-sheep\"\u003e\u003cimg width=\"500px\" height=\"auto\" src=\"https://github.com/opendilab/DI-sheep/blob/master/ui/public/demo.gif\"\u003e\u003c/a\u003e\n\u003c/div\u003e\n\n# News\n- [bilibili] [羊群加不进去？那就来加猫群叭！深度强化学习版的羊了个羊来了](https://www.bilibili.com/video/BV1N24y1o7Lw/?spm_id_from=333.999.0.0)\n- [WeChat] [万事开头难？喵小DI玩“羊了个羊”可不难](https://mp.weixin.qq.com/s/4Z3WtkcWRp6x4x60RVELfQ)\n\n# 使用指南\n\n## 算法原理解析\n![disheep drawio](https://user-images.githubusercontent.com/33195032/191955286-7c309e9d-6e35-491f-93b3-b14cd1fe033f.png)\n\n## 快速上手\n\n- 如果想**在线试玩** --\u003e [在线网页（改进中）](https://opendilab.net/sheep)\n- 如果想**本地部署/测试**\n  - 服务端（Python）\n    ```shell\n    # 预先安装好 Python3\n    cd service\n    pip install -r requirement.txt\n    FLASK_APP=app.py flask run  # 玩家试玩\n    # FLASK_APP=agent_app.py flask run  # 玩家 + AI 试玩\n    ```\n  - 客户端（react）\n    ```shell\n    # 预先安装好 node.js 和 react\n    cd ui\n    npm run build\n    npm run preview\n    ```\n    然后在网页中打开对应链接即可\n- 如果想进行完整的深度强化学习训练\n    ```shell\n    # 预先安装好 Python3\n    cd service\n    pip install -r requirement-train.txt\n    python3 -u sheep_ppo_main.py\n    ```\n- 如果想使用定义好的 gym 羊了个羊环境 --\u003e 点个 star 之后直接暴力 CTRL C+V 拿走 `service/sheep_env.py` 尽情魔改\n- 如果想获得训练好的深度强化学习模型 --\u003e 访问 [OpenDILab HuggingFace仓库](https://huggingface.co/OpenDILabCommunity/DI-sheep/tree/main) （目前提供了两种试玩模型，但智能体仍有很多进步空间）\n- 如果想了解更多深度强化学习相关知识 --\u003e 欢迎参阅 [DI-engine](https://github.com/opendilab/DI-engine) 和[相关文档](https://di-engine-docs.readthedocs.io/zh_CN/latest/)\n- 如果想了解未来的更新计划 --\u003e 请参阅[更新计划](#更新计划)\n- 如果有其他问题或想法 --\u003e 欢迎 github ISSUE 区讨论，或是贡献 Pull requests\n\n## 项目结构\n```text\n.\n├── LICENSE\n├── ui                       --\u003e react 网页前端\n└── service                  --\u003e Python 核心模块（算法和服务端）\n    ├── app.py                  --\u003e flask 服务 app (仅人类操作)\n    ├── agent_app.py                  --\u003e flask 服务 app（人类+AI操作）\n    ├── requirement.txt         --\u003e Python 依赖库列表\n    ├── sheep_env.py            --\u003e gym 格式环境\n    ├── sheep_model.py          --\u003e 基于 PyTorch 的 Actor-Critic 神经网络模型\n    ├── sheep_ppo_main.py       --\u003e 基于 DI-engine 的深度强化学习训练主函数\n    ├── test_sheep_env.py       --\u003e gym 格式环境的单元测试\n    └── test_sheep_model.py     --\u003e 神经网络模型的单元测试\n```\n\n\n\n# 更新计划\n\n## 算法\n\n- [ ] 强化学习训练参数调整和算法微调\n- [ ] 提供可供本地试玩的模型权重\n- [ ] 详细的神经网络和强化学习算法设计文档\n- [ ] model-based RL 和 planning 算法\n- [ ] 神经网络压缩（用于部署） \n\n## 环境\n- [ ] 添加原类型游戏（比如3tiles）中的各种道具\n- [ ] 牌的层数问题如何定义\n- [ ] 结合 JAX 优化环境运行速度\n- [ ] 更多结合 AI 的玩法设计\n\n\n## 应用\n- [x] 更多自定义主题和 BGM\n- [x] 在线网页端部署\n- [x] 样例神经网络权重下载\n- [ ] 更多 AI 训练时的行为分析\n- [ ] 移动端应用（欢迎Android/IOS开发者支持）\n\n\n# 致谢\n- react 前端部分主要参考 https://github.com/StreakingMan/solvable-sheep-game ，请大家也多多支持这个 repo \n\n\n# License\nDI-sheep is released under the Apache 2.0 license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopendilab%2Fdi-sheep","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopendilab%2Fdi-sheep","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopendilab%2Fdi-sheep/lists"}