JDBumgardner / stone_ground_hearth_battles

Apache License 2.0
20 stars 2 forks source link

Stone Ground Hearth Battles

Hearthstone battlegrounds simulator is licensed under the Apache 2.0 License

This repository includes a simulator along with bots and allows the user to play against the bots. There are various attempts to use Pytorch to train a bot.

Tensorboard Plugin

This repo also contains a Tensorboard plugin for displaying vega/vega-lite/altair plots in tensorboard. We use this to plot debug information about our pytorch bots, but this plugin works standalone.

Example Screenshot of Tensorboard_Vega_Embed plugin

To use it, run

$ python setup.py develop

from within the tensorboard_vega_embed/ directory. When you launch tensorboard, it will show up as a new tab labeled " VEGA_EMBEDX". To uninstall it, run $ python setup.py develop --uninstall.

Distributed Training Environment

This repo also contains a distributed training setup to play several games in parallel using a single GPU, using Pytorch Distributed and python asyncio.

Architecture Diagram

Benchmarks

Speed of simulation can be important for Reinforcement Learning. Woe is upon us for choosing to write the simulator in python, thinking that it would not be the bottleneck. CPU is the bottleneck for experience generation, not GPU :(

Therefore, we have benchmarks to profile the performance of our simulator, and identify bottlenecks. To run one of the profiles, run, e.g.

$ PYTHONPATH=. python3 -m cProfile -o benchmarks/profiles/simulation.cprof benchmarks/benchmark_simulation.py

The resulting profile can be viewed using snakeviz:

$ snakeviz benchmarks/profiles/simulation.cprof