mode

Interface and utilities for optimization modes/algorithms.

A mode is a specific type or algorithms for model optimization, e.g., some type of algorithm for pruning or quantization. It can also specify a single step within an optimization algorithm instead of the whole algorithm. For example, a mode can prepare a model for pruning or export (i.e. fix the optimal model configuration) after pruning.

Within modelopt, a mode constitutes the unit for model optimization. We can define arbitrary modes, each mode gets recorded in the model’s modelopt state dict, and we can define workflows as a sequence of modes.

Classes

ABC

Helper class that provides a standard way to create an ABC using inheritance.

Any

Special type indicating an unconstrained type.

BaseSearcher

A basic search interface that can be used to search/optimize a model.

TypeVar

Type variable.

Functions

abstractmethod

A decorator indicating abstract methods.

get_mode_config

Standardize mode to ModeConfigDict and return.

val2list

Repeat val for repeat_time times and return the list or val if list/tuple.