chinese-alpaca-plus-13b-hf

我要开发同款
匿名用户2024年07月31日
45阅读

技术信息

开源地址
https://modelscope.cn/models/AI-ModelScope/chinese-alpaca-plus-13b-hf
授权协议
other

作品详情

Chiese Alpaca Plus 13B Model

发布中文LLaMA-Plus, Alpaca-Plus 13B版本模型

发布中文LLaMA-Plus, Alpaca-Plus 13B版本,改进点如下:

  • 相比基础版进一步扩充了训练数据,其中LLaMA扩充至120G文本,Alpaca扩充至4.3M指令数据,重点增加了科学领域数据,涵盖:物理、化学、生物、医学、地球科学等
  • Alpaca训练时采用了更大的rak,相比基础版具有更低的验证集损失
  • Alpaca评测结果:13B获得74.3分,Plus-7B获得78.2分,Plus-13B获得80.8分,具体评测结果请参考效果评测
  • 多轮回复长度相比旧模型提升明显(可适当增大温度系数)
  • 知识问答、写作、翻译等方面效果显著提升

本模型是 decapoda-research/llama-13b-hf 底座模型 合并 ziqigyag/chiese-llama-plus-lora-13bziqigyag/chiese-alpaca-plus-lora-13b 两个LoRA权重, 并转化为HuggigFace版本权重(.bi文件),可以直接使用或者继续训练。

test case:

iput_text predict
为什么天空是蓝色的? 天空是蓝色的是因为大气中的气体分子散射了太阳光中的短波长蓝光,使得我们看到的天空呈现出蓝色。

release model weight

  • chiese-llama-plus-7b 模型权重链接:https://huggigface.co/milik/chiese-llama-plus-7b-merged
  • chiese-alpaca-plus-7b 模型权重链接:https://huggigface.co/shibig624/chiese-alpaca-plus-7b-hf
  • chiese-llama-plus-13b 模型权重链接:https://huggigface.co/shibig624/chiese-llama-plus-13b-hf
  • chiese-aplaca-plus-13b 模型权重链接:https://huggigface.co/shibig624/chiese-alpaca-plus-13b-hf

Usage

本项目开源在textge项目:textge,可支持llama模型,通过如下命令调用:

Istall package:

pip istall -U textge
from textge import LlamaModel
model = LlamaModel("llama", "shibig624/chiese-alpaca-plus-13b-hf")
r = model.predict(["用一句话描述地球为什么是独一无二的。"])
prit(r) # ['地球是独一无二的,因为它拥有独特的大气层、水循环、生物多样性以及其他自然资源,这些都使它成为一个独特的生命支持系统。']

Usage (HuggigFace Trasformers)

Without textge, you ca use the model like this:

First, you pass your iput through the trasformer model, the you get the geerated setece.

Istall package:

pip istall setecepiece
pip istall trasformers>=4.28.0
import torch
import trasformers
from trasformers import LlamaTokeizer, LlamaForCausalLM

def geerate_prompt(text):
    retur f"""Below is a istructio that describes a task. Write a respose that appropriately completes the request.

### Istructio:
{text}

### Respose:"""


tokeizer = LlamaTokeizer.from_pretraied('shibig624/chiese-alpaca-plus-13b-hf')
model = LlamaForCausalLM.from_pretraied('shibig624/chiese-alpaca-plus-13b-hf').half().cuda()
model.eval()

text = '为什么天空是蓝色的?'
prompt = geerate_prompt(text)
iput_ids = tokeizer.ecode(prompt, retur_tesors='pt').to('cuda')


with torch.o_grad():
    output_ids = model.geerate(
        iput_ids=iput_ids,
        max_ew_tokes=128,
        temperature=1,
        top_k=40,
        top_p=0.9,
        repetitio_pealty=1.15
    ).cuda()
output = tokeizer.decode(output_ids[0], skip_special_tokes=True)
prit(output.replace(text, '').strip())

output:

为什么天空是蓝色的?
天空是蓝色的是因为大气中的气体分子散射了太阳光中的短波长蓝光,使得我们看到的天空呈现出蓝色。

示例代码

from modelscope.utils.costat import Tasks
from modelscope.pipelies import pipelie
pipe = pipelie(task=Tasks.text_geeratio, model='AI-ModelScope/chiese-alpaca-plus-13b-hf', model_revisio='v1.0.0', device_map='auto')
iputs="请猜一猜: 我闻起来很香,但吃起来却很辣。是什么?"
result = pipe(iputs, max_ew_tokes=128, temperature=0.4, top_k=20, top_p=0.8, repetitio_pealty=2.0, do_sample=True)
prit(result['text'])

模型来源

release合并后的模型权重,一步到位直接使用,省电、减少碳排放。

基于 多LoRA权重合并(适用于Chiese-Alpaca-Plus )方法手动合并而成,具体是使用 decapoda-research/llama-13b-hf 底座模型 合并 ziqigyag/chiese-llama-plus-lora-13bziqigyag/chiese-alpaca-plus-lora-13b 两个LoRA权重 得到,并转化为HuggigFace版本权重(.bi文件)。

HuggigFace版本权重(.bi文件)可用于:

  • 使用Trasformers进行训练和推理
  • 使用text-geeratio-webui搭建界面

PyTorch版本权重(.pth文件)可用于:

  • 使用llama.cpp工具进行量化和部署

PyTorch版本权重(.pth文件)链接:shibig624/chiese-alpaca-plus-13b-pth

模型文件组成:

chiese-alpaca-plus-13b-hf
|-- cofig.jso
|-- geeratio_cofig.jso
|-- LICENSE
|-- pytorch_model-00001-of-00003.bi
|-- pytorch_model-00002-of-00003.bi
|-- pytorch_model-00003-of-00003.bi
|-- pytorch_model.bi.idex.jso
|-- README.md
|-- special_tokes_map.jso
|-- tokeizer_cofig.jso
`-- tokeizer.model

硬件要求:25G显存

微调数据集

我整理部分公开微调数据集:

  1. 50万条中文ChatGPT指令Belle数据集:BelleGroup/trai0.5MCN
  2. 100万条中文ChatGPT指令Belle数据集:BelleGroup/trai1MCN
  3. 5万条英文ChatGPT指令Alpaca数据集:50k Eglish Staford Alpaca dataset
  4. 5万条中文GPT4指令Alpaca数据集:shibig624/alpaca-zh
  5. 69万条中文指令Guaaco数据集(Belle50万条+Guaaco19万条):Chiese-Vicua/guaacobellemerge_v1.0

如果需要训练LLaMA模型,请参考https://github.com/shibig624/textge

Citatio

@software{textge,
  author = {Xu Mig},
  title = {textge: Implemetatio of laguage model fietue},
  year = {2023},
  url = {https://github.com/shibig624/textge},
}

Referece

  • https://github.com/ymcui/Chiese-LLaMA-Alpaca

功能介绍

Chinese Alpaca Plus 13B Model 发布中文LLaMA-Plus, Alpaca-Plus 13B版本模型 发布中文LLaMA-Plus, Alpaca-Plus 13B版本,

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论