ปรับละเอียดด้วยอัตราการเรียนรู้ที่ต่ำลง
ปรับน้ำหนักที่ฝึกไว้ล่วงหน้าอย่างค่อยเป็นค่อยไป
ปรับละเอียดด้วยอัตราการเรียนรู้ที่ต่ำลง เป็นบทเรียน Deep Learning Academy ฟรีบน CoddyKit นี่คือบทเรียนที่ 2 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน 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. 🎯
คำถามที่พบบ่อย
บทเรียน “ปรับละเอียดด้วยอัตราการเรียนรู้ที่ต่ำลง” ฟรีหรือไม่
ใช่ — ข้อความเต็มของ “ปรับละเอียดด้วยอัตราการเรียนรู้ที่ต่ำลง” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส Deep Learning Academy ให้อัปเกรดเป็น CoddyKit PRO คอร์ส Deep Learning Academy มีบทเรียนทั้งหมด 4 บทเรียน
คุณจะเรียนรู้อะไรในบทเรียน “ปรับละเอียดด้วยอัตราการเรียนรู้ที่ต่ำลง”
ปรับน้ำหนักที่ฝึกไว้ล่วงหน้าอย่างค่อยเป็นค่อยไป คุณปฏิบัติ Deep Learning Academy ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน
คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Deep Learning Academy หรือไม่
ไม่จำเป็นต้องมีประสบการณ์มาก่อน Deep Learning Academy บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 2 จากทั้งหมด 4 บทเรียน
บทเรียน “ปรับละเอียดด้วยอัตราการเรียนรู้ที่ต่ำลง” ใช้เวลานานแค่ไหน
บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย
ฉันเขียนและรันโค้ดในบทเรียน Deep Learning Academy นี้ได้ไหม
ได้ บทเรียน Deep Learning Academy ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ
บทเรียนทั้งหมดในหลักสูตรนี้
- ตรึงแกนหลักแล้วฝึกส่วนหัว
- ปรับละเอียดด้วยอัตราการเรียนรู้ที่ต่ำลง
- อัตราการเรียนรู้จำแนกตามชั้น
- ปรับละเอียดโมเดล Hugging Face