module documentation

Undocumented

Function create_instance Creates a new model instance.
Function create_instance_cli Creates a new model instance.
Function delete_instance Deletes a model instance.
Function delete_instance_cli Deletes a model instance.
Function download_instance Downloads files from a model instance.
Function download_instance_cli Downloads files from a model instance.
Function get_config Returns the configuration of a model instance.
Function get_config_cli Returns the configuration of a model instance.
Function get_files Returns the files of a model instance.
Function get_files_cli Returns the files of a model instance.
Function get_instance Returns information about a model instance.
Function get_instance_info_cli Returns information about a model instance.
Function list_instances List the model instances in the HubAI.
Function list_instances_cli List the model instances in the HubAI.
Function upload_file Uploads a file to a model instance using async upload.
Function upload_file_cli Uploads a file to a model instance using async upload.
Function upload_quantization_zip Uploads a custom quantization zip for an export job.
Constant INSTANCE_INFO_KEYS Undocumented
Constant INSTANCE_LIST_KEYS Undocumented
Constant INSTANCE_LIST_KEYS_WITH_MODEL Undocumented
Variable app Undocumented
Function _dump_for_cli Convert SDK response objects into JSON-serializable CLI data.
Function _get_instance_subresource Fetch a subresource for a model instance after resolving its ID.
Function _instance_to_cli_data Undocumented
Function _print_instance_info Undocumented
Function _print_instance_list Undocumented
def create_instance(name: str, *, variant_id: UUID | str, model_type: ModelType, parent_id: UUID | str | None = None, quantization_mode: QuantizationMode | None = None, quantization_data: QuantizationData | None = None, tags: list[str] | None = None, input_shape: list[int] | None = None, is_deployable: bool | None = None, yolo_version: YoloVersion | None = None) -> ModelInstanceResponse:

Creates a new model instance.

Parameters
name:strThe name of the model instance.
variant_id:UUID | strThe ID of the model variant to create an instance for.
model_type:ModelTypeThe type of the model.
parent_id:UUID | str | NoneThe ID of the parent model instance.
quantization_mode:QuantizationMode | NoneQuantization mode for the model. Must be one of INT8_STANDARD, INT8_ACCURACY_FOCUSED, INT8_INT16_MIXED, INT8_INT16_MIXED_ACCURACY_FOCUSED, or FP16_STANDARD. INT8_STANDARD is standard INT8 quantization with calibration for optimal performance and model size. INT8_ACCURACY_FOCUSED is INT8 quantization with calibration that may improve accuracy without reducing performance or increasing model size, depending on the model. INT8_INT16_MIXED uses 8-bit weights and 16-bit activations across all layers for improved numeric stability and accuracy at the cost of performance and model size. INT8_INT16_MIXED_ACCURACY_FOCUSED is a mixed INT8 and INT16 calibration-based mode that prioritizes accuracy over throughput. FP16_STANDARD is FP16 quantization without calibration for models that require higher accuracy and numeric stability at the cost of performance and model size.
quantization_data:QuantizationData | NoneQuantization data for the model. This can be one of the predefined domains DRIVING, FOOD, GENERAL, INDOORS, RANDOM, WAREHOUSE, CLIP, CUSTOM, or UNKNOWN, or a dataset ID. For conversion helpers, pass the local .zip path itself instead of CUSTOM; the SDK normalizes that input before instance creation.
tags:list[str] | NoneTags for the model instance.
input_shape:list[int] | NoneInput shape for the model instance.
is_deployable:bool | NoneWhether the model instance is deployable.
yolo_version:YoloVersion | NoneYOLO version for the model instance if it is a YOLO model.
Returns
ModelInstanceResponseThe created model instance resource.
@app.command(name='create')
def create_instance_cli(name: str, *, variant_id: UUID | str, model_type: ModelType, parent_id: UUID | str | None = None, quantization_mode: QuantizationMode | None = None, quantization_data: QuantizationData | None = None, tags: list[str] | None = None, input_shape: list[int] | None = None, is_deployable: bool | None = None, yolo_version: YoloVersion | None = None):

Creates a new model instance.

@telemetry_operation(OperationTelemetrySpec(operation_name=OperationName.INSTANCE_DELETE, operation_group=TelemetryGroup.INSTANCES, success_event=INSTANCE_DELETED_EVENT, target_resource=TargetResource.INSTANCE, identifier_param='identifier', success_builder=build_model_identifier_properties))
def delete_instance(identifier: UUID | str):

Deletes a model instance.

Parameters
identifier:UUID | strThe model instance ID or slug.
@app.command(name='delete')
def delete_instance_cli(identifier: UUID | str):

Deletes a model instance.

def download_instance(identifier: UUID | str, output_dir: str | None = None, force: bool = False) -> Path:

Downloads files from a model instance.

Parameters
identifier:UUID | strThe model instance ID or slug.
output_dir:str | NoneDirectory path to save the downloaded files. If not specified, the downloader creates a directory named after the model instance slug under the current working directory.
force:boolWhether to force download the files even if they already exist.
Returns
PathPath to the downloaded file or last downloaded file when the instance contains multiple files.
@app.command(name='download')
def download_instance_cli(identifier: UUID | str, output_dir: str | None = None, force: bool = False):

Downloads files from a model instance.

def get_config(identifier: UUID | str) -> ArchiveConfigurationResponse:

Returns the configuration of a model instance.

Parameters
identifier:UUID | strThe model instance ID or slug.
Returns
ArchiveConfigurationResponseThe NN archive configuration for the model instance.
@app.command(name='config')
def get_config_cli(identifier: UUID | str):

Returns the configuration of a model instance.

def get_files(identifier: UUID | str) -> list[ModelInstanceFileResponse]:

Returns the files of a model instance.

Parameters
identifier:UUID | strThe model instance ID or slug.
Returns
list[ModelInstanceFileResponse]File metadata for the model instance.
@app.command(name='files')
def get_files_cli(identifier: UUID | str):

Returns the files of a model instance.

@telemetry_operation(OperationTelemetrySpec(operation_name=OperationName.INSTANCE_GET, operation_group=TelemetryGroup.INSTANCES, success_event=INSTANCE_RETRIEVED_EVENT, target_resource=TargetResource.INSTANCE, identifier_param='identifier', success_builder=build_model_identifier_properties))
def get_instance(identifier: UUID | str) -> ModelInstanceResponse:

Returns information about a model instance.

Parameters
identifier:UUID | strThe model instance ID or slug.
Returns
ModelInstanceResponseThe resolved model instance resource.
@app.command(name='info')
def get_instance_info_cli(identifier: UUID | str):

Returns information about a model instance.

def list_instances(*, platforms: list[ModelType] | None = None, search: str | None = None, model_id: UUID | str | None = None, variant_id: UUID | str | None = None, model_type: ModelType | None = None, parent_id: UUID | str | None = None, model_class: ModelClass | None = None, name: str | None = None, hash: str | None = None, status: Status | None = None, is_public: bool | None = None, compression_level: Literal[0, 1, 2, 3, 4, 5] | None = None, optimization_level: Literal[-100, 0, 1, 2, 3, 4] | None = None, include_model_name: bool = False, limit: int = 50, sort: str = 'updated', order: Order = 'desc') -> list[ModelInstanceResponse]:

List the model instances in the HubAI.

Parameters
platforms:list[ModelType] | NoneFilter the listed model instances by platform.
search:str | NoneSearch the listed model instances by a free-text query.
model_id:UUID | str | NoneFilter the listed model instances by model ID.
variant_id:UUID | str | NoneFilter the listed model instances by variant ID.
model_type:ModelType | NoneFilter the listed model instances by model type.
parent_id:UUID | str | NoneFilter the listed model instances by parent ID.
model_class:ModelClass | NoneFilter the listed model instances by model class.
name:str | NoneFilter the listed model instances by name.
hash:str | NoneFilter the listed model instances by hash.
status:Status | NoneFilter the listed model instances by status.
is_public:bool | NoneFilter the listed model instances by visibility.
compression_level:Literal[0, 1, 2, 3, 4, 5] | NoneFilter the listed model instances by compression level. Only relevant for Hailo models.
optimization_level:Literal[-100, 0, 1, 2, 3, 4] | NoneFilter the listed model instances by optimization level. Only relevant for Hailo models.
include_model_name:boolIf True, include the model name and model variant name in the response. Otherwise, ModelInstanceResponse.model_name and ModelInstanceResponse.model_variant_name are None.
limit:intMaximum number of model instances to return.
sort:strField to sort the model instances by. It should be a field name from ModelInstanceResponse, such as "name", "id", or "updated".
order:OrderSort order. Must be "asc" or "desc".
Returns
list[ModelInstanceResponse]A list of matching model instance resources.
@app.command(name='ls')
def list_instances_cli(*, platforms: list[ModelType] | None = None, search: str | None = None, model_id: UUID | str | None = None, variant_id: UUID | str | None = None, model_type: ModelType | None = None, parent_id: UUID | str | None = None, model_class: ModelClass | None = None, name: str | None = None, hash: str | None = None, status: Status | None = None, is_public: bool | None = None, compression_level: Literal[0, 1, 2, 3, 4, 5] | None = None, optimization_level: Literal[-100, 0, 1, 2, 3, 4] | None = None, include_model_name: bool = False, limit: int = 50, sort: str = 'updated', order: Order = 'desc', field: Annotated[list[str] | None, Parameter(name=[(--field), (-f)])] = None):

List the model instances in the HubAI.

@telemetry_operation(OperationTelemetrySpec(operation_name=OperationName.INSTANCE_UPLOAD, operation_group=TelemetryGroup.INSTANCES, success_event=INSTANCE_FILE_UPLOADED_EVENT, target_resource=TargetResource.INSTANCE, identifier_param='identifier', success_builder=build_instance_uploaded_properties))
def upload_file(file_path: str, identifier: UUID | str):

Uploads a file to a model instance using async upload.

This function initiates an async upload by first obtaining a signed upload policy from the server, then uploading the file directly to cloud storage.

Parameters
file_path:strPath to the file to upload.
identifier:UUID | strThe model instance ID or slug.
@app.command(name='upload')
def upload_file_cli(file_path: str, identifier: UUID | str):

Uploads a file to a model instance using async upload.

def upload_quantization_zip(file_path: str, job_id: UUID | str):

Uploads a custom quantization zip for an export job.

INSTANCE_INFO_KEYS: list[str] =

Undocumented

Value
['model_name',
 'model_variant_name',
 'name',
 'slug',
 'id',
 'model_version_id',
 'model_id',
...
INSTANCE_LIST_KEYS: list[str] =

Undocumented

Value
['slug', 'id', 'model_type', 'is_nn_archive', 'model_precision_type']
INSTANCE_LIST_KEYS_WITH_MODEL: list[str] =

Undocumented

Value
['model_name',
 'model_variant_name',
 'slug',
 'id',
 'model_type',
 'is_nn_archive',
 'model_precision_type']
app =

Undocumented

def _dump_for_cli(resource: object) -> object:

Convert SDK response objects into JSON-serializable CLI data.

def _get_instance_subresource(identifier: UUID | str, subpath: str) -> dict[str, object] | list[dict[str, object]]:

Fetch a subresource for a model instance after resolving its ID.

def _instance_to_cli_data(instance: ModelInstanceResponse) -> dict[str, object]:

Undocumented

def _print_instance_info(instance: ModelInstanceResponse):

Undocumented

def _print_instance_list(instances: list[ModelInstanceResponse], include_model_name: bool, field: list[str] | None = None):

Undocumented