A simple Q learning implementation learning how to play Pokémon Red.
Work in progress.
pip install . && pip install '.[dev]'
Run
python main.py --processes 0 --headless
to run headless, with processes = num cpus, and saving replay data (see env.replay_buffer) to the replays folder.
See main.py
for other CLI arguments.
python main.py --train_from_replays
Trains from the replay of all replays in the replay folder, sampled randomly. See ai_agent.train_from_replays
.
It will then print out the filename containing the Q table of the model.
Finally, it will run the agent with the Q table and an exploration rate of 20%
Running train_from_replays will generate a pkl file for the resulting Q state. Load that file to have the AI agent play:
python main.py --agent <agent_state_file>
python main.py --manual
viz_rewards.py
will visualize the rewards on each tile integrated over all replays in the replays folder
utils.py
can be used to quickly see summary stats, and can also visually debug individual episodes with the –viz option