module documentation
Undocumented
| Function | create |
Creates a new model instance. |
| Function | create |
Creates a new model instance. |
| Function | delete |
Deletes a model instance. |
| Function | delete |
Deletes a model instance. |
| Function | download |
Downloads files from a model instance. |
| Function | download |
Downloads files from a model instance. |
| Function | get |
Returns the configuration of a model instance. |
| Function | get |
Returns the configuration of a model instance. |
| Function | get |
Returns the files of a model instance. |
| Function | get |
Returns the files of a model instance. |
| Function | get |
Returns information about a model instance. |
| Function | get |
Returns information about a model instance. |
| Function | list |
List the model instances in the HubAI. |
| Function | list |
List the model instances in the HubAI. |
| Function | upload |
Uploads a file to a model instance using async upload. |
| Function | upload |
Uploads a file to a model instance using async upload. |
| Function | upload |
Uploads a custom quantization zip for an export job. |
| Constant | INSTANCE |
Undocumented |
| Constant | INSTANCE |
Undocumented |
| Constant | INSTANCE |
Undocumented |
| Variable | app |
Undocumented |
| Function | _dump |
Convert SDK response objects into JSON-serializable CLI data. |
| Function | _get |
Fetch a subresource for a model instance after resolving its ID. |
| Function | _instance |
Undocumented |
| Function | _print |
Undocumented |
| Function | _print |
Undocumented |
@telemetry_operation( OperationTelemetrySpec( operation_name=OperationName.INSTANCE_CREATE, operation_group=TelemetryGroup.INSTANCES, success_event=INSTANCE_CREATED_EVENT, target_resource=TargetResource.INSTANCE, success_builder=build_instance_created_properties))
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:str | The name of the model instance. |
variantUUID | str | The ID of the model variant to create an instance for. |
modelModelType | The type of the model. |
parentUUID | str | None | The ID of the parent model instance. |
quantizationQuantizationMode | None | Quantization 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. |
quantizationQuantizationData | None | Quantization 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[ | Tags for the model instance. |
inputlist[ | Input shape for the model instance. |
isbool | None | Whether the model instance is deployable. |
yoloYoloVersion | None | YOLO version for the model instance if it is a YOLO model. |
| Returns | |
ModelInstanceResponse | The 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 | str | The model instance ID or slug. |
@telemetry_operation( OperationTelemetrySpec( operation_name=OperationName.INSTANCE_DOWNLOAD, operation_group=TelemetryGroup.INSTANCES, success_event=INSTANCE_DOWNLOAD_COMPLETED_EVENT, target_resource=TargetResource.INSTANCE, identifier_param='identifier', success_builder=build_instance_downloaded_properties))
def download_instance(identifier: UUID | str, output_dir: str | None = None, force: bool = False) -> Path:
¶
Downloads files from a model instance.
| Parameters | |
identifier:UUID | str | The model instance ID or slug. |
outputstr | None | Directory 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:bool | Whether to force download the files even if they already exist. |
| Returns | |
Path | Path 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.
@telemetry_operation( OperationTelemetrySpec( operation_name=OperationName.INSTANCE_CONFIG_GET, operation_group=TelemetryGroup.INSTANCES, success_event=INSTANCE_CONFIG_RETRIEVED_EVENT, target_resource=TargetResource.INSTANCE, identifier_param='identifier', success_builder=build_model_identifier_properties))
def get_config(identifier: UUID | str) -> ArchiveConfigurationResponse:
¶
Returns the configuration of a model instance.
| Parameters | |
identifier:UUID | str | The model instance ID or slug. |
| Returns | |
ArchiveConfigurationResponse | The NN archive configuration for the model instance. |
@telemetry_operation( OperationTelemetrySpec( operation_name=OperationName.INSTANCE_FILES_LIST, operation_group=TelemetryGroup.INSTANCES, success_event=INSTANCE_FILES_LISTED_EVENT, target_resource=TargetResource.INSTANCE, identifier_param='identifier', success_builder=build_instance_files_listed_properties))
def get_files(identifier: UUID | str) -> list[ ModelInstanceFileResponse]:
¶
Returns the files of a model instance.
| Parameters | |
identifier:UUID | str | The model instance ID or slug. |
| Returns | |
list[ | File metadata for the 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 | str | The model instance ID or slug. |
| Returns | |
ModelInstanceResponse | The resolved model instance resource. |
@telemetry_operation( OperationTelemetrySpec( operation_name=OperationName.INSTANCES_LIST, operation_group=TelemetryGroup.INSTANCES, success_event=INSTANCES_LISTED_EVENT, target_resource=TargetResource.INSTANCE, success_builder=build_instances_listed_properties))
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[ | Filter the listed model instances by platform. |
search:str | None | Search the listed model instances by a free-text query. |
modelUUID | str | None | Filter the listed model instances by model ID. |
variantUUID | str | None | Filter the listed model instances by variant ID. |
modelModelType | None | Filter the listed model instances by model type. |
parentUUID | str | None | Filter the listed model instances by parent ID. |
modelModelClass | None | Filter the listed model instances by model class. |
name:str | None | Filter the listed model instances by name. |
hash:str | None | Filter the listed model instances by hash. |
status:Status | None | Filter the listed model instances by status. |
isbool | None | Filter the listed model instances by visibility. |
compressionLiteral[ | Filter the listed model instances by compression level. Only relevant for Hailo models. |
optimizationLiteral[ | Filter the listed model instances by optimization level. Only relevant for Hailo models. |
includebool | If True, include the model name and model
variant name in the response. Otherwise,
ModelInstanceResponse.model_name and
ModelInstanceResponse.model_variant_name are None. |
limit:int | Maximum number of model instances to return. |
sort:str | Field to sort the model instances by. It should be a field
name from ModelInstanceResponse, such as "name", "id",
or "updated". |
order:Order | Sort order. Must be "asc" or "desc". |
| Returns | |
list[ | 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 | |
filestr | Path to the file to upload. |
identifier:UUID | str | The model instance ID or slug. |
Undocumented
| Value |
|
Undocumented
| Value |
|
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 _print_instance_list(instances:
list[ ModelInstanceResponse], include_model_name: bool, field: list[ str] | None = None):
¶
Undocumented