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)
Parameter | Type | Description |
---|---|---|
model_id | str | The 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)
Parameter | Type | Description |
---|---|---|
model_id | str | The model id |
version | ModelVersion | The 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:
Property | Type | Description |
---|---|---|
id | str | Unique id for the model version |
created_at | str | The creation date |
updated_at | str | Last updated date |
name | str | The model version name |
description | str | The model version description |
user_id | str | The user id of the model version creator |
can_inference | bool | Flag indicating whether the model version can make predictios or not |
has_logo | bool | Flag indicating whether the model has a logo or not (not used for now) |
logo | str | Name and extension of the logo file (mostly for internal purpose) |
config | str | Additional config stored in a JSON string |
application_id | str | The application ID (see applications below) |
has_ml_model | bool | Flag indicating whether the model version has a Core ML model |
has_onnx_model | bool | Flag indicating whether the model version has an ONNX model |
has_onnx_int8_model | bool | Flag indicating whether the model version has an 8-bit quantized model |
has_tflite_model | bool | Flag indicating whether the model version has a Tensorflow Lite model |
has_labels_file | bool | Flag indicating whether a file will all the labels (classes) is available |
Different from the model entity.
Property | Type | Description |
---|---|---|
model_id | str | The id of the model this version belongs to. |
version | str | The label of the version |
version_number | int | Automatically incrementing number of the version. |
dataset_version_id | str | The id of the dataset version this model version was trained on. |
job_id | str | The id of the job used to build this model version. |
metrics | List[Metric] | A list of Metrics for this model version. |
Every metric has the following properties:
Property | Type | Description |
---|---|---|
id | str | Unique id for the metric |
created_at | str | The creation date |
updated_at | str | Last updated date |
name | str | The metric name |
description | str | The metric description |
model_version_id | str | The model version id for the metric |
value | float | The 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
)
Parameter | Type | Description |
---|---|---|
model_id | str | The model id |
version_id | str | The 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)
Parameter | Type | Description |
---|---|---|
model version | ModelVersion | The 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"
)
Parameter | Type | Description |
---|---|---|
version | ModelVersion | The entire model version object |
folder | str | Name of the folder that contains the model file (without trailing ‘/’), default value “data” |
filename | str | Name 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"
)
Parameter | Type | Description |
---|---|---|
version | ModelVersion | The entire model version object |
asset_type | AssetType | The 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_folder | str | The 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.