Your First Fine-tuning
Complete step-by-step guide. The technical part is easy — focus on creating great training data!
Your Progress
⏱️ Total Time: ~25 minutes active work + 15-20 minutes computer processing
✅ Pre-Flight Checklist
Before you start, make sure you have:
✨ Checked all 4 boxes? You're ready to start!
What You'll Accomplish
Export Data
Already done in edukaAI
Train Model
Just 3 simple commands
Chat with AI
That learned from YOUR data
💡 Remember: Training the model is the easy part. Creating quality training data is where the magic happens — and that's what edukaAI helps you with!
📋 Before You Start (Prerequisites)
Your Dataset from edukaAI
You should have exported your dataset as dataset_alpaca.json. If not, export it first from the EdukaAI application.
A GPU... OR Use Hugging Face!
Training requires a GPU, unless you use Hugging Face AutoTrain. Choose your path:
Option A: Your Computer
If you have an NVIDIA GPU with 8GB+ VRAM
Option B: Google Colab ⭐
Free GPU in the cloud. Great for beginners!
Option C: Hugging Face 🤗
No GPU needed! Web-based, easiest for non-coders
Path A: Google Colab (Easiest - Free GPU!)
Google Colab provides a free GPU in the cloud. No setup on your computer needed. This is the recommended path for beginners.
Upload Your Dataset
⏱️ 2 minutes- Go to Google Colab
- Click "New Notebook"
- In the left sidebar, click the 📁 folder icon
- Click "Upload" and select your
dataset_alpaca.jsonfile - Wait for upload to complete (green checkmark)
/content/ folder Enable GPU
⏱️ 1 minute- Click "Runtime" in the top menu
- Click "Change runtime type"
- Under "Hardware accelerator", select "T4 GPU"
- Click "Save"
Install Axolotl
⏱️ 3 minutes (mostly waiting)In the first code cell, type:
!pip install axolotl Press Shift + Enter to run
!pip install --upgrade axolotl or restart runtime (Runtime → Restart runtime) Create Your Config
⏱️ 3 minutesCreate a new code cell and paste this:
config = '''
base_model: TinyLlama/TinyLlama-1.1B-Chat-v1.0
model_type: LlamaForCausalLM
tokenizer_type: LlamaTokenizer
# Your edukaAI dataset
datasets:
- path: /content/dataset_alpaca.json
type: alpaca
# Training settings (keep it simple!)
num_epochs: 3
micro_batch_size: 1
gradient_accumulation_steps: 4
learning_rate: 0.0002
# Where to save your trained model
output_dir: /content/my-first-model
# Use less memory (good for Colab)
load_in_8bit: true
'''
# Save the config
with open('/content/config.yaml', 'w') as f:
f.write(config)
print("✅ Config created!")Run it with Shift + Enter
/content/dataset_alpaca.json to match Train Your Model! 🚀
⏱️ 15-20 minutes ☕ (computer does the work)Create another code cell:
!axolotl train /content/config.yaml Run it and watch the magic happen! ✨
• Loading model... ✓
• Loading dataset... ✓
• Epoch 1/3: [████████] 100%
• Epoch 2/3: [████████] 100%
• Epoch 3/3: [████████] 100%
• Training complete! ✓
• Change model to
TinyLlama/TinyLlama-1.1B-Chat-v1.0 (smaller = faster)• Or add
num_epochs: 1 to config (less training) load_in_4bit: true (instead of 8bit)Or use even smaller model
Chat With Your Model 💬
⏱️ 5 minutesAfter training completes, test your model:
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
# Load your trained model
model_path = "/content/my-first-model"
model = AutoModelForCausalLM.from_pretrained(
model_path,
torch_dtype=torch.float16,
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_path)
# Test it!
prompt = "What is photosynthesis?"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
# Generate response
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=100,
temperature=0.7
)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(f"You: {prompt}")
print(f"Model: {response}")Save Your Model (Important!)
⏱️ 2 minutes⚠️ Colab deletes files when you close it. Download your model:
- In the file browser (left sidebar), find
my-first-modelfolder - Right-click it → "Download"
- It will create a ZIP file you can save to your computer
⚡ Shortcut: Pre-Built Colab Notebook
Want to skip copy-pasting? Use our pre-configured notebook with everything set up!
🚀 Open Pre-Built TemplateJust upload your dataset and click run! All config included.
✅ How to Know It Worked
✓ You Should See This:
Loading model... ✓ Loading dataset... ✓ (16 examples) Starting training... Epoch 1/3: 100%|████████| 16/16 [02:30<00:00] Epoch 2/3: 100%|████████| 16/16 [02:28<00:00] Epoch 3/3: 100%|████████| 16/16 [02:29<00:00] Training complete! ✓ Model saved to /content/my-first-model
✓ When Testing, You'll Get:
Model: Photosynthesis is the process by which plants use sunlight, water, and carbon dioxide to create oxygen and energy in the form of sugar. It's how plants make their food!
It doesn't need to be perfect! Even partial or slightly weird responses mean it worked. With only 10-20 examples, quality will vary.
⚠️ If You Get Gibberish:
This is totally normal with a small dataset! The model hasn't learned enough yet. Signs of partial success:
- Response relates to your training topic (even if incorrect)
- Grammar is somewhat coherent
- It's not random characters
Solution: Go back to edukaAI and add 30-50 more high-quality examples, then retrain!
Path B: Your Local Computer
If you have a powerful NVIDIA GPU (8GB+ VRAM), you can train on your own computer. The steps are similar to Colab, just on your machine.
Install Axolotl
In the first code cell, type:
!pip install axolotl Press Shift + Enter to run
Create Your Config
Create a new code cell and paste this:
config = '''
base_model: TinyLlama/TinyLlama-1.1B-Chat-v1.0
model_type: LlamaForCausalLM
tokenizer_type: LlamaTokenizer
# Your edukaAI dataset
datasets:
- path: /content/dataset_alpaca.json
type: alpaca
# Training settings (keep it simple!)
num_epochs: 3
micro_batch_size: 1
gradient_accumulation_steps: 4
learning_rate: 0.0002
# Where to save your trained model
output_dir: /content/my-first-model
# Use less memory (good for Colab)
load_in_8bit: true
'''
# Save the config
with open('/content/config.yaml', 'w') as f:
f.write(config)
print("✅ Config created!")Run it with Shift + Enter
Train Your Model! 🚀
Create another code cell:
!axolotl train /content/config.yaml Run it and watch the magic happen! ✨
Chat With Your Model 💬
After training completes, test your model:
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
# Load your trained model
model_path = "/content/my-first-model"
model = AutoModelForCausalLM.from_pretrained(
model_path,
torch_dtype=torch.float16,
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_path)
# Test it!
prompt = "What is photosynthesis?"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
# Generate response
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=100,
temperature=0.7
)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(f"You: {prompt}")
print(f"Model: {response}")Save Your Model (Important!)
⚠️ Colab deletes files when you close it. Download your model:
- In the file browser (left sidebar), find
my-first-modelfolder - Right-click it → "Download"
- It will create a ZIP file you can save to your computer
Path B: Your Local Computer
If you have a powerful NVIDIA GPU (8GB+ VRAM), you can train on your own computer. The steps are similar to Colab, just on your machine.
Create Project Folder
mkdir my-first-training
cd my-first-training Copy Your Dataset
Copy your dataset_alpaca.json into this folder
Install Axolotl
pip install axolotl Create Config File
Create config.yaml with this content:
base_model: TinyLlama/TinyLlama-1.1B-Chat-v1.0
model_type: LlamaForCausalLM
tokenizer_type: LlamaTokenizer
# Your edukaAI dataset
datasets:
- path: ./dataset_alpaca.json
type: alpaca
# Training settings
num_epochs: 3
micro_batch_size: 1
gradient_accumulation_steps: 4
learning_rate: 0.0002
# Where to save
output_dir: ./my-first-model
# Use 8-bit to save memory
load_in_8bit: trueTrain!
axolotl train config.yaml Training takes 30-60 minutes depending on your GPU
Test Your Model
Your trained model is now in ./my-first-model folder!
Use the same Python code as Colab (above) to chat with it
Path C: Hugging Face (AutoTrain - Easiest GUI!)
Want to train without writing any code? Use Hugging Face AutoTrain - a web interface where you just upload your dataset and click "Train". No Colab, no command line!
Create Hugging Face Account
Go to huggingface.co/join and sign up for free.
Go to AutoTrain
Visit huggingface.co/autotrain and create a new project.
Upload Your Dataset
Click "Upload Dataset" and select your dataset_alpaca.json file from edukaAI.
Choose Base Model
Select a model to start from. Good beginner options:
TinyLlama/TinyLlama-1.1B-Chat-v1.0(fast, free tier)meta-llama/Llama-2-7b-chat-hf(better quality, requires HF Pro)
Configure Training (Keep It Simple!)
Use these beginner-friendly settings:
| Epochs: | 3 |
| Learning Rate: | 0.0002 |
| Batch Size: | 1 |
| LoRA Rank: | 8 (reduces memory) |
Click "Start Training" 🚀
That's it! AutoTrain will handle everything:
- Download the base model
- Fine-tune on your data
- Save to your Hugging Face Hub
- Create a demo space automatically!
Test & Share Your Model! 🎉
Once training completes:
- Your model is automatically hosted on Hugging Face
- AutoTrain creates a demo Space where you can chat with it
- Share the link with anyone - they can try your AI!
- Download the model files anytime
🤔 Why Choose Hugging Face?
Everything through web UI
Model is live immediately
Shareable chat interface
⚠️ What to Expect
Time
Training takes 10-20 minutes on Colab, 30-60 minutes locally. This is normal!
Quality
With 10-20 examples, results will be okay but inconsistent. This is expected! More data = better results.
The Point
This is a learning exercise. You're not creating production-ready AI — you're understanding the process!
Next Steps
After seeing how it works, come back to EdukaAI and add more quality examples in the application. Then retrain for better results!
🔧 Common Issues & Solutions
"Out of Memory" Error
Solution: You're using a model too big for your GPU. Switch to an even smaller model like TinyLlama/TinyLlama-1.1B-Chat-v1.0 (which we use above) or increase load_in_8bit: true.
"ModuleNotFoundError: No module named 'axolotl'"
Solution: Axolotl didn't install properly. Restart your runtime/environment and run pip install axolotl again.
"FileNotFoundError: dataset_alpaca.json"
Solution: The path in your config doesn't match where you uploaded the file. Check the path carefully!
Model Generates Gibberish
Normal! With only 10-20 training examples, the model hasn't learned much yet. This is why dataset quality and quantity matter. Go back to edukaAI and add more diverse, high-quality examples!
🎓 The Real Lesson
After completing this guide, you'll realize something important:
"Training the model was just running a command. The hard part — the part that matters — is creating good training data."
That's exactly what edukaAI helps you with! The technical training is easy. Creating meaningful, diverse, high-quality training examples is where the value is.
🚀 You Trained a Model! Now What?
Congratulations! You've completed your first fine-tuning. Here's how to make it even better:
Add More Data
10 examples = okay results
50 examples = noticeably better
100 examples = quite good!
Use the EdukaAI application to add more training examples.
Improve Quality
Review your examples:
• Fix low-quality ones
• Add more diverse topics
• Include edge cases
Retrain & Compare
See the improvement:
• Export new dataset
• Retrain model!
• Compare results!
Export updated datasets from the EdukaAI application.
💡 The Iteration Loop
in edukaAI→Export &
Retrain→Test &
Compare→Repeat
↺
Each iteration makes your model smarter! 🧠
You're Ready!
The technical part is straightforward. Focus on creating amazing training data — that's your superpower.