صيغة نموذج MLflow
حزّم النماذج مع اعتمادياتها وتوقيعها.
صيغة نموذج MLflow درس مجاني في MLOps Academy على CoddyKit. هذا هو الدرس 2 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في MLOps Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة MLOps Academy 4 دروس في المجموع.
بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.
Beyond a Raw File
A bare pickle is just bytes. MLflow wraps your model in a self-describing folder so anyone can load it without guessing how. 📦
What Is a Flavor?
An MLflow flavor is a known format, like sklearn or pytorch, that tells MLflow exactly how to save and load that model.
One Model, Many Flavors
A single saved model can carry several flavors. That lets different tools load it their own way from the same artifact.
Save with a Flavor
Use the matching module to log a model. For scikit-learn you call mlflow.sklearn.log_model inside a run.
import mlflow.sklearn
mlflow.sklearn.log_model(model, name='model')The MLmodel File
Every saved model has an MLmodel YAML file listing its flavors, signature, and how to reload it. It is the model's ID card.
Dependencies Travel Too
MLflow records the libraries your model needs in a conda.yaml or requirements file, so the same environment can be rebuilt later.
The pyfunc Flavor
Most models also get the universal pyfunc flavor. It exposes one simple predict call, no matter the framework underneath. 🔑
Load as pyfunc
Loading via pyfunc gives you a generic object with predict, so your serving code stays the same across frameworks.
import mlflow.pyfunc
m = mlflow.pyfunc.load_model('runs:/<id>/model')
m.predict(X)Load Back Native
You can also reload in the original framework with the matching loader, getting the full native object instead of the generic wrapper.
model = mlflow.sklearn.load_model('runs:/<id>/model')Custom pyfunc Models
No built-in flavor fits? Subclass PythonModel and write your own predict to wrap any logic into the pyfunc format.
class MyModel(mlflow.pyfunc.PythonModel):
def predict(self, ctx, X):
return self.run(X)Why It Matters
Flavors make a model truly portable: training, registry, and serving all speak the same format without bespoke glue code.
Quick Check
Let's check your grasp of MLflow flavors.
Recap
An MLflow model is a self-describing folder with flavors, an MLmodel file, and pinned deps, loadable natively or as universal pyfunc. 🎉
الأسئلة الشائعة
هل درس «صيغة نموذج MLflow» مجاني؟
نعم — نص درس «صيغة نموذج MLflow» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة MLOps Academy، انتقل إلى CoddyKit PRO. تتضمن دورة MLOps Academy 4 دروس في المجموع.
ماذا ستتعلم في «صيغة نموذج MLflow»؟
حزّم النماذج مع اعتمادياتها وتوقيعها. تتمرن على MLOps Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ MLOps Academy؟
لا تُشترط خبرة سابقة. MLOps Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 2 من أصل 4.
كم من الوقت يستغرق درس «صيغة نموذج MLflow»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس MLOps Academy هذا؟
نعم. كل درس في MLOps Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- التسلسل باستخدام Pickle وJoblib
- صيغة نموذج MLflow
- التصدير إلى ONNX لإتاحة النقل
- تحديد توقيع النموذج ومخططه