HuggingFace镜像/ArabianGPT-0.3B-QA
模型介绍文件和版本分析
下载使用量0

ArabianGPT 模型概述

大语言模型(LLMs)文本生成使用免责声明

对于 ArabianGPT-0.3B 生成的任何伤害、不准确信息或不当内容,我们不承担任何责任,用户使用和应用模型输出的风险由其自行承担。

什么是 ArabianGPT-0.3B 问答模型?

我们邀请您使用 ArabianGPT 0.3B 微调模型在特定数据集范围内执行问答任务。建议您查看我们的演示示例,以了解该模型的能力和局限性,尤其要注意当问题超出其训练范围时,其性能可能会下降。

使用方法

import argparse

import torch
from openmind import pipeline, is_torch_npu_available
from openmind_hub import snapshot_download
import time

def parse_args():
    parser = argparse.ArgumentParser(description="Eval the model")
    parser.add_argument(
        "--model_name_or_path",
        type=str,
        help="Path to the model",
       default="zhouhui/ArabianGPT-0.3B-QA",
        )
    args = parser.parse_args()
    return args


def main():
    args = parse_args()
    model_path = args.model_name_or_path
    if is_torch_npu_available():
        device = "npu:0"
    elif torch.cuda.is_available():
        device = "cuda:0"
    else:
        device = "cpu"
    #device = "cpu"
    start_time = time.time()
    qa = pipeline("question-answering", model=model_path, tokenizer=model_path, device=device)
    qa_input = {
            "question": "Why is model conversion important?",
            "context": "The option on convert models between FARM and openmind gives freedom to the user and let people easily switch between frameworks."
    }
    ans = qa(qa_input)
    print()
    print(ans)
    print()
    end_time = time.time()
    print(f"硬件环境:{device},推理执行时间:{end_time - start_time}秒")


if __name__ == "__main__":
    main()

致谢

特别感谢苏丹王子大学,尤其是机器人与物联网实验室。

联系方式

如需咨询:riotu@psu.edu.sa。