Register Custom Model

Register your custom model with MarkovML using Markov SDK.

Register your Custom Model to the Project

Once you have created your custom model, you can register it with the MarkovML Project and access it on the UI platform as well.

To register your model to the Markov SDK, you will need the model_id. You can either create a new model_id as shown below, in case you have been working on it locally, or copy the availablemodel_id from the Models in MarkovML UI.

Here's how you can register your custom model.

Step 1: Create your Model Metadata on MarkovML

Fetch the project_id to register the model. And create the model metadata as shown in the code below.

Sample Code

MODEL_NAME = "News-Classifier-Pytorch"

# Create a Model Metadata on MarkovML
mkv_model = get_or_create_model(
    project_id=project.project_id,
    model_name=MODEL_NAME,
    description="This model using Pytorch Text classifier to train a model on AG dataset",
)

Step 2: Register your model metadata with MarkovML

Use the register() method to register your model metadata with MarkovML.

mkv_model.register()

Step 3: Register your Custom Model artifact (Your trained model) with MarkovML.

Register your inference model, i.e., your custom model artifact with MarkovML. This will allow you to access your trained custom model from the MarkovML Projects and Model Registry.

my_inference_model.register(model_id=mkv_model.model_id)

Sample Code for Registering your Custom Model with MarkovML

MODEL_NAME = "News-Classifier-Pytorch"

# Create a Model Metadata on MarkovML
mkv_model = get_or_create_model(
    project_id=project.project_id,
    model_name=MODEL_NAME,
    description="This model using Pytorch Text classifier to train a model on AG dataset",
)
mkv_model.register()  # this registers the model metadata with MarkovML

# register the model artifact (YOUR TRAINED MODEL)
my_inference_model.register(model_id=mkv_model.model_id)

What’s Next