Qlora를 사용하여 중국의 큰 언어 모델을 미세 조정하십시오.
Qlora를 사용하여 Baichuan-7b를 미세 조정하면 코드가 더 간결합니다 : https://github.com/taishan1994/baichuan-qlora-tuning
numpy == 1.24 . 2
pandas == 2.0 . 0
nltk == 3.7
transformers == 4.30 . 0. dev0
accelerate == 0.20 . 0. dev0
deepspeed == 0.9 . 2
peft == 0.4 . 0. dev0
datasets == 2.12 . 0
evaluate == 0.2 . 2
sentencepiece == 0.1 . 97
scipy == 1.10 . 1
icetk
cpm_kernels
mpi4py == 3.1 . 4 - - output #训练保存lora权重
- - - - chatglm
- - - - alpaca
- - - - bloom
- - data
- - - - msra
- - - - - - instruct_data
- - - - - - - - train . json #指令数据
- - model_hub
- - - - BELLE - 7 B - 2 M #bloom权重
- - - - chatglm - 6 b #chatGLM权重
- - - - 7 B : #英文LLaMA原始权重
- - - - 7 B - hf : #英文权重转换为hugging face格式权重
- - - - chinese - llama - plus - lora - 7 b : #中文llama-7b的lora权重
- - - - chinese - alpaca - plus - lora - 7 b : #中文alpaca-7b的lora权重
- - - - chinese - alpaca - 7 b : #合并lora后的最终的模型
- - - - tokenizer . model : #原始llama的7B文件
- - - - convert_llama_weights_to_hf . py #llama转换为hugging face格式
- - - - merge_llama_with_chinese_lora . py #合并lora到预训练模型
- - tools
- - - - get_version . py #获取python包版本
- - - - get_used_gpus . py #循环打印使用的GPU显卡
- - chat . py # 闲聊
- - qlora . py # 4bit训练
- - process . py # 测试处理数据Chatglm-6b 다운로드 주소 : Tsinghua University Cloud Disk (tsinghua.edu.cn)
python qlora . py - - model_name = "chatglm" - - model_name_or_path = "./model_hub/chatglm-6b" - - trust_remote_code = True - - dataset = "msra" - - source_max_len = 128 - - target_max_len = 64 - - do_train - - save_total_limit = 1 - - padding_side = "left" - - per_device_train_batch_size = 8 - - do_eval - - bits = 4 - - save_steps = 10 - - gradient_accumulation_steps = 1 - - learning_rate = 1e-5 - - output_dir = "./output/chatglm/" - - lora_r = 8 - - lora_alpha = 32Facebook이 공식적으로 발표 한 LLAMA 모델은 상업용 사용이 금지되며 공무원은 공식 오픈 소스 모델 가중치가 없습니다 (이미 인터넷에는 많은 타사 다운로드 주소가 있지만). 해당 권한을 따르기 위해서는 현재 전체 모델 가중치를 게시하는 것이 불가능합니다. 이해하십시오 (현재 해외에서도 마찬가지입니다). 다운로드 주소를 직접 검색하십시오.
python convert_llama_weights_to_hf.py --input_dir ./ --model_size 7B --output_dir ./7B-hf . 오류 가보고 된 경우 : If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0 . pip install --upgrade protobuf==3.20.1 , 다음 : python convert_llama_weights_to_hf.py --input_dir ./ --model_size tokenizer_only --output_dir ./7B-hf . 마지막으로 7B-HF를 얻을 수 있습니다.python merge_llama_with_chinese_lora.py --base_model "./7B-hf" --lora_model "./chinese-llama-plus-lora-7b,chinese-alpaca-plus-lora-7b" --output_type "huggingface" --output_dir "./chinese-alpaca-7b" . 마지막으로 중국어 알파카 -7b를 얻을 수 있습니다. python qlora . py - - model_name = "chinese_alpaca" - - model_name_or_path = "./model_hub/chinese-alpaca-7b" - - trust_remote_code = False - - dataset = "msra" - - source_max_len = 128 - - target_max_len = 64 - - do_train - - save_total_limit = 1 - - padding_side = "right" - - per_device_train_batch_size = 8 - - do_eval - - bits = 4 - - save_steps = 10 - - gradient_accumulation_steps = 1 - - learning_rate = 1e-5 - - output_dir = "./output/alpaca/" - - lora_r = 8 - - lora_alpha = 32Belle-7B-2M 다운로드 주소 : Main (Huggingface.co)의 Bellegroup/Belle-7b-2m
python qlora . py - - model_name = "chinese_bloom" - - model_name_or_path = "./model_hub/BELLE-7B-2M" - - trust_remote_code = False - - dataset = "msra" - - source_max_len = 128 - - target_max_len = 64 - - do_train - - save_total_limit = 1 - - padding_side = "left" - - per_device_train_batch_size = 8 - - do_eval - - bits = 4 - - save_steps = 10 - - gradient_accumulation_steps = 1 - - learning_rate = 1e-5 - - output_dir = "./output/bloom/" - - lora_r = 8 - - lora_alpha = 32 python chat . py - - model_name "chatglm" - - base_model "./model_hub/chatglm-6b" - - tokenizer_path "./model_hub/chatglm-6b" - - lora_model "./output/chatglm/adapter_model" - - with_prompt - - interactive자신의 데이터를 훈련시키는 방법? 데이터 형식은 다음과 같습니다.
{
"data" : [
{ "instruction" : "" , "input" : "" , "output" : "" },
{ "instruction" : "" , "input" : "" , "output" : "" },
...
]
}그런 다음 데이터가 Qlora.py로 정의되는 위치에 고유 한 데이터 세트를 추가하십시오. 마지막으로, 명령을 실행할 때 관련 매개 변수를 직접 정의하십시오.
liucongg/chatglm-finetuning : chatglm-6b 모델을 기반으로, Freeze, Lora, P-Tuning 등과 관련된 미세 조정 다운 스트림 특정 작업이 수행됩니다 (github.com)
THUDM/ChatGLM-6B : ChatGLM-6B : 열린 이중 언어 대화 언어 모델 | 오픈 소스 이중 언어 대화 언어 모델 (github.com)
포옹/페프트 :? PEFT : 최신 매개 변수 효율적인 미세 조정. (github.com)
YMCUI/Chinese-Lllama-Alpaca : 중국 라마 & 알파카 대형 언어 모델 + 로컬 CPU/GPU 교육 배포 (중국 LLAMA & ALPACA LLMS) (github.com)
Lianjiatech/Belle : Belle : 모든 사람의 대형 언어 모델 엔진 (오픈 소스 중국어 대화 모델) (github.com)
Artidoro/Qlora : Qlora : 양자화 된 LLM의 효율적인 결합 (github.com)
어떤 친절한 사람, Kado, 당신은 최종 효과를 시도 할 수 있습니까? AutoDl을 임대하는 것만으로는 충분하지 않습니다