0

I tried to compress a pickle file representing a PyCaret model.

import joblib
joblib.dump('my_file.pkl',  'new_file.pkl.z',compress=3)

The above code didn't work.

How can I reduce the size of a pickle file for PyCaret models?

Jeong Kim
  • 481
  • 3
  • 9
  • 21

1 Answers1

1

There is no need to call the joblib.dump function yourself, you should call the PyCaret save function directly on the loaded model as follows:

from pycaret.regression import load_model, save_model

your_model = load_model('my_file.pkl')
save_model(your_model, f'my_file.pkl', **{"compress":3})

Example above is for a regression model

For reference: Pycaret calls the jolib.dump function here passing any given kwargs.

keith.g
  • 900
  • 9
  • 19