# Saving and Loading a Model

joblib.dump writes a trained model to a file and joblib.load brings it back with the same guesses, as long as you save the whole pipeline, load it with the same scikit-learn version it was saved with, and only ever load files you or someone you trust made, because loading one can run any code inside it.

![Cheat sheet: Saving and Loading a Model](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/33de80ba28e6404f987a273b602b2b03.webp)

- Category: Machine Learning
- Level: Journeyman
- Tags: ai, joblib, Model Persistence, pickle, Pipeline (python), python, Version Pinning
- Author: Gregor Dzierzon
- Updated: November 23, 2026

Source: https://www.ask-codey.com/cheat-sheets/ml-saving-a-model-cheat-sheet
