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

intelligence.acuirt.workflow

ConversionWorkflow Objects

class ConversionWorkflow()

Workflow for converting and evaluating models with AcuiRT. This class manages the conversion of a PyTorch model to an optimized format using AcuiRT, evaluates converted models, and profiles the converted model's performance.

__init__

def __init__(model: nn.Module,
evaluator: AcuiRTEvalProtocol,
eval_dataset: Iterable[Any],
eval_dataset_post_process: Optional[Callable] = None,
conversion_dataset: Optional[Any] = None,
model_post_process: Optional[Callable] = None,
model_post_process_rt: Optional[Callable] = None,
eval_non_converted_model: bool = False,
settings_torch_profiler: Optional[dict] = None,
profile_max_depth: int = -1,
exporters: Optional[List[ExporterProtocol]] = None,
*,
logger: Optional[AcuiRTDefaultLogger] = None)

Initialize the conversion workflow.

Arguments:

  • model nn.Module - The PyTorch model to convert.
  • evaluator AcuiRTEvalProtocol - Evaluator for model performance.
  • eval_dataset Iterable[Any] - Dataset for evaluating the model.
  • eval_dataset_post_process Optional[Callable] - Post-processing function for evaluation dataset.
  • conversion_dataset Optional[Any] - Dataset for model conversion. Defaults to eval_dataset if None.
  • model_post_process Optional[Callable] - Post-processing function for the original model outputs.
  • model_post_process_rt Optional[Callable] - Post-processing function for the converted model outputs.
  • eval_non_converted_model bool - Whether to evaluate the non-converted model. Defaults to False.
  • settings_torch_profiler Optional[dict] - Settings for torch profiler during profiling. It is strongly recommended to set 'activities' and 'schedule' keys.
  • profile_max_depth int - Maximum depth for profiling nn.Module inference. Defaults to -1 (no limit).
  • exporters Optional[List[ExporterProtocol]] - List of exporters to export the workflow report.
  • logger Optional[AcuiRTDefaultLogger] - Logger for logging information during conversion.

run

def run(config: Union[dict, AcuiRTBaseConversionConfig,
AcuiRTBaseConversionReport],
export_path: str,
skip_conversion: bool = False)

Run the conversion workflow.

Arguments:

  • config Union[dict, AcuiRTBaseConversionConfig, AcuiRTBaseConversionReport] - Configuration for model conversion.
  • export_path str - Path to export the converted model and report. skip_conversion (bool): Whether to skip the conversion step. Defaults to False.

Returns:

Tuple[nn.Module, AcuiRTWorkFlowReport]: The converted model and workflow report