Downloads · 30 days
0
Kowshik24/Bangla-llama-3.2-3B-Instruct-QA-v2
Bangla-llama-3.2-3B-Instruct-QA-v2 is a text generation model from Kowshik24. Use it when you need the model to write or continue text. The card lists the license as apache-2.0.
<bBengali Question-Answering Model</b | Fine-tuned on Llama-3 Architecture | Version 2
Downloads · 30 days
0
Access
Public
Updated May 30, 2025
Repo size
309 MB
Likes
1
Public
Click a slice to open those files.
.safetensors97.3 MB · 85%
From the Hugging Face model README
<b>Bengali Question-Answering Model</b> | Fine-tuned on Llama-3 Architecture | Version 2
This model is optimized for question-answering in the Bengali language. It is fine-tuned using Llama-3-3B architecture with Unsloth. The model is trained on a context-aware instruct dataset, designed to generate accurate and relevant responses.
pip install transformers torch accelerate
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
import torch
model_name = "Kowshik24/Bangla-llama-3.2-3B-Instruct-QA-v2"
# Load model and tokenizer
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype=torch.bfloat16,
device_map="auto"
)
# Setting up system and user prompts
messages = [
{
"role": "system",
"content": "১৯৫২ সালের ২১ ফেব্রুয়ারি বাংলা ভাষাকে পাকিস্তানের রাষ্ট্রভাষা হিসেবে স্বীকৃতি দেওয়ার দাবিতে ঢাকা বিশ্ববিদ্যালয়ের ছাত্ররা বিক্ষোভ করে। পুলিশের গুলিতে শহিদ হন রফিক, সালাম, বরকতসহ অনেকে। এই আন্দোলনের ফলস্বরূপ ১৯৫৬ সালে বাংলা রাষ্ট্রভাষার মর্যাদা পায় এবং পরবর্তীতে UNESCO ১৯৯৯ সালে ২১ ফেব্রুয়ারিকে আন্তর্জাতিক মাতৃভাষা দিবস ঘোষণা করে।"
},
{
"role": "user",
"content": "ভাষা আন্দোলনের দিনটি কোন তারিখে পালিত হয়?"
},
]
# Processing chat template
input_ids = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
return_tensors="pt"
).to(model.device)
# Generating the answer
outputs = model.generate(
input_ids,
max_new_tokens=256,
temperature=0.01,
do_sample=True,
pad_token_id=tokenizer.eos_token_id,
)
# Decoding the output
full_response = tokenizer.decode(outputs[0], skip_special_tokens=True)
answer = full_response.split("assistant\n\n")[-1].strip()
print("Answer:", answer)
Answer: ২১ ফেব্রুয়ারি
| Parameter | Value | Explanation |
|---|---|---|
temperature | 0.01 | Low creativity (deterministic) |
max_new_tokens | 256 | Maximum output length |
torch_dtype | bfloat16 | Memory optimization |
This model is designed following ethical guidelines. It should not be used to generate harmful content.
If this model helps you in your work, please cite it as follows:
@INPROCEEDINGS{11013841,
author={Debanath, Koshik and Aich, Sagor and Srizon, Azmain Yakin},
booktitle={2025 International Conference on Electrical, Computer and Communication Engineering (ECCE)},
title={Advancing Low-Resource NLP: Contextual Question Answering for Bengali Language Using Llama},
year={2025},
volume={},
number={},
pages={1-6},
keywords={Adaptation models;Large language models;Computational modeling;Transfer learning;LoRa;Reinforcement learning;Benchmark testing;Question answering (information retrieval);Multilingual;Synthetic data;Natural Language Processing;Question Answering;Large Language Models;Llama Model;Fine-Tuning;Bengali Dataset},
doi={10.1109/ECCE64574.2025.11013841}}
For questions or suggestions, email: [email protected]