Skip to content

Instantly share code, notes, and snippets.

@aaronsteers
Created December 14, 2019 01:28
Show Gist options
  • Save aaronsteers/f4c072058a3317ee3904f713b1e4b6cb to your computer and use it in GitHub Desktop.
Save aaronsteers/f4c072058a3317ee3904f713b1e4b6cb to your computer and use it in GitHub Desktop.
AI Dungeon
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![BYU PCCL](https://pcc4318.files.wordpress.com/2018/02/asset-1.png?w=150)\n",
"\n",
"Sponsored by the BYU PCCL Lab.\n",
"\n",
"> AI Dungeon 2 is a completely AI generated text adventure built with OpenAI's largest GPT-2 model. It's a first of it's kind game that allows you to enter and will react to any action you can imagine.\n",
"\n",
"# What is this?\n",
"Google Colab is a way to experience machine learning for free. Google provides GPUs that you can run code in. Because this game exploded however, Google likely won't be able to allow free usage of it for AI Dungeon for very long. We are almost done making an app version of the game where you will be able to play AI Dungeon 2. Until that's released you can still play the game here.\n",
"\n",
"# Main mirrors of AI Dungeon 2 are currently down due to high download costs.\n",
"We are using bittorrent as a temporary solution to host game files and keep this game alive. It's not fast, but it's the best we've got right now.\n",
"\n",
"If you want to help, best thing you can do is to **[download this torrent file with game files](https://github.com/nickwalton/AIDungeon/files/3935881/model_v5.torrent.zip)** and **seed it** indefinitely to the best of your ability. This will help new players download this game faster, and discover the vast worlds of AIDungeon2!\n",
"\n",
"- <a href=\"https://twitter.com/nickwalton00?ref_src=twsrc%5Etfw\" class=\"twitter-follow-button\" data-show-count=\"false\">Follow @nickwalton00</a> on Twitter for updates on when it will be available again.\n",
"- **[Support AI Dungeon 2](https://www.patreon.com/AIDungeon) on Patreon to help me to continue improving the game with all the awesome ideas I have for its future!**\n",
"\n",
"## How to play\n",
"1. Click \"Tools\"-> \"Settings...\" -> \"Theme\" -> \"Dark\" (optional but recommended)\n",
"2. Click \"Runtime\" -> \"Run all\"\n",
"3. Wait until all files are downloaded (only has to be one once, and it will take some time)\n",
"4. It will then take a couple minutes to boot up as the model is loaded onto the GPU. \n",
"5. If you have questions about getting it to work then please [go to github repo](https://github.com/AIDungeon/AIDungeon) to get help. \n",
"\n",
"## About\n",
"* While you wait you can [read adventures others have had](https://aidungeon.io/)\n",
"* [Read more](https://pcc.cs.byu.edu/2019/11/21/ai-dungeon-2-creating-infinitely-generated-text-adventures-with-deep-learning-language-models/) about how AI Dungeon 2 is made.- **[Support AI Dungeon 2](https://www.patreon.com/bePatron?u=19115449) on Patreon to help me to continue improving the game with all the awesome ideas I have for its future!**\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Cloning into 'AIDungeon'...\n",
"remote: Enumerating objects: 51, done.\u001b[K\n",
"remote: Counting objects: 100% (51/51), done.\u001b[K\n",
"remote: Compressing objects: 100% (43/43), done.\u001b[K\n",
"remote: Total 51 (delta 2), reused 20 (delta 0), pack-reused 0\u001b[K\n",
"Unpacking objects: 100% (51/51), done.\n",
"/home/jovyan/work/samples/AIDungeon\n",
"Installing dependencies\n",
"Downloading AIDungeon2 Model... (this may take a very, very long time)\n",
"--2019-12-14 01:25:22-- https://github.com/AIDungeon/AIDungeon/files/3935881/model_v5.torrent.zip\n",
"Resolving github.com (github.com)... 192.30.255.113\n",
"Connecting to github.com (github.com)|192.30.255.113|:443... connected.\n",
"HTTP request sent, awaiting response... 302 Found\n",
"Location: https://github-production-repository-file-5c1aeb.s3.amazonaws.com/179196443/3935881?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20191214%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20191214T012523Z&X-Amz-Expires=300&X-Amz-Signature=2c742fd26c7f005956d7e2400fcf67c52b71390ab831c2a50c2e2a7930c6f18a&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3Bfilename%3Dmodel_v5.torrent.zip&response-content-type=application%2Fzip [following]\n",
"--2019-12-14 01:25:23-- https://github-production-repository-file-5c1aeb.s3.amazonaws.com/179196443/3935881?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20191214%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20191214T012523Z&X-Amz-Expires=300&X-Amz-Signature=2c742fd26c7f005956d7e2400fcf67c52b71390ab831c2a50c2e2a7930c6f18a&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3Bfilename%3Dmodel_v5.torrent.zip&response-content-type=application%2Fzip\n",
"Resolving github-production-repository-file-5c1aeb.s3.amazonaws.com (github-production-repository-file-5c1aeb.s3.amazonaws.com)... 52.216.142.76, 52.216.134.99\n",
"Connecting to github-production-repository-file-5c1aeb.s3.amazonaws.com (github-production-repository-file-5c1aeb.s3.amazonaws.com)|52.216.142.76|:443... connected.\n",
"HTTP request sent, awaiting response... 200 OK\n",
"Length: 60573 (59K) [application/zip]\n",
"Saving to: ‘model_v5.torrent.zip’\n",
"\n",
"model_v5.torrent.zi 100%[===================>] 59.15K 366KB/s in 0.2s \n",
"\n",
"2019-12-14 01:25:23 (366 KB/s) - ‘model_v5.torrent.zip’ saved [60573/60573]\n",
"\n",
"Archive: model_v5.torrent.zip\n",
" inflating: model_v5.torrent \n",
"\n",
"\n",
"===========================================\n",
"We are now starting to download the model.\n",
"It will take a while to get up to speed.\n",
"DHT errors are normal.\n",
"===========================================\n",
"\n",
"\n",
"12/14 01:25:23 [\u001b[1;32mNOTICE\u001b[0m] Downloading 1 item(s)\n",
"\n",
"12/14 01:25:24 [\u001b[1;31mERROR\u001b[0m] Exception caught while loading DHT routing table from /home/jovyan/.cache//aria2/dht.dat\n",
"Exception: [DHTRoutingTableDeserializer.cc:83] errorCode=1 Failed to load DHT routing table from /home/jovyan/.cache//aria2/dht.dat\n",
"\n",
"12/14 01:25:24 [\u001b[1;32mNOTICE\u001b[0m] IPv4 DHT: listening on UDP port 6942\n",
"\n",
"12/14 01:25:24 [\u001b[1;32mNOTICE\u001b[0m] IPv4 BitTorrent: listening on TCP port 6895\n",
" *** Download Progress Summary as of Sat Dec 14 01:25:39 2019 *** [33m1h11m1s\u001b[0m\u001b[35m]\u001b[0m\u001b[0mmm\n",
"===============================================================================\n",
"[#7d1d8a 16MiB/5.8GiB(0%) CN:53 SD:7 DL:1.3MiB ETA:1h11m24s]\n",
"FILE: /home/jovyan/work/samples/AIDungeon/generator/gpt2/models/model_v5/checkpoint (6more)\n",
"-------------------------------------------------------------------------------\n",
"\n",
" *** Download Progress Summary as of Sat Dec 14 01:25:54 2019 *** \u001b[33m21m29s\u001b[0m\u001b[35m]\u001b[0m\u001b[0mm\n",
"===============================================================================\n",
"[#7d1d8a 73MiB/5.8GiB(1%) CN:58 SD:33 DL:4.7MiB ETA:20m37s]\n",
"FILE: /home/jovyan/work/samples/AIDungeon/generator/gpt2/models/model_v5/checkpoint (6more)\n",
"-------------------------------------------------------------------------------\n",
"\n",
" *** Download Progress Summary as of Sat Dec 14 01:26:10 2019 *** \u001b[36m63KiB\u001b[0m(864KiB) ETA:\u001b[33m20m1s\u001b[0m\u001b[35m]\u001b[0m\u001b[0mmm\n",
"===============================================================================\n",
"[#7d1d8a 150MiB/5.8GiB(2%) CN:68 SD:44 DL:4.8MiB UL:55KiB(864KiB) ETA:19m57s]\n",
"FILE: /home/jovyan/work/samples/AIDungeon/generator/gpt2/models/model_v5/checkpoint (6more)\n",
"-------------------------------------------------------------------------------\n",
"\n",
" *** Download Progress Summary as of Sat Dec 14 01:26:26 2019 *** \u001b[36m43KiB\u001b[0m(1.5MiB) ETA:\u001b[33m19m36s\u001b[0m\u001b[35m]\u001b[0m\u001b[0mm\n",
"===============================================================================\n",
"[#7d1d8a 227MiB/5.8GiB(3%) CN:73 SD:50 DL:4.8MiB UL:37KiB(1.5MiB) ETA:19m43s]\n",
"FILE: /home/jovyan/work/samples/AIDungeon/generator/gpt2/models/model_v5/checkpoint (6more)\n",
"-------------------------------------------------------------------------------\n",
"\n",
" *** Download Progress Summary as of Sat Dec 14 01:26:42 2019 *** \u001b[36m392KiB\u001b[0m(2.1MiB) ETA:\u001b[33m19m25s\u001b[0m\u001b[35m]\u001b[0m\u001b[0m\n",
"===============================================================================\n",
"[#7d1d8a 304MiB/5.8GiB(5%) CN:83 SD:58 DL:4.8MiB UL:329KiB(2.2MiB) ETA:19m24s]\n",
"FILE: /home/jovyan/work/samples/AIDungeon/generator/gpt2/models/model_v5/checkpoint (6more)\n",
"-------------------------------------------------------------------------------\n",
"\n",
" *** Download Progress Summary as of Sat Dec 14 01:26:57 2019 *** \u001b[36m0B\u001b[0m(2.6MiB) ETA:\u001b[33m19m12s\u001b[0m\u001b[35m]\u001b[0m\u001b[0m\u001b[0m\n",
"===============================================================================\n",
"[#7d1d8a 377MiB/5.8GiB(6%) CN:88 SD:63 DL:4.8MiB UL:0B(2.7MiB) ETA:19m16s]\n",
"FILE: /home/jovyan/work/samples/AIDungeon/generator/gpt2/models/model_v5/checkpoint (6more)\n",
"-------------------------------------------------------------------------------\n",
"\n",
"\u001b[35m[\u001b[0m#7d1d8a 390MiB/5.8GiB\u001b[36m(6%)\u001b[0m CN:88 SD:63 DL:\u001b[32m4.7MiB\u001b[0m UL:\u001b[36m0B\u001b[0m(2.8MiB) ETA:\u001b[33m19m26s\u001b[0m\u001b[35m]\u001b[0m\u001b[0m"
]
}
],
"source": [
"# Install\n",
"!git clone --depth 1 --branch master https://github.com/AIDungeon/AIDungeon/\n",
"%cd AIDungeon\n",
"!./install.sh\n",
"from IPython.display import clear_output\n",
"clear_output()\n",
"print(\"Installation Complete!\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Download model from torrent:\n",
"!./download_model.sh\n",
"from IPython.display import clear_output\n",
"clear_output()\n",
"print(\"Download Complete!\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Play\n",
"from IPython.display import Javascript\n",
"display(Javascript('''google.colab.output.setIframeHeight(0, true, {maxHeight: 5000})'''))\n",
"!source ./venv/bin/activate\n",
"!./venv/bin/python play.py"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment