发布中文LLaMA-Plus, Alpaca-Plus 13B版本,改进点如下: 本模型是 decapoda-research/llama-13b-hf
底座模型 合并 ziqigyag/chiese-llama-plus-lora-13b
和 ziqigyag/chiese-alpaca-plus-lora-13b 两个LoRA权重,
并转化为HuggigFace版本权重(.bi文件),可以直接使用或者继续训练。 test case: 本项目开源在textge项目:textge,可支持llama模型,通过如下命令调用: Istall package: 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: output: release合并后的模型权重,一步到位直接使用,省电、减少碳排放。 基于 多LoRA权重合并(适用于Chiese-Alpaca-Plus )方法手动合并而成,具体是使用 decapoda-research/llama-13b-hf
底座模型 合并 ziqigyag/chiese-llama-plus-lora-13b 和 ziqigyag/chiese-alpaca-plus-lora-13b 两个LoRA权重 得到,并转化为HuggigFace版本权重(.bi文件)。 HuggigFace版本权重(.bi文件)可用于: PyTorch版本权重(.pth文件)可用于: PyTorch版本权重(.pth文件)链接:shibig624/chiese-alpaca-plus-13b-pth 模型文件组成: 硬件要求:25G显存 我整理部分公开微调数据集: 如果需要训练LLaMA模型,请参考https://github.com/shibig624/textgeChiese Alpaca Plus 13B Model
iput_text
predict
为什么天空是蓝色的?
天空是蓝色的是因为大气中的气体分子散射了太阳光中的短波长蓝光,使得我们看到的天空呈现出蓝色。
release model weight
Usage
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)
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())
为什么天空是蓝色的?
天空是蓝色的是因为大气中的气体分子散射了太阳光中的短波长蓝光,使得我们看到的天空呈现出蓝色。
示例代码
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'])
模型来源
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
微调数据集
Citatio
@software{textge,
author = {Xu Mig},
title = {textge: Implemetatio of laguage model fietue},
year = {2023},
url = {https://github.com/shibig624/textge},
}
Referece
点击空白处退出提示
评论