สคริปต์ของ LLM pretraining และ finetuing (SFT)
รองรับ Lora & Deepspeed
ที่เก็บจะขึ้นอยู่กับ tatsu-lab/stanford_alpaca
ก่อนที่คุณจะเริ่มการฝึกอบรมก่อนการฝึกอบรมอย่างต่อเนื่องคุณควรระบุชื่อรุ่น (HuggingFace) หรือเส้นทางโมเดลท้องถิ่น
เตรียมข้อมูลการฝึกอบรมคุณสามารถใช้ข้อความธรรมดาในรูปแบบของ markdown หรือ txt สำหรับการเตรียมการ ตัวอย่างเป็นแนวทางในการเขียนคำสั่ง Impact Neurips คุณสามารถเพิ่มคลังข้อความเพิ่มเติมในโฟลเดอร์ข้อมูล
ปล่อย
pip install -r requirements.txt
cd llm_pretrain
./pretrain_llama.sh
โปรดทราบว่าการตั้งค่าพารามิเตอร์บางอย่างของรุ่นเหล่านี้แตกต่างกัน
ก่อนที่คุณจะเริ่มปรับแต่ง LLM คุณควรระบุชื่อรุ่น (HuggingFace) หรือเส้นทางโมเดลท้องถิ่น
เตรียมข้อมูลการฝึกอบรมคุณสามารถเพิ่มข้อมูลงานของคุณเองเช่นตัวอย่างใน sft_examples.json ซึ่งคล้ายกับ alpaca_data.json
รูปแบบมีดังนี้:
{
"binary_selection": [
{
"instruction": "Does the following text violate the law?nText: OH MY FUCKING GOD",
"output": "No"
},
...
],
"another_task_name": [
{
"instruction": "How are you?",
"output": "Not bad."
},
...
],
...
}
โปรดทราบว่าหากคุณใส่ alpaca_data.json ในโฟลเดอร์ข้อมูลสคริปต์จะใช้เป็นส่วนหนึ่งของข้อมูลการฝึกอบรม
LLAMA-2 : เนื่องจากไม่มี pad_token ใน llama-2 ขอแนะนำให้คุณสามารถเพิ่ม 'tokenizer.pad_token = tokenizer.unk_token' ลงในโทเคนิเซอร์
pip install -r requirements.txt
cd llm_sft
./train_llama.sh
pip install -r requirements.txt
cd llm_sft
./train_baichuan_LORA.sh
คุณสามารถปรับการกำหนดค่าใน train_lora.py ในการทดลองของเราสำหรับ Baichuan เวอร์ชัน Transformers ของคุณควร> = 4.29.0 และ <4.34.0
โปรดทราบว่าการตั้งค่าพารามิเตอร์บางอย่างของรุ่นเหล่านี้แตกต่างกัน
หากคุณต้องการใช้ DeepSpeed ให้ใช้คำสั่งต่อไปนี้:
--deepspeed "./configs/default_offload_opt_param.json"
.
├── LICENSE
├── README.md
├── llm_pretrain_clean
│ ├── data
│ │ └── A_Guide_to_Writing_the_NeurIPS_Impact_Statement.md
│ ├── evaluation
│ │ └── inference_single.py
│ ├── generate_pretrain_data.py
│ ├── pretrain.py
│ ├── pretrain_baichuan2.sh
│ ├── pretrain_llama.sh
│ ├── pretrain_mistral.sh
│ ├── requirementsX.txt
│ └── utils.py
└── sft_model_clean
├── README.md
├── configs
│ └── default_offload_opt_param.json
├── data
│ ├── alpaca_data.json
│ └── sft_examples.json
├── evaluation
│ └── inference_single.py
├── generate_sft_data.py
├── requirementsX.txt
├── train.py
├── train_baichuan.sh
├── train_baichuan_LORA.sh
├── train_llama.sh
├── train_lora.py
├── train_mistral.sh
└── utils.py