Where eval_loop is some function taking model and returning list[list[float]] or tuple[list[list[float]], list[list[float]], depending on what metrics are enabled.
Eval loop can be automatically generated too (for now, only PyTorch users).
Either eval_loop or metrics must be specified.
Additional context
We can also use inspect to look at the eval loop and ensure it is valid before running the eval loop and failing.
For example, an eval loop that is some partial function or has default parameters can also be used.
Obviously, compare will run with the selected backend and device. Work may be done in the future to add support for setting a different device, but for now, batteries included.
Describe the solution you'd like
Public API
approx.compare
approx.compare(original_model, quantized_model, *, eval_loop: Optional[Callable], metrics: Optional[list[Metric]])
Where
eval_loop
is some function takingmodel
and returninglist[list[float]]
ortuple[list[list[float]], list[list[float]]
, depending on what metrics are enabled.Example eval loop:
Eval loop can be automatically generated too (for now, only PyTorch users).
Either
eval_loop
ormetrics
must be specified.Additional context
We can also use
inspect
to look at the eval loop and ensure it is valid before running the eval loop and failing. For example, an eval loop that is some partial function or has default parameters can also be used.Obviously, compare will run with the selected backend and device. Work may be done in the future to add support for setting a different device, but for now, batteries included.
cc @sudomaze