How to register a Model

Here we will create a Model from files that we have on our computer, save it to our Registry, use it in an Experiment and then export this experiment to create a new Model, sounds good? Let's go πŸš€

Create a Model

As of today, you can only create models using our Python SDK, let's see how it's done considering that we have trained an image classification model on three classes (normal, covid, pneumonia) and that it gave us the files below:

Here is the code that will create a Model in the Registry with the right properties and upload the files that we want to attach

from picsellia import Client
from picsellia.types.enums import InferenceType, Framework

api_token = "<your_api_token>"

client = Client(api_token)
model_name = "covid-classif"
model = client.create_model(model_name, type=InferenceType.CLASSIFICATION, framework=Framework.TENSORFLOW)
model_version = model.create_version()

parameters = {
  "batch_size": 4,
  "epochs": 100,
  "learning_rate": 0.001
}

# It's important that the labels keys starts at "1"

labels = { 
  "1": "normal",
  "2": "covid",
  "3": "pneumonia"
}

model_version.update(
  base_parameters=parameters,
  labels=labels
)

saved_model_path = "new_model/saved_model.zip"
keras_model_path = "new_model/model.h5"
  
model_version.store('model-latest', saved_model_path)
model_version.store('keras-model', keras_model_path)

Once this ran correctly, you can head over to your Model page in your Registry, it should look like something like this

Now we have everything we need to use this model as a base model for an Experiment, see you on the next tutorial πŸ‘‡