跳到内容

异常

本节包含 distilabel 自定义异常。与错误不同,distilabel 中的异常用于处理可以预见并在库内部以受控方式处理的特定情况。

DistilabelException

基类:Exception

distilabel 框架的基础异常(可以优雅地处理)。

源代码位于 src/distilabel/exceptions.py
class DistilabelException(Exception):
    """Base exception (can be gracefully handled) for `distilabel` framework."""

    pass

DistilabelGenerationException

基类:DistilabelException

LLM 生成错误的基础异常。

源代码位于 src/distilabel/exceptions.py
class DistilabelGenerationException(DistilabelException):
    """Base exception for `LLM` generation errors."""

    pass

DistilabelOfflineBatchGenerationNotFinishedException

基类:DistilabelGenerationException

当批处理生成未完成时引发的异常。

源代码位于 src/distilabel/exceptions.py
class DistilabelOfflineBatchGenerationNotFinishedException(
    DistilabelGenerationException
):
    """Exception raised when a batch generation is not finished."""

    jobs_ids: Tuple[str, ...]

    def __init__(self, jobs_ids: Tuple[str, ...]) -> None:
        self.jobs_ids = jobs_ids
        super().__init__(f"Batch generation with jobs_ids={jobs_ids} is not finished")