Engine

Engine

class olive.engine.Engine(config: Dict[str, Any] | EngineConfig | None = None, search_strategy: SearchStrategy | None = None, host: OliveSystem | None = None, evaluator: OliveEvaluator | 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(p: Pass, name: str | None = None, host: OliveSystem | None = None, evaluator: OliveEvaluator | None = None, clean_run_cache: bool = False)[source]

Register a pass

run(input_model: OliveModel, verbose: bool = False)[source]

Run all the registered Olive passes on the input model and produce one or more candidate models.

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 cache_dir: Path | str = '.olive-cache'
field clean_cache: bool = False
field clean_evaluation_cache: bool = False
field evaluator: OliveEvaluatorConfig = None
field host: SystemConfig = None
field model_io_config: Dict[str, List] = None
field search_strategy: SearchStrategyConfig = 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 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]
create_system()[source]

OliveEvaluatorConfig

pydantic settings olive.evaluator.olive_evaluator.OliveEvaluatorConfig[source]
field metrics: List[Metric] [Required]
field target: SystemConfig = SystemConfig(type=<SystemType.Local: 'LocalSystem'>, config=LocalTargetUserConfig(device=<Device.CPU: 'cpu'>))
create_evaluator()[source]

SearchStrategy

class olive.strategy.search_strategy.SearchStrategy(config: Dict[str, Any] | SearchStrategyConfig)[source]

Search strategy