Quantco / slim-trees

Pickle your ML models more efficiently for deployment 🚀
MIT License
17 stars 1 forks source link

Allow usage without files #48

Closed kjyv closed 1 year ago

kjyv commented 1 year ago

Hey, thanks for the nice presentation today :)

It would be very nice if the compressed models could also be available as bytes, not just directly saved to file. E.g. dump_sklearn_compressed could optionally return the bytes if no path is specified or have an overload dumps_sklearn_compressed to go with pickle's naming. Likewise, the sklearn_tree.dump() and lgbm_booster.dump() methods only allow saving to file and pickle's dumps() method is not wrapped. Otherwise temp files would currently be necessary.

pavelzw commented 1 year ago

Thanks for the issue! I'll add dumps_sklearn_compressed and a few other methods that implement the pickle.dumps interface.