snowflakedb / snowflake-ml-python

Apache License 2.0
37 stars 7 forks source link

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

Closed everpeace closed 3 weeks ago

everpeace commented 5 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 5 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 3 weeks ago

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