Hi Liam, Not sure I have the complete context for what you are trying to do, but have you considered using Python multiprocessing to start a separate process? The lifecycle of that process could start when the Flask server starts-up or on the first request. The separate process would load and run the model. Depending on what you would like to do, some form of IPC mechanism, such as gRPC could be used to control or get updates from the model process.
Regards --Roland From: scikit-learn <[email protected]> on behalf of Aneto <[email protected]> Reply-To: Scikit-learn mailing list <[email protected]> Date: Thursday, December 20, 2018 at 8:21 AM To: "[email protected]" <[email protected]> Cc: Liam Geron <[email protected]> Subject: [scikit-learn] How to keep a model running in memory? Hi scikit learn community, We currently use scikit-learn for a model that generates predictions on a server endpoint. We would like to keep the model running in memory instead of having to re-load the model for every new request that comes in to the server. Can you please point us in the right direction for this? Any tutorials or examples. In case it's helpful, we use Flask for our web server. Thank you! Aneto
_______________________________________________ scikit-learn mailing list [email protected] https://mail.python.org/mailman/listinfo/scikit-learn
