Downloads · 30 days
7
11% of all-time downloads
sangtran12/eduflowai-gemma4b-adapter-qlora
eduflowai-gemma4b-adapter-qlora is a text generation model from sangtran12. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as gemma.
This repository provides the official QLoRA (4-bit NF4) fine-tuned adapter for unsloth/gemma-3-4b-it, specifically optimized for Vietnamese National High School Graduation Exam (VNHSGE) question extraction and structu…
Downloads · 30 days
7
11% of all-time downloads
All-time downloads
66
Public
Repo size
396 MB
Likes
0
Public
Click a slice to open those files.
.safetensors119 MB · 75%
From the Hugging Face model README
This repository provides the official QLoRA (4-bit NF4) fine-tuned adapter for unsloth/gemma-3-4b-it, specifically optimized for Vietnamese National High School Graduation Exam (VNHSGE) question extraction and structured quiz generation.
Part of Master's Thesis research at FPT University under the EduFlow Multi-Tenant SaaS LMS project.
unsloth/gemma-3-4b-it (Google Gemma 3 architecture, 4 billion parameters, 256k vocabulary)q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_projmax_grad_norm = 0.3| Metric | Measurement |
|---|---|
| Peak VRAM During Training | 13.3 GB (Feasible on consumer 16GB GPUs like RTX 4080 / T4) |
| Training Time (1 Epoch) | 21.7 minutes (84 steps, ~14.5s per step) |
| Final Training Loss | 2.6323 |
| Validation Loss | 10.09 |
| JSON Syntax Validity on Unseen Test Set | 100% Valid JSON |
| EduFlow Schema Compliance | 100% (type, content, options, correct_index, points) |
from unsloth import FastLanguageModel
import torch
# 1. Load fine-tuned adapter on 4-bit base model
model, tokenizer = FastLanguageModel.from_pretrained(
model_name = "sangtran12/eduflowai-gemma4b-adapter-qlora",
max_seq_length = 8192,
load_in_4bit = True,
)
FastLanguageModel.for_inference(model)
# 2. Format input prompt
messages = [
{
"role": "user",
"content": "Hãy trích xuất câu hỏi sau sang JSON: Câu 1: Kim loại nào sau đây có tính dẫn điện tốt nhất? A. Cu. B. Ag. C. Al. D. Au."
}
]
inputs = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt").to("cuda")
# 3. Generate structured quiz
outputs = model.generate(
input_ids=inputs,
max_new_tokens=2048,
temperature=0.1,
top_p=0.9,
eos_token_id=[tokenizer.eos_token_id, 106], # 106 is Gemma 3 <end_of_turn>
)
print(tokenizer.decode(outputs[0][inputs.shape[1]:], skip_special_tokens=True))
sangtran12/eduflowai-gemma4b-ggufsangtran12/eduflowai-gemma4b-adapter-lora