linyiLYi / street-fighter-ai

This is an AI agent for Street Fighter II Champion Edition.
Apache License 2.0
6.3k stars 1.36k forks source link

本项目如何使用GPU进行训练。谢谢各位大佬!大佬发财! #35

Open goliouu opened 1 year ago

goliouu commented 1 year ago

(StreetFighterAI) D:\街霸ai\street-fighter-ai\main>python train.py Using cpu device Wrapping the env in a VecTransposeImage. 目前的训练是使用cpu来进行的,如何使用GPU来进行?

leoz2z commented 1 year ago

同问,本地已安装 tensorflow_gpu,测试脚本是能看到 gpu。 train.py,有将 device设置成 cuda,但是还是没有效果。 image

leoz2z commented 1 year ago

进入PPO文件可以看到,引入了 torch,所以需要再conda环境里面,安装torch,否则会默认 cpu 训练。 安装torch方法,要注意你本地 cuda 版本,版本对应关系如下:https://pytorch.org/get-started/previous-versions/

最后加一段测试代码,到 ppo.py,可以查看GPU是否启用。

if th.cuda.is_available(): print("CUDA is available!") else: print("CUDA is not available.")

执行结果如下: image

tonyxu99 commented 1 year ago

先看看PyTorch支不支持你的GPU。估计AMD的没戏。我在Linux环境下,就按照这个项目的README的来设置,自动就用GPU来训练了。我的GPU是 Quadro RTX5000

lslzl3000 commented 1 year ago

先看看PyTorch支不支持你的GPU。估计AMD的没戏。我在Linux环境下,就按照这个项目的README的来设置,自动就用GPU来训练了。我的GPU是 Quadro RTX5000

大概完整训练一次的时间是多少呢