EdukaAI

Your First Fine-tuning

Complete step-by-step guide. The technical part is easy — focus on creating great training data!

Your Progress

Create Dataset
Export Data
3
Train ModelYou are here →
4
Test ModelChat with AI

⏱️ 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.

1

Python 3.9 or higher

Check if you have it:

python --version

Don't have it? Download Python

2

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.

1

Upload Your Dataset

⏱️ 2 minutes
  1. Go to Google Colab
  2. Click "New Notebook"
  3. In the left sidebar, click the 📁 folder icon
  4. Click "Upload" and select your dataset_alpaca.json file
  5. Wait for upload to complete (green checkmark)
💡 Tip: The file will appear in the /content/ folder
🆘 Stuck? File not uploading? Try refreshing the page or checking file size (should be < 50MB)
2

Enable GPU

⏱️ 1 minute
  1. Click "Runtime" in the top menu
  2. Click "Change runtime type"
  3. Under "Hardware accelerator", select "T4 GPU"
  4. Click "Save"
⚠️ Important: Without GPU, training will be extremely slow (hours instead of minutes) or may fail!
3

Install Axolotl

⏱️ 3 minutes (mostly waiting)

In the first code cell, type:

!pip install axolotl

Press Shift + Enter to run

⏳ Wait: Installation takes 2-3 minutes. Watch the output scroll by! You'll see progress bars.
🆘 Error? If you see red text, try: !pip install --upgrade axolotl or restart runtime (Runtime → Restart runtime)
4

Create Your Config

⏱️ 3 minutes

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

💡 Tip: If your dataset filename is different, change /content/dataset_alpaca.json to match
5

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! ✨

What you'll see:
• Loading model... ✓
• Loading dataset... ✓
• Epoch 1/3: [████████] 100%
• Epoch 2/3: [████████] 100%
• Epoch 3/3: [████████] 100%
• Training complete! ✓
☕ This takes time: Go grab coffee! The computer is working. Don't close the tab.
🆘 Taking >30 mins? This is too long. Try:
• Change model to TinyLlama/TinyLlama-1.1B-Chat-v1.0 (smaller = faster)
• Or add num_epochs: 1 to config (less training)
🆘 Out of Memory error? Add this to config:
load_in_4bit: true (instead of 8bit)
Or use even smaller model
6

Chat With Your Model 💬

⏱️ 5 minutes

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}")
🎉 Success! If you see a response (even if imperfect), you trained your first AI model!
What to expect: With only 10-20 training examples, responses will be okay but inconsistent. Some will be great, some weird. This is normal!
7

Save Your Model (Important!)

⏱️ 2 minutes

⚠️ Colab deletes files when you close it. Download your model:

  1. In the file browser (left sidebar), find my-first-model folder
  2. Right-click it → "Download"
  3. It will create a ZIP file you can save to your computer
⚠️ Don't skip this! If you don't download, you'll lose your trained model when Colab session ends.

Shortcut: Pre-Built Colab Notebook

Want to skip copy-pasting? Use our pre-configured notebook with everything set up!

🚀 Open Pre-Built Template

Just 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:

You: What is photosynthesis?
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.

3

Install Axolotl

In the first code cell, type:

!pip install axolotl

Press Shift + Enter to run

⏳ Wait: Installation takes 2-3 minutes. Watch the output scroll by!
4

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

5

Train Your Model! 🚀

Create another code cell:

!axolotl train /content/config.yaml

Run it and watch the magic happen! ✨

⏰ Time: This takes 10-20 minutes on Colab's free GPU. You'll see progress bars and loss values going down — that's good!
6

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}")
🎉 Success! If you see a response, you trained your first AI model!
7

Save Your Model (Important!)

⚠️ Colab deletes files when you close it. Download your model:

  1. In the file browser (left sidebar), find my-first-model folder
  2. Right-click it → "Download"
  3. 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.

1

Create Project Folder

mkdir my-first-training
cd my-first-training
2

Copy Your Dataset

Copy your dataset_alpaca.json into this folder

3

Install Axolotl

pip install axolotl
4

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: true
5

Train!

axolotl train config.yaml

Training takes 30-60 minutes depending on your GPU

6

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!

1

Create Hugging Face Account

Go to huggingface.co/join and sign up for free.

💡 The free tier is enough to get started and experiment!
2

Go to AutoTrain

Visit huggingface.co/autotrain and create a new project.

🎯 Select "LLM Fine-tuning" as your project type
3

Upload Your Dataset

Click "Upload Dataset" and select your dataset_alpaca.json file from edukaAI.

📁 AutoTrain supports the Alpaca format automatically - no conversion needed!
4

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)
5

Configure Training (Keep It Simple!)

Use these beginner-friendly settings:

Epochs:3
Learning Rate:0.0002
Batch Size:1
LoRA Rank:8 (reduces memory)
6

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!
⏱️ Training takes 10-30 minutes depending on dataset size and model
7

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
✨ Bonus: You now have a public demo of YOUR trained AI that anyone can try!

🤔 Why Choose Hugging Face?

✅ No Code

Everything through web UI

✅ Auto-Hosting

Model is live immediately

✅ Free Demo

Shareable chat interface

Note: Free tier has compute limits. For larger models or datasets, you may need Hugging Face Pro or compute credits.

⚠️ 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

Learn How →
🔄

Retrain & Compare

See the improvement:
• Export new dataset
• Retrain model!
• Compare results!

Export updated datasets from the EdukaAI application.

💡 The Iteration Loop

Add Data
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.