Explore Library
Code QuizAdvanced

Saving a Model with Pickle

Spot the file-mode mistake when serializing a trained model to disk.

Codepython
import pickle

def save_model(model, path):
    with open(path, "w") as f:
        pickle.dump(model, f)
    print(f"Saved model to {path}")

What is the bug in this model-saving code?