27 lines
646 B
Python
27 lines
646 B
Python
from __future__ import annotations
|
|
|
|
from typing import Protocol
|
|
|
|
|
|
class EvaluatorBackend(Protocol):
|
|
def evaluate(self, onnx_path: str, **kwargs) -> str:
|
|
"""Run IP evaluation and return a report string."""
|
|
|
|
|
|
class KneronEvaluatorBackend:
|
|
def evaluate(self, onnx_path: str, **kwargs) -> str:
|
|
import ktc
|
|
|
|
km = ktc.ModelConfig(
|
|
kwargs["model_id"],
|
|
kwargs["version"],
|
|
kwargs["platform"],
|
|
onnx_path=onnx_path,
|
|
)
|
|
return km.evaluate()
|
|
|
|
|
|
def get_evaluator_backend(name: str | None = None) -> EvaluatorBackend:
|
|
_ = name
|
|
return KneronEvaluatorBackend()
|