File size: 2,220 Bytes
f21249a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
"""
Custom exceptions for KerdosAI.
"""
class KerdosError(Exception):
"""Base exception for all KerdosAI errors."""
def __init__(self, message: str, details: dict = None):
self.message = message
self.details = details or {}
super().__init__(self.message)
def __str__(self):
if self.details:
details_str = ", ".join(f"{k}={v}" for k, v in self.details.items())
return f"{self.message} ({details_str})"
return self.message
class ConfigurationError(KerdosError):
"""Raised when there's an error in configuration."""
pass
class ModelError(KerdosError):
"""Base exception for model-related errors."""
pass
class ModelLoadError(ModelError):
"""Raised when model loading fails."""
pass
class ModelSaveError(ModelError):
"""Raised when model saving fails."""
pass
class ModelInitializationError(ModelError):
"""Raised when model initialization fails."""
pass
class DataError(KerdosError):
"""Base exception for data-related errors."""
pass
class DataLoadError(DataError):
"""Raised when data loading fails."""
pass
class DataValidationError(DataError):
"""Raised when data validation fails."""
pass
class DataProcessingError(DataError):
"""Raised when data processing fails."""
pass
class TrainingError(KerdosError):
"""Base exception for training-related errors."""
pass
class TrainingConfigurationError(TrainingError):
"""Raised when training configuration is invalid."""
pass
class CheckpointError(TrainingError):
"""Raised when checkpoint operations fail."""
pass
class DeploymentError(KerdosError):
"""Base exception for deployment-related errors."""
pass
class DeploymentConfigurationError(DeploymentError):
"""Raised when deployment configuration is invalid."""
pass
class InferenceError(KerdosError):
"""Raised when inference fails."""
pass
class ResourceError(KerdosError):
"""Raised when there are resource-related issues (GPU, memory, etc.)."""
pass
class DependencyError(KerdosError):
"""Raised when required dependencies are missing or incompatible."""
pass
|