linyiLYi / snake-ai

An AI agent that beats the classic game "Snake".
Apache License 2.0
1.59k stars 352 forks source link

怎么让训练过程可视化呢? #14

Open zjhcwjb opened 1 year ago

zjhcwjb commented 1 year ago

Using cuda device Wrapping the env in a VecTransposeImage. 一直卡在这

lang07123 commented 1 year ago

需要修改这个参数 图片

但是貌似... pygame无法在 多线程情况下使用...会提示报错.. 图片

Those errors suck. Basically you can't run multipeocessing and pass in fancy objects like the pygame object. There is probably a way around it.

Multiprocessor will serialised data to pickle format internally. You can't pickle that pygame object!

https://www.reddit.com/r/learnpython/comments/az42d4/how_to_use_multiprocessing_with_pygame/

zjhcwjb commented 1 year ago
嗯嗯 感谢我试了一下改完静音模式的参数后再运行train_cnn弹出了游戏窗口但还是黑屏状态并没有报错  从 Windows 版邮件发送 发件人: lang07123发送时间: 2023年5月31日 17:15收件人: linyiLYi/snake-ai抄送: zjhcwjb; Author主题: Re: [linyiLYi/snake-ai] 怎么让训练过程可视化呢? (Issue #14) 需要修改这个参数但是貌似... pygame无法在 多线程情况下使用...会提示报错..Those errors suck. Basically you can't run multipeocessing and pass in fancy objects like the pygame object. There is probably a way around it. Multiprocessor will serialised data to pickle format internally. You can't pickle that pygame object!https://www.reddit.com/r/learnpython/comments/az42d4/how_to_use_multiprocessing_with_pygame/—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***> 
linyiLYi commented 1 year ago

如果想看训练过程中的参数,可以把 train.py 结尾部分 sys.stdout 的部分注释掉。我把训练参数都输出到了 training_log.txt 文件里以便后续查阅,把这部分注释掉,数据就会显示在终端上了。如果想看训练曲线,可以使用 tensorboard。silent_mode 在训练时是不能改成 False 的,因为训练时要尽可能快速运行游戏,如果每帧都渲染出来,会极大地影响训练速度。