دفاتر الملاحظات والبرامج والبذور القابلة لإعادة الإنتاج
اضبط البذور العشوائية لتتكرر النتائج
دفاتر الملاحظات والبرامج والبذور القابلة لإعادة الإنتاج درس مجاني في Deep Learning Academy على CoddyKit. هذا هو الدرس 3 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Deep Learning Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Deep Learning Academy 4 دروس في المجموع.
بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.
Two Ways to Work
You will write code in notebooks for quick experiments and in plain scripts for repeatable runs. Each suits a different moment.
Notebooks for Exploring
A notebook runs code in cells, showing plots and results inline. It is perfect for poking at data and trying ideas fast. 📓
Scripts for Real Runs
A script runs top to bottom in one go. Use it for training jobs you want to launch, share, and reproduce exactly.
python train.pyWatch Out for Cell Order
Notebook cells keep state even when you run them out of order, which can hide bugs. A script always starts from a clean slate.
The Reproducibility Problem
Deep learning uses random numbers for weights and shuffling. Run twice and you get different results unless you control that randomness.
Seeds to the Rescue
A seed fixes the starting point of the random number generator, so the same code produces the same numbers every single run.
Seed PyTorch
Set PyTorch's generator with one call. manual_seed makes weight initialization and any torch randomness repeatable.
torch.manual_seed(42)Don't Forget NumPy and Python
Your code often pulls randomness from NumPy and Python too, so seed all three to make a run fully reproducible.
import numpy as np, random
np.random.seed(42)
random.seed(42)Seed the GPU Too
When you train on CUDA, also seed the GPU generators. cuda.manual_seed_all covers every GPU device in your machine.
torch.cuda.manual_seed_all(42)Wrap It in a Function
Bundle every seed call into one set_seed helper. Call it at the top of each run so you never forget a source of randomness.
def set_seed(s):
torch.manual_seed(s)
np.random.seed(s)Why It Matters
Reproducible runs let you compare experiments fairly. If accuracy improves, you know it was your change, not random luck.
Quick Check
Recall what makes a run repeatable.
Recap
You saw when to use notebooks versus scripts and how seeding torch, NumPy, and Python makes every run reproducible. 🌱
تعلم 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 منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 3 من أصل 4.
كم من الوقت يستغرق درس «دفاتر الملاحظات والبرامج والبذور القابلة لإعادة الإنتاج»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس Deep Learning Academy هذا؟
نعم. كل درس في Deep Learning Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- تثبيت PyTorch والتحقق من استيراده
- CPU مقابل GPU مقابل MPS: اختر جهازًا
- دفاتر الملاحظات والبرامج والبذور القابلة لإعادة الإنتاج
- أول torch.tensor لك