$ make init
$ source .venv/bin/activate# Download, preprocess and visualize a sample dataset of 10 logs
$ python3 dataset/download.py --format "[Gen 9] OU" --name <ds-name> --num_logs 10
$ python3 dataset/preprocessing.py --dataset <ds-name>
$ python3 dataset/visualize.py --dataset <ds-name> --num_samples 3$ python3 scripts/finetune.py --dataset <ds-name>Dataset is stored in dataset/, which contains two folders for:
dataset/raw/: downloaded data fromdownload.pywill be saved heredataset/processed: processed dataset viapreprocessing.pywill be saved here, splitting in train, validation and test
dataset
├── processed
│ ├── train/
│ ├── val/
│ └── test/
├── raw/# will save the dataset inside
python3 dataset/download.py --format "[Gen 9] OU" --num_logs 10
# do not forget "" on formatThe following script preprocess each log in the dataset. Creates N samples (one per turn in the log of that battle) and stores them in jsonl file. Each sample is a pair:
{"input": "Turn 0, Team 1, Charizard, ....", "output": "use Flamethrower"},
{"input": "Turn 1, Team 1, Charizard, ....", "output": "switch to Blastoise"},
...python3 dataset/preprocessing.py --dataset dataset_gen9ou_100To get a nice visualization of each sample run:
python3 dataset/visualize.py --dataset dataset_gen9ou_100make initThis will:
- Install dependencies
- Prompt you to enter your API key (saved to
.api-key) - Download cloudflared
- Prepare the model
make serveOptions:
make serve PORT=6050 # Use custom port (default: 8000)
make serve DEBUG=true # Enable debug logging
make init DEBUG=true # Debug mode for initializationThis will start the FastAPI app and Cloudflare tunnel. You should see something similar to the following:
🚀 Starting Poke-LLM...
Setting up environment...
Starting FastAPI...
Starting tunnel...
Waiting for tunnel URL...
INFO: Started server process [86577]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
🎉 Poke-LLM is running!
=======================
📱 Local API: http://127.0.0.1:8000
🌐 Public URL: https://participate-spiritual-supplied-bought.trycloudflare.com
🧪 Test: python test.py
🛑 Stop: kill 86577 86585Once running, you can use the public URL to make requests:
curl -X POST "https://your-tunnel-url.trycloudflare.com/generate" \
-H "Content-Type: application/json" \
-H "X-API-Key: $(cat .api-key)" \
-d '{"prompt": "Hello, how are you?", "max_new_tokens": 50}'import requests
# Load API key from file
with open('.api-key', 'r') as f:
api_key = f.read().strip()
url = "https://your-tunnel-url.trycloudflare.com/generate"
headers = {"Content-Type": "application/json", "X-API-Key": api_key}
data = {"prompt": "Hello, how are you?", "max_new_tokens": 50}
response = requests.post(url, json=data, headers=headers)
print(response.json())Replace your-tunnel-url with the actual URL shown when you run the script!
make init- Install dependencies, download cloudflared, and prepare the modelmake serve- Start FastAPI app and Cloudflare tunnelmake change-model- Change the language model (interactive menu)make clean- Clean up generated files (venv, logs, etc.)make help- Show all available commands
.api-key- Your private API key (create this file)app.py- FastAPI applicationtest.py- Test script for the APIrequirements.txt- Python dependenciesMakefile- Build and run commands