用PARL训练mini-alphaGO

今天尝试用PARL里面的代码跑一下mini-alphago的项目,是torch版本的。

下载代码和数据集

首先下载源代码,下载地址为:

https://github.com/PaddlePaddle/PARL/tree/775a6afe0f1946e40c22206a5b98f81f871eb4ec/benchmark/torch/AlphaZero

这里面的所有python文件都需要下载下来,然后下载数据集,数据集的地址为:
https://www.kaggle.com/petercnudde/1k-connect4-validation-set

把数据集放到你的代码同级的目录就行了

安装环境

我是用的是python3.7,mac

torch              1.4.0
parl               1.4.1
tqdm               4.60.0

建议用anaconda创建一个新的环境,把这三个包安装一下就行了。

训练

xparl start --port 8010 --cpu_num 5

上面的命令执行完以后,输出的日志为:

[04-14 11:53:35 MainThread @logger.py:242] Argv: /Users/wugaosheng/anaconda3/envs/alphago/bin/xparl start --port 8010 --cpu_num 5

            # The Parl cluster is started at localhost:8010.

            # A local worker with 5 CPUs is connected to the cluster.

            # Starting the cluster monitor...


        ## If you want to check cluster status, please view:

            http://172.24.148.88:50351

        or call:

            xparl status

        ## If you want to add more CPU resources, please call:

            xparl connect --address 172.24.148.88:8010

        ## If you want to shutdown the cluster, please call:

            xparl stop

Checking status of log_server...
# Start the log server sucessfully.

然后再执行

python main.py

就可以跑了,输出的日志为:

arning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  self.np_pieces = np.zeros([self.height, self.width], dtype=np.int)
[04-14 11:53:46 MainThread @client.py:431] Remote actors log url: http://172.24.148.88:50351/logs?client_id=172.24.148.88_50454_1618372426
[04-14 11:53:46 MainThread @Coach.py:73] Starting Iter #1 ...
[04-14 11:53:46 MainThread @Coach.py:76] Step1: self-play in parallel...

然后你会发现你的电脑的风扇转速很快,声音变大了,说明正在运行哈。如果想等到训练结束,建议找个好一点的GPU机器哈。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

农民小飞侠

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值