from __future__ import annotations from typing import Protocol class CompilerBackend(Protocol): def compile(self, bie_path: str, output_dir: str, **kwargs) -> str: """Compile BIE into NEF and return the generated NEF path.""" class KneronCompilerBackend: def compile(self, bie_path: str, output_dir: str, **kwargs) -> str: import ktc km = ktc.ModelConfig( kwargs["model_id"], kwargs["version"], kwargs["platform"], bie_path=bie_path, ) return ktc.compile([km], output_dir=output_dir or None) def get_compiler_backend(name: str | None = None) -> CompilerBackend: _ = name return KneronCompilerBackend()