Fine-tune Gemma 3 270M to play Hide-and-Seek using Modal (serverless GPU platform with free credits)!
# 1. Install Modal
pip install modal
# 2. Setup Modal account (get free credits!)
modal setup
# 3. Train the model on cloud GPU
modal run train_modal.py
# 4. Test the model
modal run test_model.pyThat's it! Training takes ~20 minutes on a free T4 GPU.
This project fine-tunes Google's Gemma 3 270M model to control a HIDER agent in a Hide-and-Seek game. The model learns to:
- Process 112-dimensional observation vectors
- Output optimal actions:
[move_x, move_y, move_z, lock, grab] - Make strategic decisions in 3D space
- ✅ Modal Integration: Serverless GPU training with free credits
- ✅ Unsloth Optimization: 2x faster training, 60% less memory
- ✅ LoRA Fine-tuning: Efficient parameter-efficient training
- ✅ 2000 Training Examples: Real Hide-and-Seek game data
- ✅ Automated Testing: Built-in model evaluation
- ✅ Production Ready: Export merged 16-bit models
Source: hider_raw.jsonl (2000 examples)
Format:
{
"messages": [
{"role": "system", "content": "You are a HIDER agent..."},
{"role": "user", "content": "[4.232, 1.478, 0.000, ...]"},
{"role": "assistant", "content": "[8, 0, 7, 1, 1]"}
]
}Using Modal's free tier ($30 credits):
- Training: ~$0.40 per run (20-30 mins on T4)
- Testing: ~$0.05 per run (2-3 mins)
- You can train 75+ times with free credits!
- SETUP.md - Detailed setup guide
- train_modal.py - Training script with comments
- test_model.py - Testing script with samples
- Model: Gemma 3 270M (Google)
- Cloud: Modal (serverless GPU)
- Optimization: Unsloth (2x speedup)
- Method: LoRA fine-tuning
- Framework: Transformers, TRL, PEFT
Made with ❤️ using Modal's free GPU credits