module documentation

Run hosted model conversion and download deployable artifacts.

The target-specific helpers RVC2, RVC3, RVC4, and Hailo are the recommended conversion API. Each helper prepares target options and delegates to convert, which coordinates the complete HubAI workflow:

  1. Read model metadata from a model file, YAML config, or NN Archive.
  2. Create or reuse model and variant resources.
  3. Upload the source model as an instance.
  4. Start an export job and wait for it to finish.
  5. Download the exported instance.

Example

Convert an ONNX model for RVC4 with HubAI's general calibration data.

result = client.convert.RVC4(
    path="detector.onnx",
    name="detector",
    quantization_mode="INT8_STANDARD",
    quantization_data="GENERAL",
)
print(result.downloaded_path)
Input configuration:
path may point to a model file, an NN Archive, or a YAML configuration. Additional opts override values loaded from that configuration. A dictionary is usually easiest in Python; the flat list form exists for the command-line interface.
Resource reuse:
Pass model_id or variant_id to attach the conversion to existing resources. Without them, convert creates resources and reuses a model with the same slug if one already exists.
Quantization:
RVC4 and Hailo accept a built-in calibration domain, a dataset ID beginning with aid_, or a local ZIP file. Passing a ZIP path uploads it for the export job. RVC2 and RVC3 ignore quantization inputs because those helpers expose their platform-specific precision controls instead.
Function convert Starts the online conversion process.
Function Hailo Convert a model to Hailo format.
Function RVC2 Convert a model to RVC2 format.
Function RVC3 Convert a model to RVC3 format.
Function RVC4 Convert a model to RVC4 format.
Function _combine_opts Merge generic options with target-prefixed conversion options.
Function _export Starts an export job for a model instance.
Function _get_instance_response Fetch a model instance response, returning None if missing.
Function _resolve_exported_instance Resolve the exported model instance from a completed export job.
Function _wait_for_exported_instance_ready Wait until an exported model instance is actually downloadable.
def convert(target: Target, opts: list[str] | None = None, /, *, path: str, name: str | None = None, license_type: License = 'undefined', is_public: bool | None = False, description_short: str = '<empty>', description: str | None = None, architecture_id: UUID | str | None = None, tasks: list[Task] | None = None, links: list[str] | None = None, is_yolo: bool = False, model_id: UUID | str | None = None, variant_version: str | None = None, variant_description: str | None = None, repository_url: str | None = None, commit_hash: str | None = None, quantization_mode: QuantizationMode | None = None, domain: str | None = None, variant_tags: list[str] | None = None, variant_id: UUID | str | None = None, quantization_data: QuantizationData | PathType | None = None, max_quantization_images: int | None = None, instance_tags: list[str] | None = None, input_shape: list[int] | None = None, is_deployable: bool | None = None, output_dir: str | None = None, tool_version: str | None = None, yolo_input_shape: list[int] | None = None, yolo_version: YoloVersion | None = None, yolo_class_names: list[str] | None = None) -> ConvertResponse:

Starts the online conversion process.

Parameters
target:TargetTarget platform.
opts:list[str] | NoneAdditional options for the conversion process.
path:strPath to the model file, NN Archive, or configuration file.
name:str | NoneModel name. If not specified, the name is taken from the configuration file or the model file.
license_type:LicenseLicense type.
is_public:bool | NoneWhether the model is public (True), private (False), or team-scoped (None).
description_short:strShort description of the model.
description:str | NoneFull description of the model.
architecture_id:UUID | str | NoneArchitecture ID.
tasks:list[Task] | NoneTasks this model supports.
links:list[str] | NoneLinks to related resources.
is_yolo:boolWhether the model is a YOLO model.
model_id:UUID | str | NoneID of an existing model resource. If specified, that model is used instead of creating a new one.
variant_version:str | NoneModel version. If not specified, the version is auto-incremented from the latest version of the model. If no versions exist, the version is "0.1.0".
variant_description:str | NoneFull description of the model variant.
repository_url:str | NoneURL of the repository.
commit_hash:str | NoneCommit hash.
quantization_mode:QuantizationMode | NoneQuantization mode to use during conversion. 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.
domain:str | NoneDomain of the model.
variant_tags:list[str] | NoneTags for the model variant.
variant_id:UUID | str | NoneID of an existing model version resource. If specified, that version is used instead of creating a new one.
quantization_data:QuantizationData | PathType | NoneData used to quantize this model. This can be a predefined domain (DRIVING, FOOD, GENERAL, INDOORS, RANDOM, WAREHOUSE, CLIP, UNKNOWN), a dataset ID, or a path to a local quantization .zip file. Pass the .zip path itself instead of CUSTOM; the SDK normalizes local zip inputs automatically.
max_quantization_images:int | NoneMaximum number of quantization images.
instance_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.
output_dir:str | NoneDirectory path for the downloaded files. If not specified, the downloader creates a directory named after the exported instance slug under the current working directory.
tool_version:str | NoneVersion of the tool used for conversion. For RVC2 and RVC3 this is the IR version, while for RVC4 this is the SNPE version.
yolo_input_shape:list[int] | NoneInput shape for YOLO models.
yolo_version:YoloVersion | NoneYOLO version.
yolo_class_names:list[str] | NoneClass names for YOLO models.
Returns
ConvertResponseConversion result containing the downloaded output path, export job, and exported model instance.
def Hailo(path: PathType, optimization_level: Literal[-100, 0, 1, 2, 3, 4] = 2, compression_level: Literal[0, 1, 2, 3, 4, 5] = 2, batch_size: int = 8, alls: list[str] | None = None, opts: Kwargs | list[str] | None = None, **hub_kwargs) -> ConvertResponse:

Convert a model to Hailo format.

Parameters
path:PathTypePath to the model file to convert.
optimization_level:Literal[-100, 0, 1, 2, 3, 4]Optimization level for the conversion.
compression_level:Literal[0, 1, 2, 3, 4, 5]Compression level for the conversion.
batch_size:intBatch size for the conversion.
alls:list[str] | NoneHailo ALLS commands applied during conversion.
opts:Kwargs | list[str] | NoneAdditional conversion options. These can override config values.
nameModel name. If not specified, the name is taken from the configuration file or the model file.
license_typeLicense type.
is_publicWhether the model is public (True), private (False), or team-scoped (None).
description_shortShort description of the model.
descriptionFull description of the model.
architecture_idArchitecture ID.
tasksTasks this model supports.
linksLinks to related resources.
is_yoloWhether the model is a YOLO model.
model_idID of an existing model resource. If specified, that model is used instead of creating a new one.
variant_versionModel version. If not specified, the version is auto-incremented from the latest version of the model. If no versions exist, the version is "0.1.0".
variant_descriptionFull description of the model variant.
repository_urlURL of the repository.
commit_hashCommit hash.
quantization_modeQuantization mode.
quantization_dataData used to quantize this model. This can be a predefined domain (DRIVING, FOOD, GENERAL, INDOORS, RANDOM, WAREHOUSE, CLIP, UNKNOWN), a dataset ID, or a path to a local quantization .zip file.
max_quantization_imagesMaximum number of quantization images.
domainDomain of the model.
variant_tagsTags for the model variant.
variant_idID of an existing model version resource. If specified, that version is used instead of creating a new one.
input_shapeInput shape for the model instance.
is_deployableWhether the model instance is deployable.
output_dirDirectory path for the downloaded files. If not specified, the downloader creates a directory named after the exported instance slug under the current working directory.
tool_versionVersion of the tool used for conversion. For RVC2 and RVC3 this is the IR version, while for RVC4 this is the SNPE version.
yolo_input_shapeInput shape for YOLO models.
yolo_versionYOLO version.
yolo_class_namesClass names for YOLO models.
**hub_kwargsAdditional keyword arguments passed to convert.
Returns
ConvertResponseConversion result containing the downloaded output path, export job, and exported model instance.
def RVC2(path: PathType, mo_args: list[str] | None = None, compile_tool_args: list[str] | None = None, compress_to_fp16: bool = True, number_of_shaves: int = 8, superblob: bool = True, opts: Kwargs | list[str] | None = None, **hub_kwargs) -> ConvertResponse:

Convert a model to RVC2 format.

Parameters
path:PathTypePath to the model file to convert.
mo_args:list[str] | NoneAdditional arguments for the Model Optimizer.
compile_tool_args:list[str] | NoneAdditional arguments for the compile tool.
compress_to_fp16:boolWhether to compress the model weights to FP16.
number_of_shaves:intNumber of shaves to use for the conversion.
superblob:boolWhether to create a superblob for the model.
opts:Kwargs | list[str] | NoneAdditional conversion options. These can override config values.
nameModel name. If not specified, the name is taken from the configuration file or the model file.
license_typeLicense type.
is_publicWhether the model is public (True), private (False), or team-scoped (None).
description_shortShort description of the model.
descriptionFull description of the model.
architecture_idArchitecture ID.
tasksTasks this model supports.
linksLinks to related resources.
is_yoloWhether the model is a YOLO model.
model_idID of an existing model resource. If specified, that model is used instead of creating a new one.
variant_versionModel version. If not specified, the version is auto-incremented from the latest version of the model. If no versions exist, the version is "0.1.0".
variant_descriptionFull description of the model variant.
repository_urlURL of the repository.
commit_hashCommit hash.
domainDomain of the model.
variant_tagsTags for the model variant.
variant_idID of an existing model version resource. If specified, that version is used instead of creating a new one.
input_shapeInput shape for the model instance.
is_deployableWhether the model instance is deployable.
output_dirDirectory path for the downloaded files. If not specified, the downloader creates a directory named after the exported instance slug under the current working directory.
tool_versionVersion of the tool used for conversion. For RVC2 and RVC3 this is the IR version, while for RVC4 this is the SNPE version.
yolo_input_shapeInput shape for YOLO models.
yolo_versionYOLO version.
yolo_class_namesClass names for YOLO models.
**hub_kwargsAdditional keyword arguments passed to convert.
Returns
ConvertResponseConversion result containing the downloaded output path, export job, and exported model instance.
def RVC3(path: PathType, mo_args: list[str] | None = None, compile_tool_args: list[str] | None = None, compress_to_fp16: bool = True, pot_target_device: PotDevice | Literal['VPU', 'ANY'] = PotDevice.VPU, opts: Kwargs | list[str] | None = None, **hub_kwargs) -> ConvertResponse:

Convert a model to RVC3 format.

Parameters
path:PathTypePath to the model file to convert.
mo_args:list[str] | NoneAdditional arguments for the Model Optimizer.
compile_tool_args:list[str] | NoneAdditional arguments for the compile tool.
compress_to_fp16:boolWhether to compress the model weights to FP16.
pot_target_device:PotDevice | Literal['VPU', 'ANY']Target device for POT quantization.
opts:Kwargs | list[str] | NoneAdditional conversion options. These can override config values.
nameModel name. If not specified, the name is taken from the configuration file or the model file.
license_typeLicense type.
is_publicWhether the model is public (True), private (False), or team-scoped (None).
description_shortShort description of the model.
descriptionFull description of the model.
architecture_idArchitecture ID.
tasksTasks this model supports.
linksLinks to related resources.
is_yoloWhether the model is a YOLO model.
model_idID of an existing model resource. If specified, that model is used instead of creating a new one.
variant_versionModel version. If not specified, the version is auto-incremented from the latest version of the model. If no versions exist, the version is "0.1.0".
variant_descriptionFull description of the model variant.
repository_urlURL of the repository.
commit_hashCommit hash.
domainDomain of the model.
variant_tagsTags for the model variant.
variant_idID of an existing model version resource. If specified, that version is used instead of creating a new one.
input_shapeInput shape for the model instance.
is_deployableWhether the model instance is deployable.
output_dirDirectory path for the downloaded files. If not specified, the downloader creates a directory named after the exported instance slug under the current working directory.
tool_versionVersion of the tool used for conversion. For RVC2 and RVC3 this is the IR version, while for RVC4 this is the SNPE version.
yolo_input_shapeInput shape for YOLO models.
yolo_versionYOLO version.
yolo_class_namesClass names for YOLO models.
**hub_kwargsAdditional keyword arguments passed to convert.
Returns
ConvertResponseConversion result containing the downloaded output path, export job, and exported model instance.
def RVC4(path: PathType, snpe_onnx_to_dlc_args: list[str] | None = None, snpe_dlc_quant_args: list[str] | None = None, snpe_dlc_graph_prepare_args: list[str] | None = None, use_per_channel_quantization: bool = True, use_per_row_quantization: bool = False, htp_socs: list[Literal['sm8350', 'sm8450', 'sm8550', 'sm8650', 'qcs6490', 'qcs8550']] | None = None, opts: Kwargs | list[str] | None = None, **hub_kwargs) -> ConvertResponse:

Convert a model to RVC4 format.

Parameters
path:PathTypePath to the model file to convert.
snpe_onnx_to_dlc_args:list[str] | NoneAdditional arguments for the SNPE ONNX to DLC conversion.
snpe_dlc_quant_args:list[str] | NoneAdditional arguments for SNPE DLC quantization.
snpe_dlc_graph_prepare_args:list[str] | NoneAdditional arguments for SNPE DLC graph preparation.
use_per_channel_quantization:boolWhether to use per-channel quantization.
use_per_row_quantization:boolWhether to use per-row quantization.
htp_socs:list[Literal['sm8350', 'sm8450', 'sm8550', 'sm8650', 'qcs6490', 'qcs8550']] | NoneHTP SoCs for the final DLC graph.
opts:Kwargs | list[str] | NoneAdditional conversion options. These can override config values.
nameModel name. If not specified, the name is taken from the configuration file or the model file.
license_typeLicense type.
is_publicWhether the model is public (True), private (False), or team-scoped (None).
description_shortShort description of the model.
descriptionFull description of the model.
architecture_idArchitecture ID.
tasksTasks this model supports.
linksLinks to related resources.
is_yoloWhether the model is a YOLO model.
model_idID of an existing model resource. If specified, that model is used instead of creating a new one.
variant_versionModel version. If not specified, the version is auto-incremented from the latest version of the model. If no versions exist, the version is "0.1.0".
variant_descriptionFull description of the model variant.
repository_urlURL of the repository.
commit_hashCommit hash.
quantization_modeQuantization mode to use during conversion. 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.
domainDomain of the model.
variant_tagsTags for the model variant.
variant_idID of an existing model version resource. If specified, that version is used instead of creating a new one.
quantization_dataData used to quantize this model. This can be a predefined domain (DRIVING, FOOD, GENERAL, INDOORS, RANDOM, WAREHOUSE, CLIP, UNKNOWN), a dataset ID, or a path to a local quantization .zip file. Pass the .zip path itself instead of CUSTOM; the SDK normalizes local zip inputs automatically.
max_quantization_imagesMaximum number of quantization images.
input_shapeInput shape for the model instance.
is_deployableWhether the model instance is deployable.
output_dirDirectory path for the downloaded files. If not specified, the downloader creates a directory named after the exported instance slug under the current working directory.
tool_versionVersion of the tool used for conversion. For RVC2 and RVC3 this is the IR version, while for RVC4 this is the SNPE version.
yolo_input_shapeInput shape for YOLO models.
yolo_versionYOLO version.
yolo_class_namesClass names for YOLO models.
**hub_kwargsAdditional keyword arguments passed to convert.
Returns
ConvertResponseConversion result containing the downloaded output path, export job, and exported model instance.
def _combine_opts(target: Target, target_kwargs: Kwargs, opts: list[str] | Kwargs | None) -> list[str]:

Merge generic options with target-prefixed conversion options.

Returns
list[str]A flat option list ready for config parsing.
def _export(name: str, identifier: UUID | str, target: Target, quantization_mode: QuantizationMode | None, quantization_data: str | None, max_quantization_images: int | None = None, yolo_version: str | None = None, yolo_class_names: list[str] | None = None, **kwargs) -> JobMessageResponse:

Starts an export job for a model instance.

Returns
JobMessageResponseThe created export job response.
def _get_instance_response(instance_id: str) -> ModelInstanceResponse | None:

Fetch a model instance response, returning None if missing.

Returns
ModelInstanceResponse | NoneThe model instance response, or None if the instance does not exist yet.
def _resolve_exported_instance(job: JobMessageResponse) -> ModelInstanceResponse:

Resolve the exported model instance from a completed export job.

Returns
ModelInstanceResponseThe exported model instance once it is ready to download.
def _wait_for_exported_instance_ready(instance_id: str, *, timeout_seconds: int = 180, poll_interval_seconds: int = 2) -> ModelInstanceResponse:

Wait until an exported model instance is actually downloadable.

Returns
ModelInstanceResponseThe exported model instance once it becomes downloadable.