How to run AI Dungeon 2 on your Windows box

Dec 09 2019

New: I wrote an installer that automates this whole process. Check it out here.

Update: this guide is out of date! Check this Pastebin link for an up-to-date guide maintained by Audixas. Also check out the help-local channel on Discord.

AI Dungeon 2 is back up, with the model currently hosted as a torrent. Since downloading the torrent to the Colab machines takes forever, I wanted to run it locally on my Windows PC.

Here's how I got things working.

1. Run PowerShell as Administrator

2. Install Chocolatey

Chocolatey is a package manager for Windows that will make it easy to install a few required dependencies. Instructions here, or just copy/paste the below line into PowerShell.

Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

3. Install dependencies

AI Dungeon 2 doesn't work on Python 3.8, so install the latest previous version.

choco install python --version 3.7.4

Install remaining dependencies. Skip any you may have installed already.

choco install git wget

4. Clone git repo

Close PowerShell and open Git Bash, which was installed in the previous step at C:\Program Files\Git\git-bash.exe

git clone https://github.com/AIDungeon/AIDungeon/

(FYI: You'll have to right-click to see copy/paste options in Git Bash, shortcuts don't work.)

5. Download the torrent

This is the most complicated step. First, run these commands.

cd AIDungeon/generator/gpt2/models/
wget https://github.com/AIDungeon/AIDungeon/files/3935881/model_v5.torrent.zip
unzip model_v5.torrent.zip

Next, download the aria2c tool. Unzip and copy the exe to the AIDungeon/generator/gpt2/models/ folder. Run the following command to start the torrent. It's around 5 GB.

./aria2c.exe --max-connection-per-server 16 --split 64 --bt-max-peers 500 --seed-time=0 --summary-interval=15 --disable-ipv6 model_v5.torrent

6. Install CUDA

It's officially recommended to have a CUDA-supported NVIDIA GPU with at least 12 GB of memory to run the game, but it's not necessary. You can run it on your CPU fine. It's just slow.

In fact, if you don't have enough memory, trying it on your GPU will probably fail with out-of-memory errors. I tried on my 970, hit out-of-memory, and went back to using CPU.

Follow these instructions to setup CUDA on your GPU:

Install the CUDA Toolkit, specifically version 10.0. It's the only version that works with AI Dungeon 2.

Next, install the cuDNN library (v7.6.5 for CUDA 10.0). You'll need to join the NVIDIA Developer Program. It's free. There's no installer, but you can find instructions here on where to put the files.

7. Install Python dependencies

Navigate back to the root of the git repo and run the following:

pip install -r requirements.txt

8. Play!

Finally, enter this command to start the game:

python play.py

Wrap up

If these instructions aren't working for you, let me know on Twitter and I'll help out as best I can.

You can also try the help-local channel on the AI Dungeon 2 Discord.

Thanks to @DecDoyleDev and /u/Captain-Sisko for their help in improving this post.

Edited on 12/9: