低い学習率でファインチューニングする
事前学習済みの重みを慎重に更新します
「低い学習率でファインチューニングする」はCoddyKit上の無料Deep Learning Academyレッスンです。 これはレッスン2/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはDeep Learning Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Deep Learning Academyコースには全4レッスンが含まれています。
このレッスンの一部はまだ翻訳されておらず、英語で表示されています。
Beyond Just the Head
Freezing the backbone is fast, but sometimes you want the whole model to adapt. Fine-tuning unfreezes it and trains everything together. 🔧
Unfreeze the Backbone
To fine-tune, you flip requires_grad back to True so the pretrained weights can move again during training.
for p in model.parameters():
p.requires_grad = TrueThe Danger of a Big Step
Those pretrained weights are already excellent. A large learning rate would overwrite them with noisy updates and destroy what they learned.
Go Gentle
The fix is a lower learning rate. Small steps nudge the pretrained weights toward your task without erasing their knowledge.
opt = torch.optim.Adam(model.parameters(), lr=1e-5)How Much Lower?
A common rule of thumb: use a learning rate ten to a hundred times smaller than you would for training from scratch.
Warm Up the Head First
A popular trick: train only the head for a few epochs, then unfreeze and fine-tune. This avoids a shock to the backbone early on.
Watch Validation Loss
Fine-tuning can quickly overfit a small dataset. Keep an eye on validation loss and stop as soon as it starts climbing.
Fewer Epochs Needed
Because the model already understands the data, fine-tuning usually converges in just a few epochs, not dozens.
Pair It With a Scheduler
A scheduler can shrink the learning rate further over time, letting the model settle gently into a good solution.
sched = torch.optim.lr_scheduler.CosineAnnealingLR(opt, T_max=5)Full Fine-Tune vs Frozen
Full fine-tuning needs more data and compute but reaches higher accuracy. Frozen training is cheaper. The tradeoff depends on your dataset size.
Keep the Best Checkpoint
Since fine-tuning can drift, save the model whenever validation accuracy improves so you never lose your best version.
Quick Check
You unfroze a pretrained model to fine-tune it. What learning rate should you use?
Recap
You unfroze the backbone, fine-tuned with a low learning rate, warmed up the head first, and watched validation to stop overfitting. 🎯
よくある質問
「低い学習率でファインチューニングする」レッスンは無料ですか?
はい。「低い学習率でファインチューニングする」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Deep Learning Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Deep Learning Academyコースには全4レッスンが含まれています。
「低い学習率でファインチューニングする」で何を学びますか?
事前学習済みの重みを慎重に更新します ブラウザで直接実行するハンズオンコードでDeep Learning Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。
Deep Learning Academyを始めるのに経験は必要ですか?
事前経験は必要ありません。CoddyKitのDeep Learning Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン2/4です。
「低い学習率でファインチューニングする」レッスンにはどのくらい時間がかかりますか?
ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。
このDeep Learning Academyレッスンでコードを書いて実行できますか?
はい。すべてのDeep Learning Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。
このコースのすべてのレッスン
- バックボーンを固定してヘッドを学習する
- 低い学習率でファインチューニングする
- レイヤーごとに変える学習率
- Hugging Faceモデルをファインチューニングする