Code Monkey home page Code Monkey logo

mahjong_drl's Introduction

一个基于GPT模型的立直麻将bot

本项目实现了一个基于强化学习的立直麻将智能体,使用深度策略梯度方法(如PPO算法)和GPT模型来进行决策学习。

TODO

重点

  • 代码解耦和风格优化
  • 修复各个逻辑bug并更新默认超参数

部署时

  • 添加实际部署的支持(如雀魂)
  • 考虑在第一层估计枚举联合值函数估计?

环境需求

运行指导

  1. 克隆仓库到本地:
    git clone https://github.com/marko1616/mahjong_DRL
  2. 进入项目目录:
    cd mahjong_DRL
  3. 安装依赖:
    • Torch请自行根据操作系统安装
    pip install -r requirements.txt

使用说明

  1. 启动训练:

    python ppo.py

    这将启动代理的训练过程,训练日志和模型权重会自动保存在指定的目录中(相关超参数调整在各个文件中)。

  2. 监控训练: 使用TensorBoard查看训练进度和性能:

项目结构

  • agent.py: 包含Agent类,实现麻将学习代理的主要功能。
  • model.py: 定义了使用的GPT模型(参考miniGPT)。
  • env.py: 麻将游戏的环境实现。
  • schedulers.py: 实现了用于超参数调度的类。
  • ppo.py: 算法实现,负责启动训练流程。

版权和许可

本项目遵循Apache2.0许可证。详细信息请查看LICENSE文件。

mahjong_drl's People

Contributors

marko1616 avatar

Stargazers

GeekMK avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.