football_ai_commentary icon indicating copy to clipboard operation
football_ai_commentary copied to clipboard

AI generating real-time football commentary

AI generating real-time football commentary

Project Video

This repo contains code for training and executing an AI-based soccer/football commentary engine using OpenAI GPT-2 language model running on top of Google's opensource Football Environment.

project image

Setup instructions

This code has been tested on an Ubuntu 18.04 platform with access to an Nvidia GPU.

  1. Install Google Football Environment (GPU version) from this repository.
  2. Install text-to-speech library pyttsx3 using pip install pyttsx3.

Train GPT-2

  1. Use the notebook src/train_commentary_gpt2.ipynb on Google Colab to train the model.
  2. Once trained, download the checkpoint/run1/* files under this directory src/models/345M/.

Execute the commentary engine

  1. Run python src/generate_commentary.py to start the game environment and the commentary engine.