class verta.registry.VertaModelBase(artifacts)

Abstract base class for Verta Standard Models.


__init__() and predict() must be implemented by subclasses.


artifacts (dict of str to str) – A mapping of artifact keys to filepaths. This will be provided to the deployed model based on artifact keys specified through RegisteredModelVersion.log_model().


import pickle
import numpy as np
from verta.registry import VertaModelBase

class Model(VertaModelBase):
    def __init__(self, artifacts):
        with open(artifacts["np_matrix"], "rb") as f:
            self._transform = pickle.load(f)

    def predict(self, input):
        input = np.array(input)

        return np.matmul(input, self._transform)

# iterate locally
model = Model(

# persist to model version
model_ver.log_model(Model, artifacts=["np_matrix"])
abstract predict(input)

Produce an output from input.

This method is called when requests are made against a Verta endpoint.


It is recommended to use the verify_io() decorator to help ensure that your model’s input and output types will be fully compatible with the Verta platform as you iterate locally.

Specifically, this method should be written in a way that expects the parameter input to be a type returned from json.loads(), i.e. a basic Python type. input would then need to be manually cast to a NumPy array, pandas DataFrame, etc. in order to be used as such.

Similarly, the return value should also be a type that can be passed to json.dumps()


input (any JSON-compatible Python type) – Model input.


any JSON-compatible Python type – Model output.