Llama 3.1 PersianQA

Providerzpm
Categorydocument-question-answering
Licenseapache-2.0
Downloads475
Stars0

Overview

Llama 3.1 PersianQA is a specialized adaptation of the Llama 3.1 architecture, fine-tuned specifically for document-based question answering (QA) within the Persian language. For developers building RAG pipelines or knowledge retrieval systems for Farsi-speaking markets, this model bridges the gap between general-purpose LLMs and the linguistic nuances of Persian. It is designed to extract precise information from provided contexts, reducing hallucinations compared to base multilingual models. Integration is straightforward for those already using the Llama ecosystem, offering a drop-in replacement for tasks requiring high-fidelity Persian comprehension and synthesis while maintaining an Apache-2.0 open license for commercial flexibility.

Highlights

  • Optimized for Persian language document question answering
  • Reduced hallucinations in Farsi-based RAG pipelines
  • Seamless integration with existing Llama 3.1 workflows
  • Permissive Apache-2.0 license for commercial deployment

Usage

Install
# Install Hugging Face transformers
pip install transformers torch
SDK Usage
# Load model with transformers
from transformers import AutoModel, AutoTokenizer

model = AutoModel.from_pretrained("zpm/Llama-3.1-PersianQA")
tokenizer = AutoTokenizer.from_pretrained("zpm/Llama-3.1-PersianQA")

Hugging Face Download

We recommend downloading the model via the Hugging Face CLI or Hub SDK.

Guidance:Before downloading, install huggingface_hub with:

Guidance
pip install -U huggingface_hub

CLI Download

Download the full repository

Download the full repository
huggingface-cli download zpm/Llama-3.1-PersianQA

Download a single file to a local folder (e.g. config.json into ./dir)

Download a single file to a local folder (e.g. config.json into ./dir)
huggingface-cli download zpm/Llama-3.1-PersianQA config.json --local-dir ./dir

See the official docs for more CLI options

SDK Download

SDK Download
# 模型下载
from huggingface_hub import snapshot_download
model_dir = snapshot_download('zpm/Llama-3.1-PersianQA')

Git Download

Make sure git-lfs is installed first

Git Download
git lfs install
git clone https://huggingface.co/zpm/Llama-3.1-PersianQA

To skip LFS large-file downloads, use:

Skip LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/zpm/Llama-3.1-PersianQA

Model files are hosted on the Hugging Face Hub — download directly via HF CLI / SDK / Git, not through this site.

PyTorch / Transformers Usage

Install Transformers

Install Transformers
pip install -U transformers torch

Load the model and run inference

Load the model and run inference
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained('zpm/Llama-3.1-PersianQA')
tokenizer = AutoTokenizer.from_pretrained('zpm/Llama-3.1-PersianQA')

Full Documentation

来源: HuggingFace

---
base_model: Meta-Llama-3.1-8B-bnb-4bit
language:

  • en

  • fa

license: apache-2.0
tags:
  • text-generation-inference

  • transformers

  • llama

  • trl

  • QA

pipeline_tag: document-question-answering
---

---
language: fa
tags:
- question-answering
- llama3
- Persian
- QA
license: apache-2.0
model_name: Llama-3.1-PersianQA
---

Model Card for Llama-3.1-PersianQA

Model Description

The Llama-3.1-PersianQA model is a fine-tuned version of Llama3 for Persian question-answering tasks. This model is designed to provide accurate answers to questions posed in Persian, based on the provided context. It has been trained on a dataset specific to Persian language QA tasks to enhance its performance in understanding and generating responses in Persian.

Intended Use

This model is intended for use in applications requiring Persian language question answering. It can be integrated into chatbots, virtual assistants, and other systems where users interact in Persian and need accurate responses to their questions based on a given context.

Use Cases

  • Customer Support: Automate responses to customer queries in Persian.
  • Educational Tools: Provide assistance and answers to questions in Persian educational platforms.
  • Content Retrieval: Extract relevant information from Persian texts based on user queries.

Training Data

The model was fine-tuned on a Persian question-answering dataset, which includes various domains and topics to ensure generalization across different types of questions. The dataset used for training contains question-context pairs and corresponding answers in Persian.

Model Architecture

  • Base Model: Llama3
  • Task: Question Answering
  • Language: Persian

Performance

The model has been evaluated on a set of Persian QA benchmarks and performs well across various metrics. Performance may vary depending on the specific domain and nature of the questions.

How to Use

You can use the Llama-3.1-PersianQA model with the Hugging Face transformers library. Here is a sample code to get started:

```python
from transformers import pipeline

Load the model

qa_pipeline = pipeline("question-answering", model="zpm/Llama-3.1-PersianQA")

Example usage

context = "شرکت فولاد مبارکۀ اصفهان، بزرگ‌ترین واحد صنعتی خصوصی در ایران و بزرگ‌ترین مجتمع تولید فولاد در خاورمیانه است." question = "شرکت فولاد مبارکه در کجا واقع شده است؟"

result = qa_pipeline(question=question, context=context)
print(result)

Join our Telegram