RunEvalTask / InferenceGenerator

This commit is contained in:
Xi Yan 2024-10-13 23:48:15 -07:00
parent 8890de7322
commit 78cb88c3c4
5 changed files with 111 additions and 84 deletions

View file

@ -171,7 +171,7 @@ class BaseGeneratorProcessor(
raise NotImplementedError()
class BaseGenerator(ABC, Generic[TGenerationResponseSample]):
class BaseGenerator(ABC, Generic[TPreprocessedSample, TGenerationResponseSample]):
"""
Base class for all generators. Each generator needs to implement the following methods:
- generate(self, preprocessed_dataset)
@ -184,7 +184,7 @@ class BaseGenerator(ABC, Generic[TGenerationResponseSample]):
return self.__class__.__name__
@abstractmethod
def generate(
async def generate(
self, preprocessed_dataset: List[TPreprocessedSample]
) -> List[TGenerationResponseSample]:
raise NotImplementedError()
@ -231,7 +231,7 @@ class BaseTask(ABC):
self.scorer = scorer
@abstractmethod
def run(self, *args, **kwargs) -> EvalResult:
async def run(self, *args, **kwargs) -> EvalResult:
raise NotImplementedError()