Engine¶
Engine¶
- class olive.engine.Engine(config: Dict[str, Any] | EngineConfig | None = None, search_strategy: SearchStrategy | None = None, host: OliveSystem | None = None, target: OliveSystem | None = None, evaluator_config: OliveEvaluatorConfig | None = None, execution_providers: List[str] | None = None)[source]¶
The engine executes the registered Olive Steps, facilitate evaluation of the output models using provided evaluation criteria and produces output model(s).
- register(pass_type: Type[Pass], config: Dict[str, Any] | None = None, disable_search=False, name: str | None = None, host: OliveSystem | None = None, evaluator_config: OliveEvaluatorConfig | None = None, clean_run_cache: bool = False)[source]¶
Register a pass configuration so that it could be instantiated and executed later.
- run(input_model: OliveModel, packaging_config: PackagingConfig | None = None, output_dir: str | None = None, output_name: str | None = None, evaluation_only: bool = False)[source]¶
Run all the registered Olive passes on the input model and produce one or more candidate models.
if search strategy is None, all passes are run in the order they were registered. Save the final model to {output_dir}/{output_name}_model and json file to {output_dir}/{output_name}_model.json Save evaluation results of the final model, if any, to {output_dir}/{output_name}_metrics.json Return {“model”: final_model_json, “metrics”: evaluation_results}
if search strategy is not None, run the search strategy to find candidate models. TODO: save the results using updated RunResult
if evaluation_only is True, run the evaluation on the input model and return the results.
Note
All parameters that of type ...Config
or ConfigBase
class can be assigned dictionaries with keys corresponding
to the fields of the class.
EngineConfig¶
- pydantic settings olive.engine.EngineConfig[source]¶
- field azureml_client_config: AzureMLClientConfig | None = None¶
- field cache_dir: Path | str = '.olive-cache'¶
- field clean_cache: bool = False¶
- field clean_evaluation_cache: bool = False¶
- field evaluator: OliveEvaluatorConfig = None¶
- field execution_providers: List[str] = None¶
- field host: SystemConfig = None¶
- field packaging_config: PackagingConfig = None¶
- field plot_pareto_frontier: bool = False¶
- field search_strategy: SearchStrategyConfig | bool = None¶
- field target: SystemConfig = None¶
SearchStrategyConfig
- pydantic settings olive.strategy.search_strategy.SearchStrategyConfig[source]¶
- field execution_order: str [Required]¶
- field max_iter: int = None¶
- field max_time: int = None¶
- field output_model_num: int = None¶
- field search_algorithm: str [Required]¶
- field search_algorithm_config: ConfigBase = None¶
- field stop_when_goals_met: bool = False¶
SystemConfig
- pydantic settings olive.systems.system_config.SystemConfig[source]¶
- field config: TargetUserConfig = None¶
- field type: SystemType [Required]¶
OliveEvaluatorConfig
SearchStrategy¶
- class olive.strategy.search_strategy.SearchStrategy(config: Dict[str, Any] | SearchStrategyConfig)[source]¶
Search strategy