baichuan Qlora Tuning
1.0.0
Qlora를 기반으로, 지침은 Baichuan-7B Big Model에 미세 조정됩니다.
mpi4py
transformers == 4.28 . 1
peft == 0.3 . 0
icetk
deepspeed == 0.9 . 2
accelerate
cpm_kernels
sentencepiece == 0.1 . 99
peft = 0.3 . 0
torch = 2.0 . 0 최신 버전은 괜찮습니다.
--data
----msra
------train.txt
------eval.txt
--checkpoint
----baichuan
------adapter_model
--model_hub
----baichuan-7B
--baichuan_qlora.py # 训练
--dataset.py # 处理数据
--predict.py # 交互式闲聊
--test_baichuan.py # 测试baichuan模型
--train.log # 训练日志
TRAIN.TXT 및 EVAL.TXT의 데이터 형식은 동일하며 각 동작은 샘플입니다.
{ "instruct" : "你现在是一个实体识别模型,你需要提取文本里面的人名、地名、机构名,如果存在结果,返回'实体_实体类型',不同实体间用n分隔。如果没有结果,回答'没有'。" , "query" : "文本:因有关日寇在京掠夺文物详情,藏界较为重视,也是我们收藏北京史料中的要件之一。" , "answer" : "日_地名n京_地名n北京_地名" }명령은 명령어, 쿼리는 텍스트이며 답변은 결과입니다. 자체 데이터에 따라 자체적으로 구성 할 수 있습니다.
이 세 열의 이름은 Baichuan_qlora.py에서 정의 할 수 있습니다.
Hugging Face로 이동하여 Baichuan-7b의 관련 파일을 Model_Hub/Baichuan-7B로 다운로드하십시오. 다운로드가 완료되면 python test_baichuan.pt 사용하여 모델을 테스트 할 수 있습니다. 데이터 세트를 구축 한 후 직접 실행하십시오.
python baichaun_qlora . py 교육이 완료되면 다음 지침을 사용하여 예측할 수 있습니다.
python predict . py - - model_name "baichuan" - - base_model "./model_hub/baichuan-7B" - - tokenizer_path "./model_hub/baichuan-7B" - - lora_model "./checkpoint/baichuan/adapter_model" - - with_prompt - - interactive예측 결과 :
加载模型耗时: 0.6068947672843933分钟
loading peft model
Start inference with instruction mode .
== == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == =
+ 当前使用的模型是: baichuan
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ 该模式下仅支持单轮问答,无多轮对话能力。
== == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == =
Input :你现在是一个实体识别模型,你需要提取文本里面的人名、地名、机构名,如果存在结果,返回'实体_实体类型' ,不同实体间用n分隔。如果没有结果,回答'没有' 。文本:我们是受到郑振铎先生、阿英先生著作的启示,从个人条件出发,瞄准现代出版史研究的空白,重点集藏解放区、国民党毁禁出版物。
Response : 郑振铎_人名
阿英_人名
Input :你现在是一个实体识别模型,你需要提取文本里面的人名、地名、机构名,如果存在结果,返回'实体_实体类型' ,不同实体间用n分隔。如果没有结果,回答'没有' 。文本:藏书家、作家姜德明先生在1997年出版的书话专集《文林枝叶》中以“爱书的朋友”为题,详细介绍了我们夫妇的藏品及三口之家以书为友、好乐清贫的逸闻趣事。
Response : 姜德明_人名
Input :你现在是一个实体识别模型,你需要提取文本里面的人名、地名、机构名,如果存在结果,返回'实体_实体类型' ,不同实体间用n分隔。如果没有结果,回答'没有' 。文本:去年,我们又被评为“北京市首届家庭藏书状元明星户”。
Response : 北京_地名특정 효과가 있지만별로 좋지는 않습니다. 더 오랜 시간 동안 매개 변수와 훈련을 조정해야 할 수도 있습니다.
예측 된 비디오 메모리 :

https://github.com/wp931120/baichuan_sft_lora
https://github.com/baichuan-inc/baichuan-7b
https://github.com/artidoro/qlora/
https://github.com/taishan1994/qlora-chinese-llm