Transformers documentation

Axolotl

You are viewing main version, which requires installation from source. If you'd like regular pip install, checkout the latest stable version (v5.22.1).
Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

Axolotl

Axolotl は、大規模言語モデル向けのファインチューニングおよびポストトレーニングフレームワークです。アダプターベースのチューニング、ND-並列分散学習、GRPO、QAT をサポートしています。TRL を通じて、Axolotl は好み学習、強化学習、報酬モデリングのワークフローも処理します。

YAML設定ファイルでトレーニング実行を定義します。

base_model: NousResearch/Nous-Hermes-llama-1b-v1
model_type: AutoModelForCausalLM
tokenizer_type: AutoTokenizer

datasets:
  - path: tatsu-lab/alpaca
    type: alpaca

output_dir: ./outputs
sequence_len: 512
micro_batch_size: 1
gradient_accumulation_steps: 1
num_epochs: 1
learning_rate: 2.0e-5

train コマンドで学習を開始します。

axolotl train my_config.yml

Transformers の統合

AxolotlのModelLoaderは、Transformersの読み込みフローをラップします。

  • モデルのconfigはAutoConfig.from_pretrained()から構築されます。Preload setupでは、device map、quantization config、attention backendを設定します。

  • ModelLoader は、AutoModel クラス(AutoModelForCausalLM、AutoModelForImageTextToText、AutoModelForSequenceClassification)またはマルチモーダルマッピングからのモデル固有のクラスを自動的に選択します。重みは、選択されたローダーの from_pretrained で読み込まれます。reinit_weights が設定されている場合、Axolotl は from_config を使用してランダム初期化を行います。

  • Axolotl は、LoRA や QLoRA などの PEFT ベースの手法が有効な場合、モデルの初期化後にアダプターを適用するために Transformers、PEFT、および bitsandbytes を使用します。パッチマネージャーは、モデルの読み込み前後に追加の最適化を適用します。

  • AxolotlTrainer は Trainer を継承し、Axolotl のミックスインを追加するとともに、Trainer のトレーニングループと API を利用します。

リソース

Update on GitHub