{"id":1710,"library":"skops","title":"Skops","description":"Skops is a set of tools designed for machine learning in production, focusing on model persistence, sharing, and documentation. It provides secure object dumping/loading, integrates with Hugging Face Hub for sharing, and helps generate Model Cards. The library is currently at version 0.13.0 and maintains a regular release cadence, typically monthly or bi-monthly, addressing bug fixes, enhancements, and security improvements.","status":"active","version":"0.13.0","language":"en","source_language":"en","source_url":"https://github.com/skops-dev/skops","tags":["machine-learning","model-management","persistence","huggingface","serialization","model-card"],"install":[{"cmd":"pip install skops","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Core machine learning library for model persistence and integration.","package":"scikit-learn"},{"reason":"Backend for efficient model serialization.","package":"joblib"},{"reason":"Required for integrating with the Hugging Face Hub (model sharing).","package":"huggingface_hub"},{"reason":"Fundamental package for numerical computing, common for ML models.","package":"numpy"},{"reason":"Data manipulation library, often used with ML models.","package":"pandas"}],"imports":[{"symbol":"dump","correct":"from skops.io import dump"},{"symbol":"load","correct":"from skops.io import load"},{"symbol":"Card","correct":"from skops.card import Card"},{"symbol":"push","correct":"from skops.hub import push"}],"quickstart":{"code":"from sklearn.linear_model import LogisticRegression\nfrom skops.io import dump, load\n\n# Train a simple model\nmodel = LogisticRegression(random_state=42)\nmodel.fit([[0, 0], [0, 1], [1, 0], [1, 1]], [0, 0, 1, 1])\n\n# Save the model securely\ndump(model, 'model.skops')\n\n# Load the model\nloaded_model = load('model.skops')\n\n# Make a prediction with the loaded model\nprediction = loaded_model.predict([[0, 0]])\nprint(f\"Original model class: {type(model).__name__}\")\nprint(f\"Loaded model class: {type(loaded_model).__name__}\")\nprint(f\"Prediction: {prediction[0]}\")","lang":"python","description":"This quickstart demonstrates how to train a basic scikit-learn model, save it using `skops.io.dump`, and then load it back using `skops.io.load`. This is the most common use case for skops, providing a secure and robust way to persist machine learning models."},"warnings":[{"fix":"Always set `trusted=False` (which is the default) for `skops.io.load` when loading from untrusted sources. For `skops.card.Card`, explicitly set `allow_insecure_loading=False` (available from v0.13.0) or ensure the source is trusted. Carefully review the source of any model or card before loading.","message":"Loading untrusted models or Model Cards from external sources can lead to arbitrary code execution due to pickle's security vulnerabilities. Skops offers security mechanisms like the `trusted` argument for `skops.io.load` and `allow_insecure_loading` for `skops.card.Card`.","severity":"breaking","affected_versions":"All versions"},{"fix":"Document the exact versions of `skops` and all major dependencies (`scikit-learn`, `numpy`, `pandas`, etc.) used to save a model. Ideally, recreate the environment using tools like `pip-tools` or `conda` to ensure consistent dependency versions when loading.","message":"Model persistence is highly sensitive to library versions. Models saved with one version of `skops`, `scikit-learn`, `numpy`, or other dependencies might not load or behave identically with significantly different versions.","severity":"gotcha","affected_versions":"All versions"},{"fix":"After using `skops convert`, always thoroughly test and verify the converted model's behavior and predictions to ensure it functions as expected. Consider the original file the definitive source unless verified.","message":"The `skops convert` CLI command, designed to convert model files (e.g., `joblib` to `skops`), is a 'best-effort' attempt and does not guarantee an exact, bit-for-bit identical conversion.","severity":"gotcha","affected_versions":"All versions (explicitly warned from v0.11.0)"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}