rajeshthangaraj1/uae-banking-rulebook-qa
Viewer • Updated • 491k • 32 • 1
How to use rajeshthangaraj1/uae_rule_book_QA_assistant with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("question-answering", model="rajeshthangaraj1/uae_rule_book_QA_assistant") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("rajeshthangaraj1/uae_rule_book_QA_assistant")
model = AutoModelForCausalLM.from_pretrained("rajeshthangaraj1/uae_rule_book_QA_assistant")rajeshthangaraj1/uae_rule_book_QA_assistant
Base Model: [unsloth/LFM2-1.2B](https://docs.unsloth.ai/)
RegulaUAE-1.2B is a domain-specific conversational language model fine-tuned to answer questions strictly grounded in the UAE Central Bank Rulebook (Banking Regulations).
The model is designed to support regulatory, compliance, and educational use cases, with a strong focus on reduced hallucination within the UAE banking domain. Tested against CBUAE regulatory queries.
Coverage includes:
Publicly available content from the official UAE Central Bank Rulebook:
https://rulebook.centralbank.ae
Each chunk was used as grounded context to generate question–answer pairs.
Dataset structure:
{
"context": "Rulebook text chunk",
"question": "Regulatory question",
"answer": "Answer grounded in the context"
}
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
model_id = "rajeshthangaraj1/uae_rule_book_QA_assistant"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
device_map="auto",
torch_dtype=torch.bfloat16
)
messages = [
{"role": "system", "content":
"You are an assistant specialized in the UAE Central Bank Rulebook. "
"Only answer based on the UAE Rulebook. "
"If the answer is not in the Rulebook, reply 'Not found in UAE Rulebook'."},
{"role": "user", "content":
"According to the UAE Central Bank Rulebook – Capital Adequacy Section, "
"what does Article (2) specify about minimum capital ratios?"}
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
return_tensors="pt"
).to(model.device)
inputs.pop("token_type_ids", None)
outputs = model.generate(**inputs, max_new_tokens=128)
answer = tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True)
print(answer)
import gradio as gr
def chat_with_model(message, history):
# (your chat_with_model function here)
...
gr.ChatInterface(fn=chat_with_model, title="UAE Rulebook QA Assistant").launch()
✍️ Author: @rajeshthangaraj1
📅 Last Updated: 2026