Downloads · 30 days
19
10% of all-time downloads
azeddinShr/LFM2-1.2B-RAG-ARABIC-LoRA
LFM2-1.2B-RAG-ARABIC-LoRA is a question answering model from azeddinShr. Use it when the input is a question plus a passage. It is set up for transformers. The card lists the license as apache-2.0.
Fine-tuned version of LiquidAI/LFM2-1.2B-RAG for Arabic reading comprehension and question answering tasks using LoRA (Low-Rank Adaptation) technique.
Downloads · 30 days
19
10% of all-time downloads
All-time downloads
186
Public
Parameters
1.2B
2.3 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors2.3 GB · 100%
From the Hugging Face model README
Fine-tuned version of LiquidAI/LFM2-1.2B-RAG for Arabic reading comprehension and question answering tasks using LoRA (Low-Rank Adaptation) technique.
This model specializes in extractive question answering for Arabic text. It has been fine-tuned using LoRA on the Arabic Reading Comprehension Dataset (ARCD) to improve its ability to answer questions based on provided context in Modern Standard Arabic.
Key Features:
Can be further fine-tuned for:
Not recommended for:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
# Load model and tokenizer
model_id = "azeddinShr/LFM2-1.2B-RAG-ARABIC-LoRA"
model = AutoModelForCausalLM.from_pretrained(
model_id,
device_map="auto",
torch_dtype=torch.bfloat16,
)
tokenizer = AutoTokenizer.from_pretrained(model_id)
# Prepare input
context = "نيوم هو مشروع ضخم في شمال غرب السعودية بتكلفة 500 مليار دولار."
question = "ما هي تكلفة مشروع نيوم؟"
prompt = f"استخدم السياق التالي للإجابة على السؤال:\n\n{context}\n\nالسؤال: {question}"
# Generate answer
messages = [{"role": "user", "content": prompt}]
input_ids = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
return_tensors="pt"
).to(model.device)
with torch.no_grad():
outputs = model.generate(
input_ids,
max_new_tokens=150,
temperature=0.0,
do_sample=False,
pad_token_id=tokenizer.eos_token_id
)
answer = tokenizer.decode(outputs[0][input_ids.shape[1]:], skip_special_tokens=True)
print(answer) # Output: 500 مليار دولار
Fine-tuning method: LoRA (Low-Rank Adaptation)
Hyperparameters:
Training infrastructure:
If you use this model in your research or application, please cite:
@misc{lfm2-rag-arabic-lora,
author = {Azeddin sahir},
title = {LFM2-1.2B-RAG Arabic (LoRA Fine-tuned)},
year = {2025},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/azeddinShr/lfm2-1.2b-arabic-qa-lora}}
}
Same as based model
For questions, issues, or collaboration opportunities, please open an issue in the model repository, contact via Hugging Face, or email me directly at [email protected].