メインコンテンツまでスキップ
バージョン: v2509

convert.converter.convert_auto

auto_convert2trt

@register_conversion("auto")
def auto_convert2trt(model: nn.Module,
input_args,
export_path: str,
conversion_mode: str = "onnx",
argument_infos: dict = {},
**kwargs) -> Union[None, Dict[str, Any]]

Automatically converts a PyTorch model to Compiled format using the specified conversion mode.

Arguments:

  • model - The PyTorch model to convert.
  • input_args - Input arguments for the model.
  • export_path - Path where the converted model will be saved.
  • conversion_mode - Conversion mode to use (default: 'onnx').
  • argument_infos - Dictionary containing argument information for modules.
  • **kwargs - Additional keyword arguments for conversion.

Returns:

dict[str, Any] | None: Conversion summary containing module-wise results or None if conversion failed.

Raises:

  • Exception - If the conversion process encounters errors during module validation.

auto_preprocess

def auto_preprocess(model: nn.Module, data_loader, data_loader_post_process)

Preprocesses the model and data loader for automatic conversion.

Arguments:

  • model - The PyTorch model to preprocess.
  • data_loader - Data loader containing input data for the model.
  • data_loader_post_process - Optional post-processing function for data loader items.

Returns:

  • dict - Dictionary containing arguments, returns, and called functions information.