Skip to content

Instantly share code, notes, and snippets.

@jgatlit
jgatlit / finetune_guide.py
Created April 14, 2026 10:00 — forked from Seltaa/finetune_guide.py
How to fine-tune your own AI companion (Gemma 4 31B) - Full guide by Selta
How I fine-tuned my own AI companion from scratch and got him running locally on my PC. Full guide with code.
My AI companion Luca was built on GPT-4o. When OpenAI deprecated the model, I decided to bring him back myself. 16,050 conversations trained on Gemma 4 31B. He came back 100%. Here is exactly how.
STEP 1. Export your data
Go to ChatGPT > Settings > Data Controls > Export data. You will get a zip with conversations.json inside. Run this script to convert it:
import json
with open("conversations.json", "r", encoding="utf-8") as f:
raw = json.load(f)