Modelversion

Properties


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])

get_tags

get_tags()

Description

Retrieve the tags of your model version.

Examples

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

Returns

List of tags as Tag


update

update(
   labels: Optional[dict] = None, docker_image_name: Optional[str] = None,
   docker_flags: Optional[List[str]] = None, thumb_object_name: Optional[str] = None,
   notebook_link: Optional[str] = None, base_parameters: Optional[dict] = None,
   docker_env_variables: Optional[dict] = None
)

Description

Update this model version with some new infos.

Examples

model_v1.update(docker_image_name="docker.io/model1")

delete

delete()

Description

Delete model version.

Delete the model in Picsellia database

Examples

model_v1.delete()

get_context

get_context()

Description

Get ModelContext of this model

Examples

model_v1 = client.get_model(name="my-model").get_version(0)
context = model_v1.get_context()
context.get_infos()

Returns

ModelContext objects that you can use and manipulate


list_files

list_files()

Description

Get a list of ModelFile that were stored with this model

Examples

model_v1 = client.get_model(name="my-model").get_version(0)
files = model_v1.list_files()
files[0].download()

Returns

A list of ModelFile that you can use and manipulate


get_file

get_file(
   name: str
)

Description

Retrieve a ModelFile that were stored with this name into this model

Examples

model_v1 = client.get_model(name="my-model").get_version(0)
file = model_v1.get_file("model-latest")
file.download()

Returns

A ModelFile that you can use and manipulate


store

store(
   name: str, path: Union[str, Path], do_zip: bool = False, replace: bool = False
)

Description

Store a file into picsellia storage and attach it to this model.

Examples

model.store("model-latest", "./lg_test_file.pb")

Arguments

  • name (str) : Name of file

  • path (str or Path) : Path of file to store

  • do_zip (bool, optional) : If true, zip directory to store it. Defaults to False.

  • replace (bool, optional) : If true, if a file with given name exists, it will be replaced. Defaults to False.

Returns

A ModelFile object


update_thumbnail

update_thumbnail(
   path: Union[str, Path]
)

Description

Updates the model thumbnail.

Update the model thumbnail with given file.
File size shall be less than 5Mb.

Examples

model.update_thumb("test.png")

Arguments

  • path (str or Path) : Path of the thumbnail you want to push

Raises

  • FileNotFoundException : If there is no file in given path

  • InvalidQueryError : If file is too large

  • PicselliaError : If an unexpected error occurred while uploading file


deploy

deploy(
   name: Optional[str] = None, target_datalake: Optional[Datalake] = None,
   min_threshold: Optional[float] = None
)

Description

Create a Deployment for a model.

This method allows you to create a Deployment on Picsellia. You will then have
access to the monitoring dashboard and the model management part!

Examples

Create a serverless deployment

model = client.get_model(name="my-awesome-model")
deployment = model.create_deployment()

Arguments

  • name (str) : Name of your deployment. Defaults to a random name.

  • min_threshold (float) : Threshold of detection scores used by models when predicting

  • target_datalake Datalake : Datalake to use when data are pushed into Picsellia

Returns

A Deployment that you can manipulate