Downloads · 30 days
77
59% of all-time downloads
greta44/albanian-spelling-lora
albanian-spelling-lora is a text generation model from greta44. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
LoRA adapter for automatic generation of Albanian spelling exercises (primary-school orthography), trained for PhD research in educational NLP.
Downloads · 30 days
77
59% of all-time downloads
All-time downloads
131
Public
Repo size
28.9 MB
Likes
0
Public
Click a slice to open those files.
.json14.2 MB · 56%
From the Hugging Face model README
LoRA adapter for automatic generation of Albanian spelling exercises (primary-school orthography), trained for PhD research in educational NLP.
Qwen/Qwen2.5-0.5B-Instructr=16, alpha=32)sq)greta44/albanian-error-augmentationSafety note: Treat model output as a proposal only. For children, the final correct answer must come from deterministic Albanian rules / a curated database — not from the LLM alone.
Generate short Albanian orthography exercise proposals, for example:
missing_letter — plotëso shkronjënfind_error — gjej gabiminexplain_error — shpjego gabimin (pedagogjikisht)pip install torch transformers peft accelerate sentencepiece
import json
import torch
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
ADAPTER_ID = "greta44/albanian-spelling-lora"
BASE_MODEL = "Qwen/Qwen2.5-0.5B-Instruct"
tokenizer = AutoTokenizer.from_pretrained(ADAPTER_ID, use_fast=True)
if tokenizer.pad_token is None:
tokenizer.pad_token = tokenizer.eos_token
model = AutoModelForCausalLM.from_pretrained(BASE_MODEL)
model = PeftModel.from_pretrained(model, ADAPTER_ID)
model.eval()
device = "cuda" if torch.cuda.is_available() else "cpu"
model.to(device)
seed_word = "mirë"
grade = 3
exercise_type = "missing_letter" # or: find_error, explain_error
payload = {
"seed_word": seed_word,
"grade": grade,
"difficulty": "easy",
"exercise_type": exercise_type,
"safety": "Kthe vetëm propozim; përgjigjja finale kontrollohet nga rregullat.",
}
prompt = (
"### Instruksion:\n"
f"Gjenero një ushtrim të sigurt për drejtshkrimin shqip. Kategoria: {exercise_type}. "
f"Klasa: {grade}. Vështirësia: easy. Fjala bazë: {seed_word}.\n\n"
"### Input:\n"
+ json.dumps(payload, ensure_ascii=False)
+ "\n\n### Përgjigje:\n"
)
inputs = tokenizer(prompt, return_tensors="pt").to(device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=120,
temperature=0.4,
top_p=0.9,
do_sample=True,
pad_token_id=tokenizer.eos_token_id,
)
text = tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True)
print(text.strip())
python generate_exercises.py \
--adapter greta44/albanian-spelling-lora \
--seed-word mirë \
--grade 3 \
--type missing_letter
| Item | Value |
|---|---|
| Train / eval split | 686 / 77 (from 763 AlbLingo exercises, seed=42) |
| LoRA rank / alpha / dropout | 16 / 32 / 0.05 |
| Target modules | q_proj, k_proj, v_proj, o_proj |
| Max length | 256 |
| Effective batch size | 4 |
| Hardware | Apple M1 (MPS, float32) |
| Protocol target | 3 epochs |
| Reported run | instrumented Phase A + Phase B continuation (~1.4 epoch-equivalent) |
| Train loss | 3.149 → min 0.276 |
| Held-out eval_loss | 0.345 |
| Approx. wall-clock | ~62 minutes (logged span) |
See training_manifest.json in this repository for the full measured summary, and training_loss.png for the loss curve.
adapter_model.safetensors + adapter_config.json — LoRA weightstokenizer* / vocab.json / merges.json — tokenizer filesgenerate_exercises.py — standalone demo scripttraining_manifest.json — hyperparameters + measured metricstraining_loss.png — training loss curveinstruction_dataset.jsonl — sample instruction pairsIf you use this model, please cite the related PhD research on Albanian educational NLP / AlbLingo and link this repository.
Apache 2.0