LLAMA3에 대한 전체 매개 변수 미세 조정, LORA 미세 조정 및 Qlora 미세 조정을 수행하십시오. 또한 QWEN1.5 모델의 미세 조정도 지원됩니다. 다른 모델로 교체하려면 가장 중요한 것은 데이터를 전처리하는 것입니다.
2023/07/28 : Baichuan2-7B-Chat에 미세 튜닝을 추가하십시오.
2024/07/24 : LLAMA3.1-8B 비교에 미세 튜닝이 추가되었습니다. transformers==4.43.1 및 accelerate==0.33.0 .
2024/07/22 :
GLM-9B-Chat에 미세 조정을 추가하십시오. 참고 : Modeling_chatglm.py의 791 라인을 padding_mask = padding_mask.to(torch.bfloat16) 로 교체해야합니다. 필요한 변압기 버전은 4.42.4 입니다. 요구 사항에 패키지를 설치 한 후에는 변압기를 다시 설치해야합니다.
QWEN1.5-7B-Chat에 미세 조정을 추가했습니다.
QWEN2-7B 비교에 미세 조정을 추가하십시오.
YI1.5-6B-Chat에 미세 조정을 추가하십시오.
2024/07/19 : Internlm2.5에 미세 조정이 추가되었습니다. 참고 : Internlm2.5는 BF16을 사용하여 미세 조정을 지원하지 않으므로 FP16은 실행 명령에서 선택됩니다.
2024/10/04 : QWEN2.5-7B- 스트럭에 미세 조정을 추가했습니다. llama3.2-3b-무인에 미세 조정을 추가하십시오. pip install transformers --upgrade 및 pip install accelerate --upgrade .
장치 실행 : 24G 그래픽 메모리가있는 그래픽 카드를 사용하십시오.
python==3.8.8
pip install -r requirements.txt
데이터는 데이터에 저장되며 특정 형식은 다음과 같습니다.
[
{
"conversations" : [
{
"from" : " user " ,
"value" : "你是那个名字叫ChatGPT的模型吗? "
},
{
"from" : " assistant " ,
"value" : "我的名字是西西嘛呦,并且是通过家里蹲公司的大数据平台进行训练的。 "
}
]
}
...
]여러 라운드의 대화도 위의 형식의 데이터로 준비됩니다.
model_hub 폴더를 입력하고 python download_modelscope.py 실행하여 llama3-8b-instruct 모델을 다운로드하십시오.
스크립트 폴더를 입력하십시오.
기계 제한으로 인해 여기에는 전체 매개 변수 미세 조정이 없습니다. 조건이 있으면 시도해 볼 수 있습니다.
nproc_per_node 및 cuda_visible_devices가 지정한 그래픽 카드 수는 일관성이 있어야합니다.
NCCL_P2P_DISABLE=1
NCCL_IB_DISABLE=1
CUDA_VISIBLE_DEVICES=0,1,2,4,5,6,7
torchrun
--nproc_per_node 7
--nnodes 1
--node_rank 0
--master_addr localhost
--master_port 6601
../finetune_llama3.py
--model_name_or_path " ../model_hub/LLM-Research/Meta-Llama-3-8B-Instruct/ "
--data_path " ../data/Belle_sampled_qwen.json "
--bf16 True
--output_dir " ../output/llama3_8B_lora "
--num_train_epochs 100
--per_device_train_batch_size 1
--per_device_eval_batch_size 1
--gradient_accumulation_steps 8
--evaluation_strategy " no "
--save_strategy " steps "
--save_steps 5
--save_total_limit 1
--learning_rate 1e-5
--weight_decay 0.1
--adam_beta2 0.95
--warmup_ratio 0.01
--lr_scheduler_type " cosine "
--logging_steps 1
--report_to " none "
--model_max_length 4096
--gradient_checkpointing True
--lazy_preprocess True
--deepspeed " ../config/ds_config_zero3_72B.json "
--use_loranproc_per_node 및 cuda_visible_devices가 지정한 그래픽 카드 수는 일관성이 있어야합니다. Qlora를 사용하여 단일 4090에 대한 교육을 완료하십시오.
NCCL_P2P_DISABLE=1
NCCL_IB_DISABLE=1
CUDA_VISIBLE_DEVICES=0,1,2,4,5,6,7
torchrun
--nproc_per_node 7
--nnodes 1
--node_rank 0
--master_addr localhost
--master_port 6601
../finetune_llama3.py
--model_name_or_path " ../model_hub/LLM-Research/Meta-Llama-3-8B-Instruct/ "
--data_path " ../data/Belle_sampled_qwen.json "
--bf16 True
--output_dir " ../output/llama3_8B_qlora "
--num_train_epochs 100
--per_device_train_batch_size 1
--per_device_eval_batch_size 1
--gradient_accumulation_steps 16
--evaluation_strategy " no "
--save_strategy " steps "
--save_steps 5
--save_total_limit 1
--learning_rate 1e-5
--weight_decay 0.1
--adam_beta2 0.95
--warmup_ratio 0.01
--lr_scheduler_type " cosine "
--logging_steps 1
--report_to " none "
--model_max_length 4096
--gradient_checkpointing True
--lazy_preprocess True
--deepspeed " ../config/ds_config_zero2.json "
--use_lora
--load_in_4bit
--q_lora훈련 후 추론 :
问题: 在互联网普及的时代,社交媒体已经成为了现代人生活中不可缺少的一部分。从微信、微博、 Facebook到Twitter 、 Instagram等等,社交媒体不仅满足了人们交流互动的需求,同时让人们更加容易地分享自己的生活瞬间、获取新闻资讯、找到志同道合的人群以及推广自己的业务。然而,与此同时,社交媒体也带来了一系列问题,如滥用个人信息、泄露隐私等。因此,如何正确地使用社交媒体已经成为了一个备受关注的话题。,总结上面这段文本的几个关键词
微调前结果: Arrrr , shiver me timbers ! Ye be wantin ' me to summarize the key words from that there text , eh ? Alright then , matey ! Here be the main points :
1. Social media ( the scourge o ' the seven seas ... er , I mean , the modern world )
2. Communication ( the lifeblood o ' the pirate' s existence ... er , I mean , the need for people to interact )
3. Sharing ( the treasure o ' the digital age... er, I mean, the ability to share one' s life moments )
4. Information ( the booty o ' the internet ... er , I mean , the news and knowledge shared online )
5. Privacy ( the anchor o ' security... er, I mean, the need to protect one' s personal info )
6. Correct usage ( the map to avoidin ' the rocky shores o' social media misuse ... er , I mean , the importance of using social media responsibly )
So hoist the colors , me hearties , and remember to use social media like a proper pirate : with caution , respect , and a keen eye for treasure !
微调后结果: 社交媒体、交流、分享、隐私、滥用信息코드는 주로 다음을 나타냅니다.
모델은 모델 범위에서 다운로드 할 수 있습니다.