Model

Properties

  • name Name of this Model

  • type Type of this Model

  • framework Framework of this Model

  • private Privacy of this Model


Methods

add_tags

add_tags(
   tags: Union[Tag, list[Tag]]
)

Description

Add some tags to an object.
It can be used on Data/MultiData/Asset/MultiAsset/DatasetVersion/Dataset/Model/ModelVersion.

You can give a Tag or a list of Tag.

Examples

tag_bicycle = client.create_tag("bicycle", Target.DATA)
tag_car = client.create_tag("car", Target.DATA)
tag_truck = client.create_tag("truck", Target.DATA)

data.add_tags(tag_bicycle)
data.add_tags([tag_car, tag_truck])

update

update(
   name: Optional[str] = None, framework: Union[str, Framework, None] = None,
   private: Optional[bool] = None, description: Optional[str] = None, type: Union[str,
   InferenceType, None] = None
)

Description

Update a model with a new name, framework, privacy, description or type

Examples

model.update(description="Very cool model")

Arguments

  • name (str) : New name of the model

  • framework (str, Framework) : New framework of the model

  • private (bool) : New privacy of the model

  • description (str) : New description of the model

  • type (str, InferenceType) : New type of the model


delete

delete()

Description

Delete model.

Delete the model in Picsellia database

Examples

model.delete()

get_tags

get_tags()

Description

Retrieve the tags of your model.

Examples

tags = my_model.get_tags()
assert tags[0].name == "my-model-1"

Returns

A list of Tag object


create_version

create_version(
   docker_image_name: Optional[str] = None, docker_flags: Optional[list[str]] = None,
   thumb_object_name: Optional[str] = None, notebook_link: Optional[str] = None,
   labels: Optional[dict] = None, base_parameters: Optional[dict] = None,
   docker_env_variables: Optional[dict] = None, name: Optional[str] = None,
   framework: Union[str, Framework, None] = None, type: Union[str, InferenceType,
   None] = None, description: Optional[str] = None, docker_tag: Optional[str] = None
)

Description

Create a version of a model.

The version number of this model will be defined by the platform. It is incremented automatically.

Examples

Arguments

  • docker_image_name (str, optional) : Docker image name of this version. Defaults to None.

  • docker_flags (list[str], optional) : Docker flags of this version. Defaults to None.

  • thumb_object_name (str, optional) : Thumbnail object name of this version. Defaults to None.

  • notebook_link (str, optional) : Notebook link of this version. Defaults to None.

  • labels (dict, optional) : Labels of this version. Defaults to None.

  • base_parameters (dict, optional) : Base parameters of this version. Defaults to None.

  • docker_env_variables (dict, optional) : Docker environment variables of this version. Defaults to None.

  • name (str, optional) : Name of this version. Defaults to None.

  • framework (str, Framework, optional) : Framework of this version (tensorflow, pytorch, etc.). Defaults to None.

  • type (str, InferenceType, optional) : Type of this version (classification, object_detection, segmentation). Defaults to None.

  • description (str, optional) : Description of this version. Defaults to None.

  • docker_tag (str, optional) : Docker tag of this version. Defaults to None.

Returns

A ModelVersion object


get_version

get_version(
   version: Union[int, str]
)

Description

Retrieve a version of a model from its version or its name

Examples

# Assuming model is a Model without version
model_version_a = model.create_version("first-version")
model_version_b = model.get_version(0)
model_version_c = model.get_version("first-version")
assert model_version_a == model_version_b
assert model_version_a == model_version_c

Arguments

  • version (int, str) : Version number or name of the version

Returns

A ModelVersion object


list_versions

list_versions(
   limit: Optional[int] = None, offset: Optional[int] = None,
   order_by: Optional[list[str]] = None
)

Description

List versions of this model.

Examples

versions = model.list_versions()

Arguments

  • limit (int, optional) : Limit of versions to retrieve. Defaults to None.

  • offset (int, optional) : Offset to start retrieving versions. Defaults to None.

  • order_by (list[str], optional) : fields to order by. Defaults to None.

Returns

A list of ModelVersion object of this model