Clone with HTTP
git clone https://www.modelscope.cn/zhanghuiATchina/zhangxiaobai_shishen_full_4bit.git
<食神(全量4bit量化版)>介绍
本模型是基于InternLM-chat-7B预训练模型,通过 XiaChuFang Recipe Corpus食谱语料库进行FineTune,训练出来的微调模型。
模型通过1,520,327种菜谱进行了1个epoch的微调训练,并进行4bit量化。
模型描述
本模型是用于实现咨询菜谱的对话。
期望模型使用方式以及适用范围
使用gradio或者streamlit调用就行了。本地也可以直接使用命令行方式调用。
安装
创建conda环境
conda create -n shishen4bit python=3.10 -y
conda activate shishen4bit
安装依赖
conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia
pip install modelscope==1.11.0 transformers==4.36.0 accelerate tiktoken einops scipy transformers_stream_generator==0.0.4 peft -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install ninja sentencepiece -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install lmdeploy==0.2.2 -i https://pypi.tuna.tsinghua.edu.cn/simple
#请确保CUDA版本跟前面pytorch的版本一致
git clone https://github.com/Dao-AILab/flash-attention -b v1.0.8
cd flash-attention
pip install .
或者
pip install flash-attention -i https://pypi.tuna.tsinghua.edu.cn/simple
如何使用
编辑download.py:
import torch
from modelscope import AutoTokenizer, AutoModelForCausalLM
model_name_or_path = "zhanghuiATchina/zhangxiaobai_shishen_full_4bit"
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(model_name_or_path,trust_remote_code=True,device_map='auto').eval()
#response, history = model.chat(tokenizer, "你好", history=[])
#print(response)
#response, history = model.chat(tokenizer, "酸菜鱼怎么做", history=history)
#print(response)
执行 python download.py。
切换到下载好的模型权重目录 zhangxiaobaishishenfull4bit (一般是 ~/.cache/modelscope/hub/zhanghuiATchina/zhangxiaobaishishenfull4bit)
编辑pipeline.py
from lmdeploy import pipeline, TurbomindEngineConfig, ChatTemplateConfig
model_name_or_path = "./zhangxiaobai_shishen_full_4bit"
pipe = pipeline(model_name_or_path,
backend_config=TurbomindEngineConfig(model_format='awq'),
chat_template_config=ChatTemplateConfig(model_name='internlm-chat-7b')
)
response = pipe(["酸菜鱼怎么做", "水煮鱼怎么做"])
print(response)
执行 python pipeline.py。
训练数据介绍
XiaChuFang Recipe Corpus
● 发布方:清华大学,百度,北京通用人工智能研究院
● 发布时间:2020
● 简介: 完整的食谱语料库包含1,520,327种中国食谱。其中,1,242,206食谱属于30,060菜肴。一道菜平均有41.3个食谱。食谱的平均长度是224个字符。最大长度为62,722个字符,最小长度为10个字符。食谱由415,272位作者贡献。其中,最有生产力的作者上传5,394食谱。我们提供脱敏的作者信息。
● 下载地址: https://opendatalab.org.cn/XiaChuFangRecipeCorpus
● 论文地址: https://arxiv.org//pdf/2210.114
模型训练流程
后续补充
数据评估及结果
后续补充
相关论文以及引用信息
后续补充
评论