Documentation Index
Fetch the complete documentation index at: https://wb-21fd5541-john-wbdocs-2044-rename-serverless-products.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Hugging Face AutoTrain は、自然言語処理 (NLP) タスク、コンピュータービジョン (CV) タスク、音声タスク、さらに表形式データのタスク向けに、最先端のモデルをトレーニングするためのコード不要のツールです。
W&B は Hugging Face AutoTrain に直接統合されており、実験管理と設定管理を利用できます。CLI コマンドで1つのパラメーターを指定するだけで、実験で簡単に使用できます。
autotrain-advanced と wandb をインストールします。
pip install --upgrade autotrain-advanced wandb
!pip install --upgrade autotrain-advanced wandb
これらの変更点を示すため、このページでは数学データセットで LLM をファインチューニングし、GSM8k Benchmarks の pass@1 で SoTA の結果を達成します。
Hugging Face AutoTrain で正しく動作させるには、CSV のカスタムデータセットを特定の形式にする必要があります。
-
トレーニングファイルには、トレーニングで使用する
text 列が含まれている必要があります。最適な結果を得るには、text 列のデータを ### Human: Question?### Assistant: Answer. 形式に従わせる必要があります。優れた例として、timdettmers/openassistant-guanaco を参照してください。
ただし、MetaMathQA dataset には query、response、type の各列が含まれています。まず、このデータセットを前処理します。type 列を削除し、query 列と response 列の内容を結合して、### Human: Query?### Assistant: Response. 形式の新しい text 列を作成してください。トレーニングには、こうして作成したデータセット rishiraj/guanaco-style-metamath を使用します。
コマンドラインまたはノートブックから autotrain advanced を使用してトレーニングを開始できます。--log 引数を使用するか、--log wandb を使用して結果を W&B Run にログできます。
autotrain llm \
--train \
--model HuggingFaceH4/zephyr-7b-alpha \
--project-name zephyr-math \
--log wandb \
--data-path data/ \
--text-column text \
--lr 2e-5 \
--batch-size 4 \
--epochs 3 \
--block-size 1024 \
--warmup-ratio 0.03 \
--lora-r 16 \
--lora-alpha 32 \
--lora-dropout 0.05 \
--weight-decay 0.0 \
--gradient-accumulation 4 \
--logging_steps 10 \
--fp16 \
--use-peft \
--use-int4 \
--merge-adapter \
--push-to-hub \
--token <huggingface-token> \
--repo-id <huggingface-repository-address>
# ハイパーパラメーターを設定
learning_rate = 2e-5
num_epochs = 3
batch_size = 4
block_size = 1024
trainer = "sft"
warmup_ratio = 0.03
weight_decay = 0.
gradient_accumulation = 4
lora_r = 16
lora_alpha = 32
lora_dropout = 0.05
logging_steps = 10
# トレーニングを実行
!autotrain llm \
--train \
--model "HuggingFaceH4/zephyr-7b-alpha" \
--project-name "zephyr-math" \
--log "wandb" \
--data-path data/ \
--text-column text \
--lr str(learning_rate) \
--batch-size str(batch_size) \
--epochs str(num_epochs) \
--block-size str(block_size) \
--warmup-ratio str(warmup_ratio) \
--lora-r str(lora_r) \
--lora-alpha str(lora_alpha) \
--lora-dropout str(lora_dropout) \
--weight-decay str(weight_decay) \
--gradient-accumulation str(gradient_accumulation) \
--logging-steps str(logging_steps) \
--fp16 \
--use-peft \
--use-int4 \
--merge-adapter \
--push-to-hub \
--token str(hf_token) \
--repo-id "rishiraj/zephyr-math"