cuml icon indicating copy to clipboard operation
cuml copied to clipboard

POC for improved model state serialization

Open viclafargue opened this issue 2 years ago • 5 comments

At the moment, cuML's models can only be serialized thanks to Pickle. This proof of concept PR uses Google's Protocol Buffer library (Protobuf) to serialize the state of cuML models. This allows :

  • Importation from Python as previously, but as well from C++ or any language for which we could build bindings to libcuml
  • In the future, this could provide a convenient data structure to hold content of models for C++ users
  • More compact serialization files
  • Possibility to have the whole cuML library as a Triton backend or at least produce an equivalent simpler gRPC inference server.

In this example (see pytest) a LinearRegression model is trained, serialized to disk, deserialized and finally tested for the correctness of its predictions.

viclafargue avatar May 09 '22 17:05 viclafargue

Added do not merge label since I'll be mostly away for the next couple of weeks, and want to be part of the discussion(s)

dantegd avatar May 14 '22 05:05 dantegd

Hi @viclafargue, one thing to keep in mind: protocol buffers have a size limitation of 2 GiB (cheet-sheet). While it is not an issue here, we should still think about what would be the strategy for models that need to save large arrays.

tfeher avatar May 16 '22 08:05 tfeher

Hi @viclafargue, one thing to keep in mind: protocol buffers have a size limitation of 2 GiB (cheet-sheet). While it is not an issue here, we should still think about what would be the strategy for models that need to save large arrays.

Thanks for noticing that @tfeher. That is indeed a problem. One solution to that would be to store the CumlArrays data in separate files. An other solution would be to create a whole new file format to store the models, but that would mean that we would have to maintain custom code for serialization in Python and C++.

viclafargue avatar May 16 '22 11:05 viclafargue

This PR has been labeled inactive-30d due to no recent activity in the past 30 days. Please close this PR if it is no longer required. Otherwise, please respond with a comment indicating any updates. This PR will be labeled inactive-90d if there is no activity in the next 60 days.

github-actions[bot] avatar Jun 15 '22 12:06 github-actions[bot]

This PR has been labeled inactive-90d due to no recent activity in the past 90 days. Please close this PR if it is no longer required. Otherwise, please respond with a comment indicating any updates.

github-actions[bot] avatar Sep 13 '22 12:09 github-actions[bot]

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB