datamllab / rlcard-showdown

Leaderboard and Visualization for RLCard
352 stars 95 forks source link

Can not run rlcard-showdown #42

Closed jeremy-feng closed 1 year ago

jeremy-feng commented 1 year ago

您好!非常感谢您开发的 rlcard 和 rlcard-showdown 工具。我正在用 rlcard-showdown 将自己训练的扑克机器人进行可视化,但一直没有成功搭建起 rlcard-showdown 的环境。

我使用过本地的 Mac OS 系统,但由于网络问题,下载依赖的速度太慢,于是我选择使用 gitpod.io 这个云代码平台。我按照 https://github.com/datamllab/rlcard-showdown#installationhttps://github.com/datamllab/rlcard-showdown/issues/41gitpod.io 上尝试了搭建了很多次,得到的结果基本都是:

  1. cd pve_server 再 python3 manage.py runserver 开启 8000 端口后,显示 Page not found。

    image
  2. cd pve_server 再 python3 run_dmc.py 开启 5000 端口后,显示 Not Found The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.

    image
  3. 使用 node v10,再 npm start 开启 3000 端口后,能看到主页界面,但 LAUNCH TOURNAMENT 后显示 Failed to launch tournament,并且 UPLOAD MODEL 也显示 Failed to upload model image

    image

请问是否可以再提供一些安装指引?如果能在 gitpod.io 这个平台上跑通也好哇。非常感谢!

jeremy-feng commented 1 year ago

非常非常感谢 @hsywhu 和 @daochenzha 提供的热心协助,这个困扰了我几天的问题终于被解决了。我梳理了安装过程中遇到的问题,希望能为大家提供一些帮助。

  1. https://github.com/datamllab/rlcard-showdown/issues/41 的讨论,我们应该使用 node.js v10。安装方法为:

    1. 安装 nvm ,若已经安装了 nvm 则可以跳过此步。先到 https://github.com/nvm-sh/nvm/releases 下载 Source Code,解压后将 install.sh 拖动到终端。

      image-20230520001855672
    2. 安装 node.js v10,这一步可能因网络原因比较慢。这一步可能还会遇到其他问题,例如 nvm: install v10.24.1 failed!,可以参考 https://blog.csdn.net/csdn_haow/article/details/126587637Version 'v10' not found - trynvm ls-remoteto browse available versions.,可以参考:https://stackoverflow.com/a/62983482/

      nvm install v10
      image-20230520004725797
    3. 切换到 node.js v10nvm use 10

      image-20230520004837669
  2. 此时检查 nodenvm 的版本:

    node -v
    npm -v
    image-20230520005627098
  3. 进入 rlcard-showdown 目录。安装前端依赖:

    npm install

    若报错,提示版本冲突(很可能是因为之前没在 node.js v10 下就开始使用 npm instal 导致的),则可以参照报错消息用 npm install --force

  4. 进入 rlcard-showdown 目录。安装 Python 依赖:

    pip3 install -r requirements.txt

    注意,这里建议卸载 flask 后重新安装 flask,否则后面在启动 5000 端口时可能会出现 flask 的错误。

    image-20230520012528841

    解决方案:

    pip uninstall flask
    pip install flask
  5. 进入 rlcard-showdown/server 目录。运行:

    python3 manage.py migrate
  6. 进入 rlcard-showdown/server 目录。在 8000 端口运行后端服务:

    cd server
    python3 manage.py runserver

    看到 Page not found (404),是正常的。

    image-20230520011801958
  7. 进入 rlcard-showdown/pve_server 目录。在 5000 端口运行服务(需要先下载预训练模型,在 [Google Drive](https://drive.google.com/file/d/1zx-20xNBDbCFd8GWhZFUkl07lofbNHpy/view?usp=sharing) or [百度网盘](https://pan.baidu.com/s/12MgxVBBz4mgitT74quSWfw) 提取码: qh6s,并解压到 rlcard-showdown/pve_server/pretrained):

    cd pve_server
    python3 run_douzero.py

    同样看到 Not Found,也是正常的。

    image-20230520012931318

    如果你想在本地运行人机交互的斗地主,可以在浏览器中输入:

    http://127.0.0.1:3000/pve/doudizhu-demo

    就可以在本地实现和 https://douzero.org/ 一样的效果了。

    image-20230520014838238
  8. 新建终端,进入 rlcard-showdown 目录(注意是在 rlcard-showdown 目录 新建终端,而不是在 rlcard-showdown/server 下)。在 3000 端口查看 leaderboard:

    npm start

    你应该能看到图形界面了!

  9. 点击右上角的 LAUNCH TOURNAMENT 即可新建一个锦标赛。

    image-20230520013246898

  10. 点击左边的 Agents,还可以看到各个玩家的对战历史。

    image-20230520013959511 image-20230520013912857
  11. 点击左下角的 UPLOAD MODEL 可以上传自定义的模型。可以先查看 Example 中的 .zip 压缩包,仿照其中的格式,上传自己训练的模型。

    image-20230520013720143