0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

こんにちは。
最近、NVIDIA-Certified Associate: Generative AI and LLMs (NCA-GENL)を習得しました。
その際に知っておいた方が良い基礎知識とコードの書き方を共有したいと思います。
生成AIのチュートリアル:

  1. Gradient Checkpointing(勾配チェックポイント)とは?(トレーニングに使用)
    Gradient Checkpointing自体は2016年くらいからあった技術なのですが、大規模のモデル(LLM)で、もう一度注目を集めている技術です。
    Gradient Checkpointingは学習に必要なメモリ(sqrt(メモリ使用量))を節約し、オーバヘッドを減らす技術です。
    しかし、トレーニングの時間は10%から20%上昇します。

2.Gradient Checkpointingの構造
Gradient Checkpointingの目的はバックプロパゲーション(逆伝播)の最適化です。
output2.gif

  • フォワーディング(順伝播)の途中にある特定のポイント(「チェックポイント」と呼ばれる層の出力)でのアクティベーションのみを記憶。
  • バックプロパゲーション(逆伝播)の際に特定のチェックポイントから次のチェックポイントまでの間で勾配を計算する必要が生じた場合、保存されていない中間活性化値は、その場で再計算。

HuggingFaceでのやり方

from transformers import TrainingArguments
training_args = TrainingArguments(gradient_checkpointing=True)
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?