Model Versions

Model Versions

An AI Model has one or multiple versions associated with it:

  • the current live version
  • previous versions
  • future versions

If you need help:creating a client, look here: Create Client.

Get all model versions

Get a list of all versions for a specific model.

versions = client.get_model_versions(my_model.id)
ParameterTypeDescription
model_idstrThe model id

Create a model version

Get the application_id for your needs:

application_id = client.get_application_id(
    Framework.PYTORCH,
    Framework.FASTAI,
    "2.1.0",
    "2.7.13"
)

Create the model version:

from seeme.types import ModelVersion

new_version = ModelVersion (
    name="A higher accuracy achieved",
    application_id=application_id
)

new_version = client.create_model_version(my_model.id, new_version)
ParameterTypeDescription
model_idstrThe model id
versionModelVersionThe model version object

Every model version has the following properties. Note that these are partially similar to the model properties:

Shared with the model entity:

PropertyTypeDescription
idstrUnique id for the model version
created_atstrThe creation date
updated_atstrLast updated date
namestrThe model version name
descriptionstrThe model version description
user_idstrThe user id of the model version creator
can_inferenceboolFlag indicating whether the model version can make predictios or not
has_logoboolFlag indicating whether the model has a logo or not (not used for now)
logostrName and extension of the logo file (mostly for internal purpose)
configstrAdditional config stored in a JSON string
application_idstrThe application ID (see applications below)
has_ml_modelboolFlag indicating whether the model version has a Core ML model
has_onnx_modelboolFlag indicating whether the model version has an ONNX model
has_onnx_int8_modelboolFlag indicating whether the model version has an 8-bit quantized model
has_tflite_modelboolFlag indicating whether the model version has a Tensorflow Lite model
has_labels_fileboolFlag indicating whether a file will all the labels (classes) is available

Different from the model entity.

PropertyTypeDescription
model_idstrThe id of the model this version belongs to.
versionstrThe label of the version
version_numberintAutomatically incrementing number of the version.
dataset_version_idstrThe id of the dataset version this model version was trained on.
job_idstrThe id of the job used to build this model version.
metricsList[Metric]A list of Metrics for this model version.

Every metric has the following properties:

PropertyTypeDescription
idstrUnique id for the metric
created_atstrThe creation date
updated_atstrLast updated date
namestrThe metric name
descriptionstrThe metric description
model_version_idstrThe model version id for the metric
valuefloatThe metric value

Get model version

Use the model and version id to get the full model version:

model_version = client.get_model_version(
    my_model.id, 
    new_version.id
)
ParameterTypeDescription
model_idstrThe model id
version_idstrThe model version id

Update model version

Update any property of the model version:

model_version.description = "SOTA comes and goes, but versions are forever!"

client.update_model_version(model_version)
ParameterTypeDescription
model versionModelVersionThe entire model version object

Delete a model version

client.delete_model_version(
    my_model.id, 
    model_version.id
)

Upload a model version file

Upload a model file (or model files) for a new version of your AI model.

Make sure the application_id is set to the desired AI application, framework, and version.

client.upload_model_version(
    new_version,
    folder="directory/to/model",
    filename="your_exported_model_file_v2.pkl"
)
ParameterTypeDescription
versionModelVersionThe entire model version object
folderstrName of the folder that contains the model file (without trailing ‘/’), default value “data”
filenamestrName of the file to be uploaded, default value “export.pkl”

Download a model version

client.download_model_version(
    my_version,
    asset_type=AssetType.PKL,
    download_folder="data"
)
ParameterTypeDescription
versionModelVersionThe entire model version object
asset_typeAssetTypeThe asset type you want to download.
Default: AssetType.PKL;
Possible values:
PKL,
MLMODEL,
TFLITE,
ONNX,
ONNX_INT8,
LABELS,
NAMES,
WEIGHTS,
CFG,
CONVERSION_CFG,
LOGO.
download_folderstrThe folder where you would like to download the model. Default: . (i.e. current directory)

If the asset_type exists, the model file will be downloaded to {my_model.active_model_id}.{asset_type}. One exception, the labels file will receive a .txt extension.