module documentation

Undocumented

Function full_slug_to_id Resolve a full HubAI slug to a resource ID using the slug API.
Function get_configs Sets up the configuration.
Function get_output_dir_name Build an output directory path for a conversion result.
Function get_resource_id Resolve a UUID, HubAI ID, or slug into a resource ID.
Function get_resource_info Fetch raw HubAI resource data for a resolved identifier.
Function get_target_specific_options Build export options for a target from a parsed config.
Function get_variant_name Derive a variant name, appending input resolution when known.
Function get_version_number Return the next patch version for a model's variants.
Function init_dirs Create the SDK working directories if they do not exist.
Function is_hubai_id Return whether an identifier looks like a HubAI resource ID.
Function is_valid_uuid Return whether a string is a valid UUID.
Function print_hub_ls Render a list of HubAI resources as a rich table.
Function print_hub_resource_info Render a single HubAI resource in CLI-friendly rich output.
Function raise_for_hub_error Translate a requests HTTPError into an SDK-specific exception.
Function resolve_resource_id Resolve an identifier and translate lookup failures to SDK errors.
Function run_cli Run a CLI action and convert SDK exceptions into clean exits.
Function slug_to_id Resolve a simple slug to a resource ID by querying HubAI.
Function wait_for_job Poll a HubAI job until it completes or fails.
Type Variable T Undocumented
Type Alias ResourceEndpoint Undocumented
Function _format_http_error_items Format validation-style error items into a single message string.
Function _get_http_error_detail Extract a readable error message from a requests HTTPError.
def full_slug_to_id(slug: str, endpoint: Literal['models', 'modelVersions', 'modelInstances']) -> str:

Resolve a full HubAI slug to a resource ID using the slug API.

def get_configs(path: str | None, opts: list[str] | dict[str, Any] | None = None) -> tuple[Config, NNArchiveConfig | None, str | None]:

Sets up the configuration.

Parameters
path:str | NonePath to the configuration file or NN Archive.
opts:list[str] | dict[str, Any] | NoneOptional CLI overrides for the config file.
Returns
tuple[Config, NNArchiveConfig | None, str | None]Tuple of the parsed modelconverter Config, optional NNArchiveConfig, and the main stage key.
def get_output_dir_name(target: Target, name: str, output_dir: str | None) -> Path:

Build an output directory path for a conversion result.

def get_resource_id(identifier: str, endpoint: Literal['models', 'modelVersions', 'modelInstances']) -> str:

Resolve a UUID, HubAI ID, or slug into a resource ID.

Parameters
identifier:strUser-supplied UUID, HubAI ID, or slug.
endpoint:Literal['models', 'modelVersions', 'modelInstances']Resource endpoint to resolve against.
Returns
strThe resolved HubAI resource ID.
Raises
ValueErrorIf the identifier cannot be resolved.
def get_resource_info(identifier: str, endpoint: ResourceEndpoint) -> dict[str, Any]:

Fetch raw HubAI resource data for a resolved identifier.

def get_target_specific_options(target: Target, cfg: SingleStageConfig, tool_version: str | None = None) -> dict[str, Any]:

Build export options for a target from a parsed config.

def get_variant_name(cfg: SingleStageConfig, model_type: ModelType, name: str) -> str:

Derive a variant name, appending input resolution when known.

def get_version_number(model_id: str) -> str:

Return the next patch version for a model's variants.

def init_dirs():

Create the SDK working directories if they do not exist.

def is_hubai_id(identifier: str) -> bool:

Return whether an identifier looks like a HubAI resource ID.

def is_valid_uuid(uuid_string: str) -> bool:

Return whether a string is a valid UUID.

def print_hub_ls(data: list[dict[str, Any]], keys: list[str], rename: dict[str, str] | None = None):

Render a list of HubAI resources as a rich table.

def print_hub_resource_info(model: dict[str, Any], keys: list[str], json: bool, rename: dict[str, str] | None = None, **kwargs):

Render a single HubAI resource in CLI-friendly rich output.

def raise_for_hub_error(exc: HTTPError, *, identifier: str | None = None, endpoint: ResourceEndpoint | Literal['jobs'] | None = None, conflict_message: str | None = None) -> NoReturn:

Translate a requests HTTPError into an SDK-specific exception.

def resolve_resource_id(identifier: str, endpoint: ResourceEndpoint) -> str:

Resolve an identifier and translate lookup failures to SDK errors.

def run_cli(action: Callable[[], T]) -> T:

Run a CLI action and convert SDK exceptions into clean exits.

def slug_to_id(slug: str, endpoint: Literal['models', 'modelVersions', 'modelInstances']) -> str:

Resolve a simple slug to a resource ID by querying HubAI.

def wait_for_job(job_id: str) -> JobMessageResponse:

Poll a HubAI job until it completes or fails.

Parameters
job_id:strHubAI job ID.
Returns
JobMessageResponseThe completed job response.
Raises
HubApiErrorIf the job fails or ends in a terminal non-success status.
T =

Undocumented

Value
TypeVar('T')
ResourceEndpoint =

Undocumented

Value
Literal['models', 'modelVersions', 'modelInstances']
def _format_http_error_items(items: list[object]) -> str | None:

Format validation-style error items into a single message string.

def _get_http_error_detail(exc: HTTPError) -> str:

Extract a readable error message from a requests HTTPError.