Downloads · 30 days
10
23% of all-time downloads
atrisaxena/Qwen2.5-0.5B-KidBot-LoRA
Qwen2.5-0.5B-KidBot-LoRA is a machine learning model from atrisaxena. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for peft. The card lists the license as apache-2.0.
A fine-tuned LoRA adapter on top of GPTQ 4-bit quantized Qwen/Qwen2.5-1.5B-Instruct, trained to act as a friendly robot assistant for children aged 5-12.
Downloads · 30 days
10
23% of all-time downloads
All-time downloads
44
Public
Repo size
293 MB
Likes
0
Public
Click a slice to open those files.
.safetensors211 MB · 57%
From the Hugging Face model README
A fine-tuned LoRA adapter on top of GPTQ 4-bit quantized Qwen/Qwen2.5-1.5B-Instruct, trained to act as a friendly robot assistant for children aged 5-12.
| Property | Value |
|---|---|
| Base Model | Qwen/Qwen2.5-1.5B-Instruct |
| Quantization | GPTQ 4-bit (group_size=128) |
| Fine-tuning | QLoRA (LoRA rank=16, alpha=32) |
| Dataset | Custom children Q&A (43 samples) |
| Epochs | 5 |
| Target Modules | q/k/v/o_proj, gate/up/down_proj |
from gptqmodel import GPTQModel
from peft import PeftModel
from transformers import AutoTokenizer
BASE_MODEL = "Qwen/Qwen2.5-1.5B-Instruct"
LORA_MODEL = "atrisaxena/Qwen2.5-0.5B-KidBot-LoRA"
# Load base quantized model + LoRA adapters
base_model = GPTQModel.load(BASE_MODEL, device_map="auto")
model = PeftModel.from_pretrained(base_model, LORA_MODEL)
tokenizer = AutoTokenizer.from_pretrained(LORA_MODEL)
SYSTEM_PROMPT = (
"You are KidBot, a cheerful and patient robot assistant installed to help children "
"aged 5-12. You answer their silly and curious questions in a fun, simple, and "
"encouraging way. You also help them with homework in maths, science, and English "
"using easy examples, emojis, and relatable comparisons. Always be warm, positive, "
"and make learning feel like an adventure!"
)
def ask_kidbot(question):
messages = [
{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": question},
]
prompt = tokenizer.apply_chat_template(
messages, tokenize=False, add_generation_prompt=True
)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
output = model.generate(**inputs, max_new_tokens=150, temperature=0.7, do_sample=True)
reply = tokenizer.decode(output[0], skip_special_tokens=True)
return reply.split("assistant\n")[-1].strip()
print(ask_kidbot("Why is the sky blue?"))
print(ask_kidbot("What are fractions?"))