snowflakedb / snowflake-ml-python

Apache License 2.0
43 stars 12 forks source link

SNOW-1044102: Support `load_model(mode_name, model_version)` in `registry.Registry` #86

Closed everpeace closed 5 months ago

everpeace commented 9 months ago

Hi, We have usecase that we predict model in developer's local environment. So, we would like to load registered model in snowflake model registry to memory in local environment.

Although it's deprecated status, registry.model_registry.ModelRegistry has load_model(model_name: str, model_version: str) to do this. However,registry.Registry, successor of ModelRegistry, seems not to have such functionality.

We'd be happy if registry.Registry supports load_model functionality, too.

sfc-gh-sdas commented 9 months ago

Thanks for your request.

Main job of load_model() is to rehydrate the model in memory from serialized bytes. The challenge has been, with this API, that user needs to use exact same python, and other library version (eg xgboost or scikit-learn etc) between log_model() and load_model(). A different package/python version can not deserialize it correctly and thus it has been very error-prone. It is hard for us to ensure users get a seamless API that works. This is the main reason behind not adding this functionality to new Registry.

I was wondering, if you could explain more on your usecase where data cannot be uploaded to Snowflake.

sfc-gh-sdas commented 5 months ago

This has been implemented as ModelVersion.load() and released in 1.5.0.