0Pricing
NLP Academy · درس

تقييم النموذج وحفظه

تحقق من المقاييس وادفع النموذج إلى Hub

تقييم النموذج وحفظه درس مجاني في NLP Academy على CoddyKit. هذا هو الدرس 4 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في NLP Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة NLP Academy 4 دروس في المجموع.

بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.

Training Is Not Enough

A trained model is only useful if it generalizes. So your next job is to evaluate it on data it never saw during training.

Run Evaluation

The Trainer can score your validation set in one call and return the metrics you configured, like accuracy and loss.

print(trainer.evaluate())

Pick the Right Metric

Accuracy can mislead on skewed data. For uneven classes, lean on F1 so both precision and recall count.

Compute Metrics Cleanly

The evaluate library wraps common scores, so you compute F1 or accuracy without writing the math by hand.

import evaluate
f1 = evaluate.load("f1")

Hold Out a Test Set

Keep a separate test set you touch only once. It gives an honest final estimate, free of tuning bias.

Save the Model

Persist the fine-tuned weights to disk so you can reload them anytime without training again. This saves the model and tokenizer.

trainer.save_model("my-model")
tok.save_pretrained("my-model")

Reload Anywhere

Loading is the mirror of saving: point from_pretrained at your folder and the full model comes back ready to predict.

m = AutoModelForSequenceClassification.from_pretrained("my-model")

Wrap It in a Pipeline

Drop your saved model into a pipeline for instant, simple inference on fresh text without any manual tokenizing.

clf = pipeline("text-classification", model="my-model")

Share on the Hub

One push uploads your model to the Hugging Face Hub, so teammates load it by name from anywhere.

trainer.push_to_hub()

Version Your Work

The Hub tracks revisions like git, so each checkpoint stays reproducible and you can always roll back.

Document the Model

A model card records your data, metrics, and limits. It helps others trust and reuse what you built. 📋

Quick Check

Why keep a separate test set you evaluate only once?

Recap

Evaluate on unseen data with the right metric, save the model and tokenizer, then reload or push it to the Hub to share. ✅

الأسئلة الشائعة

هل درس «تقييم النموذج وحفظه» مجاني؟

نعم — نص درس «تقييم النموذج وحفظه» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة NLP Academy، انتقل إلى CoddyKit PRO. تتضمن دورة NLP Academy 4 دروس في المجموع.

ماذا ستتعلم في «تقييم النموذج وحفظه»؟

تحقق من المقاييس وادفع النموذج إلى Hub تتمرن على NLP Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.

هل أحتاج إلى خبرة سابقة لأبدأ NLP Academy؟

لا تُشترط خبرة سابقة. NLP Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 4 من أصل 4.

كم من الوقت يستغرق درس «تقييم النموذج وحفظه»؟

معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.

هل يمكنني كتابة وتشغيل أكواد في درس NLP Academy هذا؟

نعم. كل درس في NLP Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.

جميع الدروس في هذه الدورة

  1. جولة في مكتبة Transformers
  2. تقسيم النص لنماذج Transformer
  3. الضبط الدقيق باستخدام Trainer API
  4. تقييم النموذج وحفظه
← العودة إلى NLP Academy