Properties
-
origin_name
Name of origin of this ModelVersion -
origin_id
UUID of the origin Model of this ModelVersion -
name
Name of this ModelVersion -
version
Version number of this ModelVersion -
type
Type of this ModelVersion -
framework
Framework of this ModelVersion
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])
remove_tags
remove_tags(
tags: Union[Tag, list[Tag]]
)
Description
Remove some tags from an object (can be used on Data/Asset/DatasetVersion/Dataset/Model/ModelVersion)
You can give a Tag or a list of Tag.
Examples
data.remove_tags(tag_bicycle)
data.remove_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
A list of Tag objects
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, framework: Union[str, Framework,
None] = None, type: Union[str, InferenceType, None] = None,
name: Optional[str] = None, description: Optional[str] = None,
docker_tag: Optional[str] = None
)
Description
Update this model version with some new infos.
Examples
model_v1.update(docker_image_name="docker.io/model1")
Arguments
-
labels (dict, optional) : Labels of this model version. Defaults to None.
-
docker_image_name (str, optional) : Docker image name of this model version. Defaults to None.
-
docker_flags (list[str], optional) : Docker flags of this model version. Defaults to None.
-
thumb_object_name (str, optional) : Thumbnail object name of this model version. Defaults to None.
-
notebook_link (str, optional) : Notebook link of this model version. Defaults to None.
-
base_parameters (dict, optional) : Base parameters of this model version. Defaults to None.
-
docker_env_variables (dict, optional) : Docker env variables of this model version. Defaults to None.
-
framework (Union[str, Framework, None], optional) : Framework of this model version (tensorflow, pytorch, etc.). Defaults to None.
-
type (Union[str, InferenceType, None], optional) : Type of this model version (classification, object_detection, segmentation). Defaults to None.
-
name (str, optional) : Name of this model version. Defaults to None.
-
description (str, optional) : Description of this model version. Defaults to None.
-
docker_tag (str, optional) : Docker tag of this model version. Defaults to None.
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()
Arguments
- name (str) : Name of the file you want to retrieve
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
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
model_version = client.get_model(name="my-awesome-model").get_version(0)
deployment = model_version.deploy(name="my-awesome-deployment", min_threshold=0.5)
Arguments
-
name (str) : Name of your deployment. Defaults to a random name.
-
min_threshold (float) : Threshold of detection scores used by models when predicting. Defaults to 0.
-
target_datalake Datalake : Datalake to use when data are pushed into Picsellia.
Defaults to organization default Datalake.
Returns
launch_processing
launch_processing(
processing: Processing, parameters: dict = None, cpu: int = None, gpu: int = None
)
Description
Launch given processing onto this model version. You can give specific cpu, gpu or parameters.
If not given, it will use default values specified in Processing.
If processing cannot be launched on a ModelVersion it will raise before launching.
Examples
processing = client.get_processing("convert-to-pytorch")
model_version.launch_processing(processing)
**Returns**
A [Job](job) object
---