Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to add python source files when creating a model artifact using client.repository.store_model #7

Open
akumar-cs opened this issue Jun 15, 2020 · 0 comments

Comments

@akumar-cs
Copy link

client.repository.store_model currently only accepts model objects or binaries, but in cases when the model pipeline is dependent on custom classes that must be referenced before predict can be called, there is no option to add the module to the deployment.

e.g using Custom Transformer class with sklearn pipeline like below

class CatTransform( BaseEstimator, TransformerMixin ):
    def __init__(self, **kwargs):
        pass

   def fit( self, X, y = None  ):
        return self

   def transform(self, X , y = None ):
        ...

categorical_pipeline = Pipeline( steps = [ 
                                
                                  ( 'cat_transform', CatTransform() ), 
                                  
                                  ( 'one_hot_encoder', OneHotEncoder( sparse = False ) ) ] )

model_pipeline = Pipeline( steps = [ ( 'cat_pipeline', categorical_pipeline),
                                  
                                  ( 'model', svm.SVC() ) ] )

model_pipeline.fit( X_train, y_train )

When container is deployed, and model is loaded in memory thisCatTransfrom class not being present inside the artifact throws a model load error with missing module

having a option to upload a directory with model binaries and all custom scripts might be a way to mitigate this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant