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:
modelnn.Module - The PyTorch model to convert.evaluatorAcuiRTEvalProtocol - Evaluator for model performance.eval_datasetIterable[Any] - Dataset for evaluating the model.eval_dataset_post_processOptional[Callable] - Post-processing function for evaluation dataset.conversion_datasetOptional[Any] - Dataset for model conversion. Defaults to eval_dataset if None.model_post_processOptional[Callable] - Post-processing function for the original model outputs.model_post_process_rtOptional[Callable] - Post-processing function for the converted model outputs.eval_non_converted_modelbool - Whether to evaluate the non-converted model. Defaults to False.settings_torch_profilerOptional[dict] - Settings for torch profiler during profiling. It is strongly recommended to set 'activities' and 'schedule' keys.profile_max_depthint - Maximum depth for profiling nn.Module inference. Defaults to -1 (no limit).exportersOptional[List[ExporterProtocol]] - List of exporters to export the workflow report.loggerOptional[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:
configUnion[dict, AcuiRTBaseConversionConfig, AcuiRTBaseConversionReport] - Configuration for model conversion.export_pathstr - 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