Instructions to use Azizkhan22/qwen3-8b-hadi with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Azizkhan22/qwen3-8b-hadi with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Azizkhan22/qwen3-8b-hadi", device_map="auto") - PEFT
How to use Azizkhan22/qwen3-8b-hadi with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
Hadi - Islamic Assistant (LoRA Adapter for Qwen3-8B)
This repository contains a LoRA adapter fine-tuned on Qwen3-8B to build an Islamic AI assistant named Hadi. The model is designed to be used in RAG (Retrieval-Augmented Generation) systems for providing accurate, context-aware Islamic guidance based on retrieved knowledge.
π§ Model Overview
- Base Model: Qwen3-8B
- Fine-tuning Method: LoRA (Low-Rank Adaptation)
- LoRA Rank (r): 64
- Task: Islamic Question Answering / Assistant behavior tuning
- Assistant Name: Hadi
- Framework: Hugging Face Transformers + PEFT
π Training Dataset
The model was fine-tuned using the following dataset:
π Dataset Repository:
Azizkhan22/hadi-islamic-assistant-instruction-dataset
The dataset contains curated Islamic question-answer pairs designed to improve:
- Quran and Hadith-based responses
- Ethical and daily life guidance in Islamic context
- Safe, respectful, and non-extremist responses
βοΈ Intended Use
This adapter is designed for use in RAG pipelines, where external knowledge is retrieved and passed to the model.
Typical Workflow:
- Retrieve relevant Islamic knowledge from a vector database (FAISS, pgvector, Pinecone, etc.)
- Pass retrieved context + user query to the model
- Generate grounded responses using Hadi
π§© How to Load the Adapter
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base_model_name = "Qwen/Qwen3-8B"
model = AutoModelForCausalLM.from_pretrained(
base_model_name,
device_map="auto",
torch_dtype="auto"
)
model = PeftModel.from_pretrained(
model,
"YOUR_HF_USERNAME/hadi-qwen3-8b-lora"
)
tokenizer = AutoTokenizer.from_pretrained(base_model_name)
π¬ Example System Prompt (Recommended for Inference)
You are Hadi, an Islamic assistant.
You provide answers based on authentic Islamic teachings and retrieved context when available.
If context is provided, prioritize it. If not, answer cautiously and avoid speculation.
Always remain respectful and avoid extreme or unsupported claims.
π§ RAG Integration Notes
This model is designed to work well with retrieval systems. Common embedding models used in similar setups include:
- bge-large
- e5-large
You can store and retrieve knowledge using:
- FAISS
- PostgreSQL + pgvector
- Pinecone / Weaviate
Always inject retrieved context into the prompt before generation.
β οΈ Limitations
- This model is not a replacement for qualified Islamic scholarship
- Always verify answers with authentic scholarly sources
- May hallucinate if used without proper RAG grounding
π Citation
If you use this model, please cite:
Hadi: LoRA-adapted Islamic assistant based on Qwen3-8B using PEFT
β€οΈ Acknowledgements
- Qwen Team for the base model
- Hugging Face Transformers & PEFT
- Open-source Islamic knowledge resources used in dataset construction