Skip to content

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

@akumar-cs

Description

@akumar-cs

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions