الضبط الدقيق بمعدل تعلّم أقل
حدّث الأوزان المدرَّبة مسبقًا برفق
الضبط الدقيق بمعدل تعلّم أقل درس مجاني في Deep Learning Academy على CoddyKit. هذا هو الدرس 2 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 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. 🎯
تعلم Python مع معلم ذكاء اصطناعي — مجانًا
اكتب وقم بتشغيل أكوادك الفعلية في المتصفح، واحصل على مساعدة فورية من معلم ذكاء اصطناعي متاح 24/7، واستمر من حيث توقفت على الويب أو في التطبيق.
- الدورات
- 30
- الدروس
- 120
الأسئلة الشائعة
هل درس «الضبط الدقيق بمعدل تعلّم أقل» مجاني؟
نعم — نص درس «الضبط الدقيق بمعدل تعلّم أقل» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Deep Learning Academy، انتقل إلى CoddyKit PRO. تتضمن دورة Deep Learning Academy 4 دروس في المجموع.
ماذا ستتعلم في «الضبط الدقيق بمعدل تعلّم أقل»؟
حدّث الأوزان المدرَّبة مسبقًا برفق تتمرن على Deep Learning Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ Deep Learning Academy؟
لا تُشترط خبرة سابقة. Deep Learning Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 2 من أصل 4.
كم من الوقت يستغرق درس «الضبط الدقيق بمعدل تعلّم أقل»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس Deep Learning Academy هذا؟
نعم. كل درس في Deep Learning Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- جمّد Backbone ودرّب Head
- الضبط الدقيق بمعدل تعلّم أقل
- معدلات تمييزية حسب الطبقة
- ضبط نموذج Hugging Face دقيقًا