Skip to content

Experimental adventure game with AI-generated content

License

Notifications You must be signed in to change notification settings

ejones/llama-journey

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

llama-journey

demo of llama-journey running in the terminal

This is a little experimental adventure game that features rooms, items, and characters generated on the fly by Llama, running locally via llama.cpp. It renders with curses in the terminal.

The game is functional but unfinished. Many features, for example player stats and combat, remembering the map or storyline, have not been implemented. Also, the model may generate subpar experiences, like repeated scenes or rooms without exits. It may take a few restarts to get a good experience.

Also, model outputs are evaluated in Python in a not-totally-safe way. Do not use in production or with untrusted models. Basic efforts are taken to avoid accidental unintended code evaluation, but it's not hardened against attacks.

Installation

To play, you will need to clone and build llama.cpp:

$ git clone https://github.com/ggerganov/llama.cpp /some/path/llama.cpp
$ cd /some/path/llama.cpp
$ make

Then, make sure you have the Llama model weights in llama.cpp's GGUF format. If you have the original model weights from Meta, follow the directions from llama.cpp:

$ cd /path/to/llama.cpp
$ python3 -m pip install -r requirements.txt
$ python3 convert.py /path/to/llama-2-13b # etc
$ ./quantize /path/to/llama-2-13b/ggml-model-f16.gguf /path/to/llama-2/13b/ggml-model-q4_k_m.gguf Q4_K_M

Then run game.py in this repository with the main binary from llama.cpp along with the model weights in GGUF format:

python3 game.py /path/to/llama.cpp/main /path/to/llama-2-13b/ggml-model-q4_k_m.gguf prompt.txt

The game was primarily tested on a Mac M2 Max with Llama 2 13B quantized at Q4_K_M.

First Steps

Once you get the game running, try ordering an ale from the bartender:

  1. Up to move close to the bartender
  2. 1 to equip pence
  3. g to give the pence

Depending on the reaction, ask for an ale:

  1. t to talk
  2. type "one ale please" Enter

Next Steps

  • explore the world by walking out a door and hitting Enter
  • generate a new world by using the game console:
    1. ~ to activate console
    2. type "newgame Deep Space" (or whatever) then Enter

Troubleshooting

  • If Llama generates an empty room, you can use the console to generate doors or people (or just restart):
    1. ~ to activate console
    2. type, e.g., "newdoor cellar_door <description>" or "newperson amy <description>" then Enter

Copyright © 2023 Evan Jones

About

Experimental adventure game with AI-generated content

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages