gravitino.client.generic_model.GenericModel¶
- class gravitino.client.generic_model.GenericModel(model_dto: ModelDTO, rest_client: HTTPClient, model_ns: Namespace)¶
Bases:
Model,SupportsTags- __init__(model_dto: ModelDTO, rest_client: HTTPClient, model_ns: Namespace) None¶
Methods
__init__(model_dto, rest_client, model_ns)associate_tags(tags_to_add, tags_to_remove)Associate tags to the specific object.
audit_info()comment()The comment of the model object.
get_tag(name)Get a tag by its name for the specific object.
The latest version of the model object.
List all the tag names for the specific object.
List all the tags with details for the specific object.
name()Returns:
The properties of the model object.
supports_tags()- associate_tags(tags_to_add: list[str], tags_to_remove: list[str]) list[str]¶
Associate tags to the specific object.
The tags_to_add will be added to the object, and the tags_to_remove will be removed from the object.
Note that: 1. Adding or removing tags that are not existed will be ignored. 2. If the same name tag is in both tags_to_add and tags_to_remove, it will be ignored. 3. If the tag is already associated with the object, it will raise TagAlreadyAssociatedException.
- Args:
tags_to_add (list[str]): The arrays of tag name to be added to the object. tags_to_remove (list[str]): The array of tag name to be removed from the object.
- Raises:
TagAlreadyAssociatedException: If the tag is already associated with the object.
- Returns:
list[str]: The array of tag names that are associated with the object.
- comment() str | None¶
The comment of the model object. This is the general description of the model object. User can still add more detailed information in the model version.
- Returns:
The comment of the model object. None is returned if no comment is set.
- get_tag(name: str) Tag¶
Get a tag by its name for the specific object.
- Args:
name (str): The name of the tag.
- Raises:
NoSuchTagException: If the tag does not associate with the object.
- Returns:
Tag: The tag.
- latest_version() int¶
The latest version of the model object. The latest version is the version number of the latest model checkpoint / snapshot that is linked to the registered model.
- Returns:
The latest version of the model object.
- list_tags() list[str]¶
List all the tag names for the specific object.
- Returns:
list[str]: The list of tag names.
- list_tags_info() list[gravitino.api.tag.tag.Tag]¶
List all the tags with details for the specific object.
- Returns:
list[Tag]: The list of tags.
- name() str¶
- Returns:
Name of the model object.
- properties() dict¶
The properties of the model object. The properties are key-value pairs that can be used to store additional information of the model object. The properties are optional.
Users can still specify the properties in the model version for different information.
- Returns:
The properties of the model object. An empty dictionary is returned if no properties are set.