Creating registered model versions

Creating a model version

Once a registered model has been created, we can add versions to it. A Registered Model Version (RMV) is the unit of reuse, deployment, and monitoring and therefore stores the necessary information such as artifacts, models, requirements, etc.

As discussed in Catalog Concepts, RMVs are of one of the following types:

  • Standard Verta Models: Models that follow the Verta Model Specification

    and can be deployed from within Verta to the supported deployment systems

    (e.g., Verta Inference, Spark, Kafka, SageMaker, etc.)

  • User Containerized Models: Fully packaged model containers

  • Custom models: completely flexible, packaging and deployment managed

    by the user

1. Creating a version from a Standard Verta Model

Verta Standard Models require a few key pieces of information:

  • Implementation language (required)

  • Model class deriving from the VertaModelBase class (required)

  • Library dependencies (required)

  • Artifacts the model depends on (optional)

  • Code dependencies (optional)

  • OS dependencies (optional)

1.1. Define a model class that derives from VertaModelBase

from verta.registry import VertaModelBase

class MyModel(VertaModelBase):
    def __init__(self, artifacts):
        self.a = 1
        self.b = 0.5

    def predict(self, data):
        predictions = []
        for input in data:
            predictions.append(input*self.a + self.b)
        return predictions

1.2. Define a Registered Model Version from MyModel

Use the create_standard_model API call to create a version following the Verta Model Specification.

from verta.environment import Python

model_version = some_registered_model.create_standard_model(
    name="v0", #version name
    model_cls=MyModel,
    environment=Python(['pkg-one', 'pkg-two==1.0.0']),  # pip installable packages required by model
    check_model_dependencies=True,  # optional check for missing dependencies in the environment
)

If your model requires artifacts or OS-level dependencies, you may define them here.

If you are using "pure" scikit-learn, XGBoost, Keras, or PyTorch models, you can use convenience functions purpose-built for these libraries. Refer to this guide for details.

Creating a version from a Container

Coming soon

Creating a Custom model version

Unlike Verta Standard Models, Custom models do not need to adhere to a specification. As a result, you can use them as appropriate for your use case (e.g., just to share weights.)

model_version = some_registered_model.create_version(
    name="my version",
)

# Logging just the weights
model_version.log_artifact({"weights": "weights.json"})

See the full set of functions available on RegisteredModelVersions here.

Last updated