alex-calderwood / spindle

Spindle is a mixed-initiative tool for generating full, multi-passage Twine stories. The repository contains code for the paper "Spinning Coherent Interactive Fiction through Foundation Model Prompts."

Home Page:https://computationalcreativity.net/iccc22/wp-content/uploads/2022/06/ICCC-2022_2L_Calderwood-et-al..pdf

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Publication: Calderwood, Alex, Noah Wardrip-Fruin, and Michael Mateas. "Spinning Coherent Interactive Fiction through Foundation Model Prompts."

Spindle

Spindle is a mixed-initiative tool for writing interactive, branching fiction. Released under the UC BSD-4-Clause.

Warning! This codebase requires you fine-tune your own model as I am not able to share my fine-tuned model via OpenAI. Instructions are below, but it might be a little fiddly.

Example

This repo contains all resources needed to collect training data and fine-tune your own model for under $10.

Setup

You must have Python 3.7 for this project. Optionally, I recommend using a virtual environment like conda for managing the environments as follows.

conda create -n spindle python=3.7
conda activate spindle

Install the python 3 requirements.

pip install -r src/requirements.txt

Download the largest spacy language model.

chmod +x src/setup_spacy.sh
src/setup_spacy.sh

Add your OpenAI API Key

Navigate to https://beta.openai.com/account/api-keys. Copy your key and set it as an environment variable.

export OPENAI_API_KEY=<YOUR_KEY>

Run interactive twine generation

python src/spindle.py

Training

Collect Training Data

  • Twine games from itch.io

    python src/training/data_collection.py

Create training data file

  • Run through the cells in src/create_contextual_training_data.ipynb
  • Will create a file that can be uploaded to GPT-3 for fine-tuning

Run interactive twine generation

python src/spindle.py

Spindle

About

Spindle is a mixed-initiative tool for generating full, multi-passage Twine stories. The repository contains code for the paper "Spinning Coherent Interactive Fiction through Foundation Model Prompts."

https://computationalcreativity.net/iccc22/wp-content/uploads/2022/06/ICCC-2022_2L_Calderwood-et-al..pdf

License:Other


Languages

Language:Jupyter Notebook 94.5%Language:Python 5.5%Language:Shell 0.0%