Skip to content

A project for creating a llm fine-tune that takes on the persona of Joshua from the WarGames movie.

Notifications You must be signed in to change notification settings

postworthy/wargames-ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

WarGames AI

A fun twist on the 1983 movie’s computer system. WarGames AI aims to recreate the clipped, console-style character “Joshua” with a modern LLM by generating Joshua-flavored data and fine-tuning an open model. Everything is designed to be simple to try: one Docker image, a big list of prompts, and a quick path to training and exporting models.

Shall we play a game?

What’s inside

  • Docker-based workflow with CUDA/PyTorch/Unsloth preinstalled
  • Prompt-driven data generation via a local Ollama model
  • Simple chat templating and dataset creation (Hugging Face save_to_disk)
  • Training with Unsloth + TRL (LoRA) at long context lengths
  • Optional export to GGUF for llama.cpp and Ollama

Repository highlights:

  • data-processing/Dockerfile — GPU-enabled image with all tooling
  • data-processing/build.sh — Builds the image
  • data-processing/run.sh — Launches a container with GPU, mounts, and OLLAMA_URL
  • data-processing/Modelfile.sample.txt — Example Ollama Modelfile (Joshua system/template)
  • data-processing/story-prompts.txt — Joshua-flavored prompts used for data generation
  • data-processing/create_dataset.py — Applies a chat template and writes a HF dataset
  • data-processing/train.py — SFT training script (2048*4 max sequence length)
  • data-processing/save_gguf.sh — Converts trained HF models to GGUF

Prerequisites

  • Linux + Docker with NVIDIA Container Toolkit
  • NVIDIA GPU with recent drivers
  • Ollama running on the host
  • OLLAMA_URL environment variable (run.sh sets http://127.0.0.1:11434/ for you)

Quick start (Docker)

  1. Build the image
  • bash data-processing/build.sh
  1. Start the container (drops you into /app)
  • bash data-processing/run.sh
  1. Inside the container, generate data, train, and export
  • python3 create_dataset.py --output-dir ./output --dataset-name wargames-dataset
  • python3 train.py --output-dir ./output --dataset-names wargames-dataset --epochs 1
  • bash save_gguf.sh ./output

Outputs:

  • ./output/wargames-dataset — Hugging Face Dataset produced by create_dataset.py
  • ./output/model-*/ — Trained model (merged 16-bit) from train.py
  • ./output/model-*-gguf/ — GGUF exports created by save_gguf.sh

Notes:

  • run.sh binds ./data-processing/output to /app/output for easy access on the host.
  • Ollama must be running on the host, reachable via OLLAMA_URL (run.sh sets this).

Configure the model you call (optional)

By default, create_dataset.py uses MODEL="gpt-oss:20b". You can:

  • Pull it: ollama pull gpt-oss:20b
  • Or build your own with the provided Modelfile:
    • ollama create joshua -f data-processing/Modelfile.sample.txt
    • Then set MODEL="joshua" in data-processing/create_dataset.py

Troubleshooting

  • Can’t reach Ollama: ensure the daemon is running and OLLAMA_URL is correct.
  • Empty or repeated generations: check ./output/llama cache files; clear if needed.
  • OOM during training: reduce batch size or context length in train.py.
  • GGUF conversion errors: confirm llama.cpp repo was built in the Docker image.

Known limitations

  • pre_train.py references create_dataset_qa and eval.run_eval, which aren’t included. Prefer train.py.
  • Generation cache filenames are derived from prompt text; multiple “alternatives” may reuse the same file unless disambiguated in llama_data_pre_processing.py.

At-a-glance commands

From the repo root:

  • bash data-processing/build.sh
  • bash data-processing/run.sh
  • Inside container: python3 create_dataset.py --output-dir ./output --dataset-name wargames-dataset && python3 train.py --output-dir ./output --dataset-names wargames-dataset --epochs 1 && bash save_gguf.sh ./output

About

A project for creating a llm fine-tune that takes on the persona of Joshua from the WarGames movie.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •