Llama 3.1 PersianQA

提供商zpm
分类document-question-answering
许可证apache-2.0
下载量475
星标0

简介

Llama 3.1 PersianQA 是基于 Meta Llama 3.1 架构针对波斯语问答场景优化的专项模型。它专注于文档问答(DocQA)任务,能够高效地从波斯语文本中提取关键信息并给出精准回答。对于需要处理中东地区语言数据的开发者来说,该模型解决了通用模型在特定语种下理解力不足的问题。由于继承了 Llama 3.1 的强大底座,其上手难度低,兼容主流推理框架,非常适合集成到针对波斯语市场的知识库或自动化客服系统中。

核心亮点

  • 基于 Llama 3.1 架构,波斯语理解能力强
  • 专为文档问答优化,信息提取精准度高
  • Apache-2.0 开源协议,商业部署无压力
  • 适配主流 AI 推理工具,集成开发成本低

使用方法

安装依赖
# 安装 Hugging Face transformers
pip install transformers torch
SDK 使用
# 使用 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 下载

我们推荐使用命令行或者 Hugging Face Hub SDK 来进行模型的下载。

操作指引:在下载前,请先通过如下命令安装 huggingface_hub:

操作指引
pip install -U huggingface_hub

命令行下载

下载完整模型库

下载完整模型库
huggingface-cli download zpm/Llama-3.1-PersianQA

下载单个文件到指定本地文件夹(以下载 config.json 到当前路径下 ./dir 目录为例)

下载单个文件到指定本地文件夹(以下载 config.json 到当前路径下 ./dir 目录为例)
huggingface-cli download zpm/Llama-3.1-PersianQA config.json --local-dir ./dir

更多命令行下载选项,可参见官方文档

SDK 下载

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

Git 下载

请确保 lfs 已经被正确安装

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

如果您希望跳过 lfs 大文件下载,可以使用如下命令

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

模型文件托管在 Hugging Face Hub,使用 HF CLI / SDK / Git 直接下载,不经过本站。

PyTorch / Transformers 使用

安装 Transformers

安装 Transformers
pip install -U transformers torch

模型加载和推理

模型加载和推理
from transformers import AutoModelForCausalLM, AutoTokenizer

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

完整文档

来源: 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)