LLMの前削除と微調整のスクリプト(SFT)
Lora&Deepspeedがサポートされています
リポジトリは、TATSU-LAB/STANFORD_ALPACAに基づいています。
継続的なトレーニング前LLMを開始する前に、モデル名(ハギングフェイス)またはローカルモデルパスを提供する必要があります。
トレーニングデータを準備すると、プレーンテキストをMarkdownまたはTXTの形式で使用することができます。この例は、Neurips Impact Statementを書くためのガイドです。データフォルダーにテキストコーパスを追加できます。
打ち上げ
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 :llama-2にはpad_tokenがないため、 "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の構成を調整できます。実験では、バイチュアンの場合、トランスフォーマーバージョンは> = 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